Skip to content

maintenance: drift-check the manifest against disk in both directions - #414

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/workspace-location-contracts
Sep 18, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/workspace-location-contracts

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Part of PyAutoLabs/PyAutoBrain#391 (phase 1a). Changes no directory layout. Companion to PyAutoLabs/PyAutoBrain#392, PyAutoLabs/PyAutoHeart#232, PyAutoLabs/PyAutoHands#283; mergeable in any order.

The check was blind both ways

declared, not on disk Skipped at three checks (repos_sync.py:882 CLAUDE pointers, :1318 origins, :1607 codex hooks). After any regroup these would pass while checking nothing — a successful check that means reduced coverage.
on disk, not declared Structurally invisible: the walk starts from the manifest and asks whether each entry is present, so an unlisted checkout is silence, not a failure.

A new workspace checkouts (manifest ↔ disk) leg closes both.

Red-before / green-after, on real repos:

  • Declared-but-missing (PyAutoReduce pulled aside): before exit=0, PyAutoReduce mentioned 0 times. After exit=1, ✗ 'PyAutoReduce': declared in repos.yaml but not checked out at the workspace root.
  • Undeclared-on-disk (an undeclared_clone/.git): before exit=0, 0 mentions. After exit=1, naming it and pointing at both remedies.

No opt-out key was needed

The first direction ships with no exception mechanism at all. admin_jammy was the only declared-but-absent entry, and it is not part of the PyAutoLabs ecosystem — PyAutoBrain/bin/README.md:12 already recorded it as "slated to leave PyAutoLabs/". With it removed the manifest is 38 declared ↔ 38 on disk, so absence is simply an error. Its now-empty admin: category goes with it (verified nothing reads categories["admin"]).

The reverse direction needs exactly one entry: unmapped_checkouts: listing .github — a real checkout with a real remote that is deliberately not a body-map repo. Proven load-bearing by unlisting it and watching the real workspace go red. Only directories holding .git count, so tmp/, scrap.md and the dotfiles need no declaration.

This retires draft/maintenance/pyautomind/autolens_jax_joss_manifest_gap.md, whose defect was the second direction and which outlived its example.

CI safety

The leg enforces only under a root carrying a .pyauto-root marker; otherwise it prints its denominator and fails nothing. Nothing asserts a marker exists. Verified against firewall_gate.yml, the only CI caller, which runs --check --root "$GITHUB_WORKSPACE" over four side-by-side repos: OK · 4 of 38 declared repo(s) checked out; no .pyauto-root at this root — presence not enforced, run exit 0.

The denominator goes on its own line because Heart's manifest_drift.py:45 anchors the status to end-of-line — a suffix would make the leg invisible to Heart. That parser is too brittle and already silently drops one existing leg (generated hooks, whose (37 of 37 checked out, …) suffix breaks the regex); filed separately as a bug, not touched here.

Resolver adoption, with a guard

repos_sync.py and spawn.py take the root from the shared resolver, --root still winning. Both refuse a resolved root that does not contain their own checkout: the resolver is Brain-anchored, and in a task bundle whose PyAutoBrain is a symlink it resolves to canonical — which would have had --write regenerate another tree and the bootstrap fan hooks out over it.

--write now also writes the marker beside the routing table, so it is generated rather than placed by hand. The bootstrap is additive and confirmed live, not argued: fresh root → --check passes with "presence not enforced" → --write writes the marker → next --check enforces. Pinned as test_the_bootstrap_is_additive.

Correction to the original scope: spawn.py:507 is not a workspace-root site — that parents[2] lives inside a template string for a generated satellite repo's smoke runner. Left alone; the real site is the main() default.

Verification

--check on the real workspace → all 18 legs OK, exit 0, including workspace checkouts (manifest ↔ disk): OK · 38 of 38 declared repo(s) checked out. Suite 501 passed (was 482; +19 across two new files, fictional fixtures, each direction driven to failure).

🤖 Generated with Claude Code

https://claude.ai/code/session_0161NLKVzbBMzhaBfjpGogor

repos_sync.py could not see either kind of drift:

  declared but not on disk  — skipped at three checks (CLAUDE pointers, origins,
                              codex hooks). After any regroup they would pass
                              while checking nothing. A successful check that
                              means reduced coverage is the failure to remove.
  on disk but not declared  — structurally invisible: the walk starts from the
                              manifest and asks whether each entry is present,
                              so an unlisted checkout is silence, not a failure.

A new `workspace checkouts (manifest <-> disk)` leg closes both. It needs NO
opt-out key for the first direction: with admin_jammy gone the manifest is 38
declared to 38 on disk, so absence is simply an error. The second direction
needs one entry — `unmapped_checkouts:` listing `.github`, a real checkout with
a real remote that is deliberately not a body-map repo. Only directories holding
.git are considered, so tmp/, scrap.md and the dotfiles need no declaration.

admin_jammy removed: it is not part of the PyAutoLabs ecosystem, and
PyAutoBrain/bin/README.md already recorded that it was slated to leave. Its
now-empty `admin:` category goes with it. This retires
draft/maintenance/pyautomind/autolens_jax_joss_manifest_gap.md, whose defect was
the second direction above and which outlived its example.

The leg enforces only under a root carrying a .pyauto-root marker, and otherwise
prints its denominator and fails nothing — CI lays repos out side by side with
no marker, so nothing asserts one exists. The denominator goes on its own line
because Heart's manifest_drift parser anchors the status to end-of-line; a
suffix would make the leg invisible to Heart. (That parser is too brittle and
already drops one existing leg — filed separately as a bug.)

repos_sync.py and spawn.py now take the root from the shared resolver, with
--root still winning. Both refuse a resolved root that does not contain their own
checkout: the resolver is Brain-anchored, and in a bundle whose PyAutoBrain is a
symlink it resolves to CANONICAL, which would have had --write regenerate
another tree. --write now also writes the marker beside the routing table, so it
is generated rather than placed by hand; the bootstrap is additive and pinned by
a test.

Suite 501 passed (was 482; +19). --check green on the real workspace, all 18
legs, and both new directions proven red-before/green-after on real repos.

Part of PyAutoBrain#391 (phase 1a). No directory layout changes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161NLKVzbBMzhaBfjpGogor
@Jammy2211
Jammy2211 merged commit 1be0434 into main Sep 18, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/workspace-location-contracts branch September 18, 2026 19:50
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