Skip to content

v3.10.0

Latest

Choose a tag to compare

@tomkp tomkp released this 29 Nov 09:01
332daa2

Behaviour changes

Worth knowing before upgrading. Each one fixes a bug, but apps can see the difference:

  • Starting before the PC/SC service is running (#168). ReaderMonitor.start() no longer throws when the service isn't running. It reports one error, retries once a second, and emits monitor-recovered when the service is up. Devices.start() does the same when it has an error listener; without one it throws as before.
  • One error per service outage, not one a second (#168). This applies to an outage that begins mid-run too.
  • waitForChange() rejects arguments it used to ignore (#167). A first argument that isn't an array, a number, undefined or null is a TypeError, and so is a timeout that isn't a number.
  • A cancelled waitForChange() always resolves with null (#169), even if the cancel couldn't reach it. Before, it could resolve with reader states or [].

Bug Fixes

Service outages

  • An app started while the PC/SC service is down now sees readers once it starts (#168). On Windows the Smart Card service stops while no reader is plugged in, so Devices started in that state reported one error and then never saw a reader until the app restarted. The same happened anywhere start() ran before pcscd was up.
  • stop() during recovery returns promptly (#168).

waitForChange()

  • A timeout after undefined or null readers is honoured (#167). waitForChange(undefined, 5000) waited for ever.
  • Infinity means no timeout, and a negative timeout is already spent (#167). Infinity returned at once, and a negative timeout waited about 49 days.
  • cancel() and close() no longer block for minutes when pcscd is out of contexts (#169). With about 200 waits pending, cancel() spent a second on each and blocked the main thread throughout: 264 s for 199 waits. It now gives up after 100 ms of failures, and close() releases its own context first, which lets it end every wait.

Testing

  • CI tests Node 26 on Linux, macOS and Windows, and under AddressSanitizer (#166).
  • A TLA+ model of waitForChange(), cancel() and close(), checked in CI (#171).
  • The reader monitor's model follows Node's real teardown order (#174). The order of the two cleanup hooks turns out not to matter; what matters is that the hook joins the monitor thread.
  • Unit tests no longer depend on the coverage tool (#170). When c8 couldn't load on Node 26, every test in the job was silently skipped.

Internal

  • CI actions are pinned by commit SHA and kept current by Dependabot; npm ci with a cache replaces npm install (#170, #173).
  • c8 12, a development dependency (#166). The only runtime dependency, node-addon-api, is unchanged.

Documentation

  • waitForChange()'s cancel() and close(), and Devices during a service outage (#164).
  • A "Correctness" section in the README, pointing at the TLA+ specs (#175).

Full Changelog

v3.9.0...v3.10.0