Skip to content

PLN-392: Complete 73-file drift audit and annotation closure#134

Merged
peterulsteen merged 1 commit into
symphony/prd-220from
symphony/pln-392
Apr 29, 2026
Merged

PLN-392: Complete 73-file drift audit and annotation closure#134
peterulsteen merged 1 commit into
symphony/prd-220from
symphony/pln-392

Conversation

@peterulsteen
Copy link
Copy Markdown
Contributor

@peterulsteen peterulsteen commented Apr 28, 2026

Summary

This PR closes the test-drift audit work tracked under PLN-392 / FEA-688. It targets symphony/prd-220 (the PRD-220 integration branch) so the audit record lands alongside the policy it validates.

  • Completes the full 73-file audit of apps/desktop/test/ against current production sources
  • Annotates DRIFT ANNOTATION headers on the 8 files with drift patterns (boot-recovery, codex-log-parsing, codex-spawn-enoent, error-handlers, git-helpers-shell-safety, spawn-enoent-characterization, spawn-hardening, spawn-retry); the remaining 65 files are classified no drift patterns
  • Adopts a two-form annotation vocabulary (// drift-check: matches / // drift-check: replicates) and applies it consistently across all annotated sites
  • Sweeps stale prose contradictions in codex-spawn-enoent.test.ts:17-23
  • Fixes the boot-recovery.test.ts annotation anchor (:303:308, the actual isProcessRunning(pid) line)
  • Adds a JSDoc block to makeEnoentError documenting the always-present code: 'ENOENT' and syscall: 'spawn' fields
  • New: apps/desktop/test/DRIFT-AUDIT.md — in-tree authoritative copy of the audit table for downstream FEA-618 / FEA-619 / FEA-621 to consume without depending on PR description archives
  • CLAUDE.md: adds a pointer to DRIFT-AUDIT.md under the Learned Patterns section

History note: the original PR-#134 commit also contained 9 unrelated files (4 src, 4 tests, a package.json version bump) introducing a "managed onboarding" feature — that was worktree contamination, not the audit work. Those files have been stripped via force-push; this PR is now annotation-and-documentation-only with no apps/desktop/src/** modifications.


Vocabulary Decision

Two-form standard adopted:

Annotation verb Used when Example
matches Class (i) — the test anchors a production line number and verifies the anchor is still valid (line-number drift check only); no logic copied // drift-check: matches codex.ts:1767
replicates Class (ii) — the test copies logic or a behavioral pattern from production (structural/logic replication) // drift-check: replicates symphony-interactive.ts:672-688

Rationale:

The PRD-220 schema defines two drift classes. Class (i) tests are observers — they cite a line so a reviewer can locate the production anchor; they do not reproduce any logic. The verb "matches" conveys that the annotation is a line-pointer that should stay in sync. Class (ii) tests are replicators — they contain test-side implementations that shadow production behavior and will silently diverge if production changes without a corresponding test update. The verb "replicates" makes the replication relationship explicit and flags higher maintenance risk.

Using two distinct verbs means a grep for replicates immediately surfaces the high-risk set without scanning all drift-check annotations. replicates is applied to every site that copies production logic regardless of current alignment — so FEA-621's drift-check script can monitor the entire pattern-replication surface rather than only the drifted subset. (This is why spawn-hardening.test.ts tests (b)/(c)/(d) all use replicates even though their patterns are still aligned with production at audit time.)


Drift Audit Table

The full 73-file audit table is now maintained in-tree at apps/desktop/test/DRIFT-AUDIT.md.

Summary:

Category Count
Class (i) — line-anchor (matches) 7 files
Class (ii) — pattern-replication (replicates) 1 file (also Class (i))
Class (i) and (ii) 1 file (spawn-hardening.test.ts)
No drift patterns 65 files
Total 73 files

Files with setShellPathForTest() restoration applied in PR #132 (loop-finalizer.test.ts, symphony-loop-auto-clone.test.ts) are now classified no drift patterns since the Class (iii) drift was already remediated and they no longer need a fix.


Changes

Test annotations

  • apps/desktop/test/boot-recovery.test.ts — drift-check header annotated; anchor corrected :303:308
  • apps/desktop/test/codex-log-parsing.test.ts — drift-check header annotated
  • apps/desktop/test/codex-spawn-enoent.test.ts — drift-check header annotated; stale prose at lines 17-23 swept
  • apps/desktop/test/error-handlers.test.ts — drift-check header annotated
  • apps/desktop/test/git-helpers-shell-safety.test.ts — drift-check header annotated
  • apps/desktop/test/spawn-enoent-characterization.test.ts — drift-check header annotated; // drift-check: annotations converted from matchesreplicates for vocabulary consistency
  • apps/desktop/test/spawn-hardening.test.ts — drift-check header updated to document tests (b)/(c)/(d) as intentional-and-current pattern-replication; // drift-check: annotations on tests (b)/(c)/(d) converted from matchesreplicates
  • apps/desktop/test/spawn-retry.test.ts — drift-check header annotated

Helpers

  • apps/desktop/test/helpers/spawn-test-utils.ts — JSDoc on makeEnoentError documenting always-present code: 'ENOENT' and syscall: 'spawn' fields; note for callers needing a syscall-free shape

Documentation

  • NEW apps/desktop/test/DRIFT-AUDIT.md — in-tree authoritative audit table
  • CLAUDE.md — pointer to DRIFT-AUDIT.md under Learned Patterns

Test Plan

  • just desktop-typecheck (verified locally — clean)
  • just desktop-lint
  • just desktop-test

Risks

Low — annotation-only changes to test files plus a new in-tree documentation file and a CLAUDE.md pointer. No production runtime code is modified. No test assertions are removed or modified; all changes are to header comments, inline // drift-check: annotations, JSDoc, and prose.


Loop ID: 019dd5d6-3153-718d-95b5-362d15fa8b3b
Artifact: https://app.closedloop.ai/implementation-plans/PLN-392

@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 peterulsteen marked this pull request as draft April 28, 2026 22:21
@peterulsteen peterulsteen self-assigned this Apr 28, 2026
- 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 ready for review April 29, 2026 22:15
@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 peterulsteen merged commit 4496450 into symphony/prd-220 Apr 29, 2026
2 checks passed
@peterulsteen peterulsteen deleted the symphony/pln-392 branch April 29, 2026 22:15
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