Skip to content

Fix engine-parity diffFilePriority typo; make drift-check recursive/function-aware #4605

Description

@JSONbored

Context

Part of the review-stack architecture audit (parent epic). scripts/check-engine-parity.ts is the
repo's existing mechanism for keeping src/** and its published-package mirror
packages/gittensory-engine/src/** in sync — but discoverEngineParityPairs
(check-engine-parity.ts:104-131) does a non-recursive readdirSync on
src/{review,settings,signals} and pairs files with identical filenames at the top level only.
Anything nested one directory deeper, or logically duplicated but living inside a bigger file under a
different name, is invisible to it — even though npm run engine-parity:drift-check currently reports
"18 pairs agree" and looks comprehensive.

Finding 1 — already-drifted, live bug

At least 3 independent copies of diffFilePriority exist: src/review/review-diff.ts:22-28 and
src/review/review-grounding.ts:118-124 (byte-identical to each other), and
packages/gittensory-engine/src/review/diff-file-priority.ts:3 (imported by
packages/gittensory-engine/src/signals/predicted-gate-engine.ts:24, used in sharesMeaningfulFile at
line 928-933 — itself a near-duplicate of src/signals/engine.ts:5431-5436's sharesMeaningfulFile).
The two host copies correctly match cartfile\.resolved (Carthage's real lockfile filename); the
engine-package copy matches cartfile\.lock (not a real filename)
— a one-character-class typo that
means the engine-package's predicted-gate collision-check will never correctly deprioritize a touched
Cartfile.resolved, while the host's equivalent check does. Silent behavioral inconsistency between the
host predicted-gate and the published engine package's predicted-gate for Carthage/iOS repos. Not caught
because neither host copy is a file named diff-file-priority.ts.

Finding 2 — not-yet-drifted, but structurally invisible

safe-url.tssrc/review/content-lane/safe-url.ts (117 lines) vs
packages/gittensory-engine/src/review/safe-url.ts (117 lines) are currently byte-identical (verified
diff, exit 0), but this is luck, not enforcement: the host copy lives in content-lane/ so
listDir("src/review") never sees it. One more independent edit to either side drifts it with zero CI
signal — exactly what already happened to diffFilePriority and the secrets-scan trio.

Fix

  1. Fix the one-line cartfile\.lockcartfile\.resolved regression in
    packages/gittensory-engine/src/review/diff-file-priority.ts:3 immediately.
  2. Add explicit named pairs (reusing the existing GATE_DECISION_TWIN_PAIR escape hatch already built
    for exactly this situation) for safe-url.ts and for the diffFilePriority/sharesMeaningfulFile
    functions, since the function, not the file, is what needs parity here.
  3. Make discoverEngineParityPairs's listDir recursive (with the existing shim/stub filters) so future
    nested duplicates aren't invisible by construction.

Acceptance criteria

  • Carthage lockfile collision-check behaves identically in src/signals/engine.ts and
    packages/gittensory-engine/src/signals/predicted-gate-engine.ts.
  • safe-url.ts and diffFilePriority/sharesMeaningfulFile are covered by the parity drift-check.
  • engine-parity:drift-check discovers nested-directory duplicates, not just top-level filename
    matches.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

Status
Done

Relationships

None yet

Development

No branches or pull requests

Issue actions