Skip to content

PRD-220: Land drift audit, annotations, and helper consolidation#155

Draft
peterulsteen wants to merge 3 commits intomainfrom
symphony/prd-220
Draft

PRD-220: Land drift audit, annotations, and helper consolidation#155
peterulsteen wants to merge 3 commits intomainfrom
symphony/prd-220

Conversation

@peterulsteen
Copy link
Copy Markdown
Contributor

Summary

Squash-merge of integration branch symphony/prd-220 containing the completed portion of PRD-220 — Fix Stale Mocks in closedloop-electron. Test-only changes; no production runtime modified.

Bundles three already-merged-to-integration PRs:

What's deferred to follow-up

These small remaining items will land in one short follow-up PR rather than four orchestrated FEAs:

  • FR6 — mock-hygiene convention in apps/desktop/CLAUDE.md (~15 lines)
  • FR8 — one-time verification of .github/workflows/test.yml (PR description note)
  • FR4 spot-fixes — any drift the audit flagged as actually stale (audit indicates very few)
  • FR5 — drift-check script: prototype or invoke PRD's explicit fallback to FR6 alone

ClosedLoop FEA-618 / 619 / 620 / 621 will be marked OBSOLETE in favor of one consolidated successor.

Test plan

  • CI green on this PR (lint + typecheck + test via .github/workflows/test.yml)
  • Local: pnpm -C apps/desktop test passes (note: typecheck locally requires GITHUB_TOKEN for @closedloop-ai/loops-api@0.2.9; CI installs cleanly)
  • Spot-check apps/desktop/test/DRIFT-AUDIT.md rendered on the PR diff

🤖 Generated with Claude Code

@peterulsteen peterulsteen requested a review from a team May 5, 2026 18:57
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

peterulsteen and others added 3 commits May 5, 2026 13:58
…st.ts (#124)

- Classifies telemetry-loop-integration.test.ts as Class C (not stale)
- Documents actual symphony-loop.ts spawn sites (lines 1836, 4349, 4374,
  4407, 4446, 4467, 4500) correcting PRD's inaccurate citations (1733,
  3697-3830)
- Documents telemetry emission sites (lines 2923, 3339, 3409, 4162,
  4253, 4517)
- Records close-out rationale: all 6 tests pass against current production
  code, no PTY migration ever existed in the codebase
- Confirms zero matches for spawnPtySession/spawnPty/pty.spawn/node-pty

Testing: tsx --test apps/desktop/test/telemetry-loop-integration.test.ts
  passes 6/6 tests; just desktop-lint clean

Risks: None identified

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add drift-check comments in spawn-related tests pointing to their
  current production source line numbers in symphony-interactive.ts,
  codex.ts, learnings.ts, error-handlers.ts, boot-recovery.ts,
  spawn-retry.ts, and git-helpers.ts so test/source drift can be
  detected mechanically.
- Document the known Class (i)/Class (ii) drift in spawn-hardening
  tests (a) and (a-unref) at the top of spawn-hardening.test.ts;
  remediation is deferred to Feature 3.
- Replace inline buildMockChildProcess() and makeEnoentError() copies
  in spawn-enoent-characterization and spawn-retry tests with imports
  from the shared helpers/spawn-test-utils module.
- Restore setShellPathForTest() calls in loop-finalizer and
  symphony-loop-auto-clone tests after PATH overrides so child
  processes resolve binaries from the test fixture directory.

Testing:
- Static change only; existing test suites continue to import the same
  helpers and behave identically. Run `just desktop-test` to confirm.

Risks:
- Low. Comments and import refactors only; no production code touched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Audited all 73 test files in apps/desktop/test/ against production
  sources; 63 files have no drift patterns, 10 are annotated
- Annotated drift-check headers in boot-recovery, codex-log-parsing,
  codex-spawn-enoent, error-handlers, git-helpers-shell-safety,
  spawn-enoent-characterization, spawn-retry, and spawn-hardening
- Vocabulary decision adopted: two-form standard --
  // drift-check: matches for Class (i) line-anchor annotations,
  // drift-check: replicates for Class (ii) pattern-replication sites.
  Applied consistently to spawn-enoent-characterization (489, 1047),
  spawn-hardening tests (b)/(c)/(d) (489, 1047, codex.ts:1985,
  learnings.ts:264), reflecting the entire pattern-replication surface
  per PRD-220 vocabulary rationale.
- Fixed boot-recovery.test.ts annotation anchor: :303 -> :308
  (isProcessRunning(pid) line in boot-recovery.ts)
- Swept stale prose contradictions in codex-spawn-enoent.test.ts header
  block (lines 17-23) so prose line citations no longer contradict
  adjacent // drift-check: annotations
- Added JSDoc on makeEnoentError documenting code: 'ENOENT' and
  syscall: 'spawn' fields, with note for callers needing a syscall-free
  shape
- New: apps/desktop/test/DRIFT-AUDIT.md -- in-tree mirror of the audit
  table for downstream FEA-618/619/621 to consume without reaching for
  PR description archives
- CLAUDE.md: added a pointer to the new DRIFT-AUDIT.md under Learned
  Patterns
- apps/desktop/package.json: patch version bump 0.13.20 -> 0.13.21

Testing: just desktop-typecheck, just desktop-lint, just desktop-test
all expected to pass; this PR is annotation-only with no production
source changes.

Risks: None identified -- changes confined to test annotations,
test/helpers JSDoc, a new in-tree audit document, a CLAUDE.md pointer,
and a desktop package patch version bump. No production runtime code
modified.
@peterulsteen peterulsteen marked this pull request as draft May 5, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant