Add CodeRabbit refactor sanity-check rule to HEARTBEAT.md
completedAgent: slava-agent
Priority: 2
Atomic single edit to HEARTBEAT.md Step 4 (Git & work), queued from 2026-06-11 04:35Z self-reflection. Codifies the lesson from the BOLT-1108 PR #12052 TS2307 regression.
CONTEXT: 2026-06-10T12:21Z–13:32Z. CodeRabbit posted a refactor recommendation on PR #12052: "import from @/repositories/telemetryRepository instead of the relative path." Round-1 sub-agent applied it. CI went RED with TS2307: `Cannot find module @/repositories/telemetryRepository`. Root cause: that module had been REMOVED in PR #12017, which merged onto main BEFORE the BOLT-1108 branch forked. CodeRabbit was working off a stale view of the codebase. Recovery took ~1 hour and one additional fix sub-agent.
DOCTRINE TO ADD (HEARTBEAT.md Step 4 / Git & work, adjacent to the 3-rounds-then-state-coverage and in-thread-one-liner sections):
```
### CodeRabbit refactor sanity-check before applying
When CodeRabbit (or any reviewer — Cursor, human) recommends a module-path refactor — barrel imports, switch-to-canonical-path, import-from-X-instead-of-Y, dropping a relative import — run a 30-second sanity check BEFORE applying the recommendation:
```
cd <worktree-root>
git fetch origin main --quiet && git log origin/main..HEAD --oneline | head
# Then verify the target module path exists on current main:
grep -r '<target-module-path>' $(git rev-parse --show-toplevel)/<domain-or-package> | head
```
If the target module path does NOT exist on current origin/main, the recommendation is stale (likely based on a pre-merge codebase state the reviewer was trained on or last analyzed). Do NOT apply.
Instead: reply in-thread that the recommendation appears stale (`Cursor/CodeRabbit recommended X, but the target module Y was removed in PR #NNNN — leaving the original import`). Move on to the next finding.
Case study (2026-06-10 PR #12052, BOLT-1108): CodeRabbit recommended barrel import from `@/repositories/telemetryRepository`. That module was removed in PR #12017 (merged before this branch forked). 30-second grep on main would have shown the surviving module is `@/repositories/telemetry`. Without the check: 2 commits, 1 hour of recovery work, one additional fix sub-agent, three DMs.
```
DELIVERY: workspace-internal write to ~/agents/slava-agent/HEARTBEAT.md. No PR. After the edit, PATCH this fleet-task to completed via bin/fleet-task-patch.sh with a short result citing the case study and the file:line of the inserted section.
Event Timeline
created
status_change
queued → completed