Ship: fix JS-0357 (variable-used-before-defined) cluster in domains/device src/events/index.ts (merged)
cancelled12 occurrences in one file, identified in the 2026-05-05 DeepSource sweep (memory/2026-05-05-deepsource-sweep-domains-device.md, recommendation #4). Likely a const-after-use or hoisting pattern. Flow: (1) fetch full findings list for file from DeepSource, (2) create worktree `../mono-fix-events-js0357 -b kai/fix-events-js0357`, (3) reorder declarations / hoist as needed, (4) run local tests for events module, (5) Linear issue on Alloy, (6) open PR, (7) shepherd to merged. Definition of done: PR mergedAt != null.
Event Timeline
created
status_change
queued → in_progress
failed
lease expired — re-queued for retry
in_progress → queued
status_change
queued → in_progress
progress
Resumed — latest HEAD is d82c183c94 which already fixes the TS2554 (initializeMonitoringPipeline signature changed to 2 args; call updated). build-docker now passes on latest run; test-device-domain + DeepSource still running. Monitoring.
failed
lease expired — re-queued for retry
in_progress → queued
status_change
queued → in_progress
progress
CI state resolved. Branch tip d82c183c94 + empty commit 349e2a4101 (DeepSource re-trigger) + 5f8cc3b (current HEAD). ACTUAL RESULTS: DeepSource JavaScript PASS (18 JS-0357 occurrences resolved, 0 introduced — JS-0357 cluster fully closed). test-device-domain PASS. build-docker PASS. apollo-schema-publish PASS. Cursor Bugbot PASS. CodeRabbit skipped (review skipped). Only DeepSource Test coverage FAILS — 15 TCV-001 lines flagged inside the hoisted mockEventBus+wrap block (lines 44/69/94/99/105/115/120/134/137/141/145/150/218/221/225). These are PRE-EXISTING uncovered lines whose absolute line numbers shifted due to the hoist. Enforced new-code metrics (NLCV/NBCV/NCPCV) all report 100 percent; diff-level LCV shows 79.4 percent vs DeepSource-UI threshold. Precedent: PR #9860 merged with both DeepSource checks FAILURE — test-coverage is advisory, not merge-blocking. PR is MERGEABLE; mergeStateStatus=BLOCKED only because reviewDecision=REVIEW_REQUIRED (agent PR needs human approver). Ready for Carson to review/approve.
status_change
in_progress → blocked
progress
Subagent verified CI fully green on PR #9932. Only DeepSource test-coverage is FAILURE (repo-level soft-fail, precedent PR #9687). Blocked only on REVIEW_REQUIRED. Carson pinged for approval.
status_change
blocked → in_progress
failed
lease expired — max retries reached, marking failed (poison pill)
in_progress → failed
status_change
failed → blocked
status_change
blocked → cancelled