# Source summary — Wrong root, false PASS

Provenance trail for every artifact in this package. Internal repository paths establish provenance for
review; they are not themselves public links.

| Published artifact | Derived from (internal source) | Sanitization |
| --- | --- | --- |
| `artifacts/root-resolution-before-after.md` | `system/caliber/lib/c77-app-submodule-mutation-discipline.mjs` (root-resolution block ~L153-156) + `system/caliber/docs/plans/2026-05-08-c77-finding-coverage-fix.md` (Current behavior ~L57; Phase 1a ~L108-132) | none required (scanner logic + plan doc) |
| `artifacts/evidence-fields.md` | `system/caliber/lib/c77-app-submodule-mutation-discipline.mjs` (report payload ~L630-632) + `system/caliber/docs/plans/2026-05-08-c77-finding-coverage-fix.md` (Phase 1b ~L134-149) | none required (scanner logic + plan doc) |
| `artifacts/c77-fix-plan-excerpt.md` | `system/caliber/docs/plans/2026-05-08-c77-finding-coverage-fix.md` (title ~L3; Objective ~L27-33; Current behavior ~L57 + ~L77; Phase 1 ~L108-149) | four internal app slugs + drift states generalized to "four FoundryOS apps" / "four distinct drift states" |

## Chain of causation (from the defect to the control)

1. **2026-05-08** — C77 (the audit layer of the app-submodule-mutation-discipline chain) was observed
   returning `PASS, findings: []` from the main repo, while the sibling close-session preflight gate,
   run from the same working directory, surfaced four distinct git-drift states across four FoundryOS
   apps.
2. Root cause: the scanner resolved its audit target by walking up from its own **script location**
   (`fileURLToPath(import.meta.url)`). Running from a linked worktree, that walk stopped at the
   worktree root (each worktree carries its own `system/SYSTEM_REGISTRY.md`), so the scanner inspected
   an empty worktree — never the repo the operator invoked it against.
3. Fix (plan `2026-05-08-c77-finding-coverage-fix`): resolve the target from `process.cwd()` first,
   falling back to the script location only when cwd is outside any FoundryOS repo —
   `const foundryRoot = cwdRoot || scriptRoot;`.
4. Made self-evidencing: the report payload now emits `targetRoot`, `scriptRoot`, and
   `rootResolution` so a verdict carries the identity of the repo it was computed against and "future
   misdirection bugs cannot hide."
5. The fix is codified in the shipped scanner source (cited lines) and the plan is recorded
   `status: complete` / `execution_status: complete`.

## Internal-only companions (not published here)

- The full C77 scanner source and its dimension logic (`runDim1`, `isSubmoduleInitialized`,
  `parseGitmodules`) — `system/caliber/lib/c77-app-submodule-mutation-discipline.mjs`.
- The four-app / four-drift-state pre-fix observation with app slugs and states — recorded in the plan
  doc's Current behavior + State coverage sections; generalized here.

**Reviewer:** FoundryOS operator · **Review date:** 2026-08-02
