Repository navigation
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 oneerror, retries once a second, and emitsmonitor-recoveredwhen the service is up.Devices.start()does the same when it has anerrorlistener; without one it throws as before. - One
errorper 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,undefinedornullis aTypeError, and so is a timeout that isn't a number.- A cancelled
waitForChange()always resolves withnull(#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
Devicesstarted in that state reported one error and then never saw a reader until the app restarted. The same happened anywherestart()ran before pcscd was up. stop()during recovery returns promptly (#168).
waitForChange()
- A timeout after
undefinedornullreaders is honoured (#167).waitForChange(undefined, 5000)waited for ever. Infinitymeans no timeout, and a negative timeout is already spent (#167).Infinityreturned at once, and a negative timeout waited about 49 days.cancel()andclose()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, andclose()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()andclose(), 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
c8couldn'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 ciwith a cache replacesnpm install(#170, #173). c812, a development dependency (#166). The only runtime dependency,node-addon-api, is unchanged.
Documentation
waitForChange()'scancel()andclose(), andDevicesduring a service outage (#164).- A "Correctness" section in the README, pointing at the TLA+ specs (#175).