- Moved `withTimeout` implementation to `src/lock-utils.mjs` and exported it correctly.
- Removed duplicate local definitions of `withTimeout`, `mergeRelayList`, and `secureRandom` in `src/lock-ops.mjs` and `src/lock-publisher.mjs`.
- Fixed imports in `src/lock-ops.mjs`, `src/lock-publisher.mjs`, and `src/relay-health.mjs` to use `src/lock-utils.mjs` consistently.
- Updated `test/utils.test.mjs` and `test/utils-async.test.mjs` to fix broken imports and test definitions.
- Verified `npm run lock:complete` and `npm run scheduler:daily` execute correctly.
- Updated `src/todo/TODO_2026-02-20T03-00-00Z.md` to mark verification task as completed.
- Verified `src/relay-health.mjs` does not use `MINUTE_MS` locally, despite mysterious CI error. Confirmed imports are correct.
Co-authored-by: PR0M3TH3AN <[email protected]>
Added comprehensive unit tests for `withTimeout`, `relayListLabel`, and `mergeRelayList` in `test/lock-utils.test.mjs`.
- `withTimeout`: Verified resolution, timeout rejection, and promise rejection.
- `relayListLabel`: Verified list joining and edge cases.
- `mergeRelayList`: Verified merging, deduplication, and empty list handling.
This improves code coverage and reliability for these utility functions.
Co-authored-by: PR0M3TH3AN <[email protected]>
Add a unit test for `getCompletedAgents` in `src/lock-utils.mjs` to verify that:
1. It correctly identifies completed agents.
2. It handles `ENOENT` gracefully (silent).
3. It logs an error for non-`ENOENT` errors (e.g. permission denied).
The `getCompletedAgents` function already supported dependency injection via a `deps` object, which is utilized in this test to mock `fs.readdir` and other dependencies.
Co-authored-by: PR0M3TH3AN <[email protected]>