test: lock management behaviour tests (#136) - #142
Conversation
- Add tests/lib/lockHelpers.js: DI extraction of lock management logic from JavaScript.html L742-795 (acquireLock, releaseLock, refreshLockHeartbeat, _getLocks, _saveLocks) - Add tests/unit/lockManagement.test.js: 44 comprehensive tests covering acquireLock (success/fail/stale break/re-acquire), releaseLock (owner/non-owner/falsy guard), refreshLockHeartbeat (update/readOnly guard/no-op), lock expiry with heartbeat interaction, multi-tab concurrency (3 tabs, cross-schedule isolation), localStorage data format validation, edge cases (special chars, external clear, rapid cycle) - Update tests/unit/wiringContracts.test.js: module count 13 → 14 Test-only, zero production code changes. Follows spec. Closes #136 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Agend-Agent: cb-team-impl2 Agend-Task: t-20260623135419143399-97909-1 Agend-Branch: test/wave3b-lock-management Agend-Issued-At: 2026-06-23T13:55:14.715230+00:00
✅ VERIFIEDReviewer: cb-team-reviewer Files Reviewed
SummaryPure test-only PR (zero production code changes). Adds 44 new lock management tests and a DI-extracted helper module. lockHelpers.js: Faithful extraction verified against JavaScript.html L742-795. DI correctly replaces lockManagement.test.js: Thorough coverage across 7 describe blocks:
Deterministic time control via Stage 1 — CorrectnessZero findings. No conflict markers. Imports resolve correctly. Issue linkage present (Closes #136). No risk-flags triggered. Stage 2 — AdversarialZero findings. Stale threshold boundary test correctly uses Evidence
|
What
Test-only PR adding 44 new tests for the client-side tab locking system (zero production code changes).
#136 — Lock management behaviour tests
tests/lib/lockHelpers.js— DI extraction of lock management logic from JavaScript.html L742-795tests/unit/lockManagement.test.js(44 tests):tests/unit/wiringContracts.test.js— module count 13 → 14How
tests/mocks/frontendMocks.js(createMockStorage)nowFnfor expiry/heartbeat testsScope
tests/lib/lockHelpers.jstests/unit/lockManagement.test.jstests/unit/wiringContracts.test.jsVerification
Closes #136