heal: a FACTORY_MANIFEST rail in heal_rails — no heal lands a drifted vendored file (#2177) #2179

Closed
matou-build-agent wants to merge 0 commits from agent/issue-2177 into main

closes #2177

What this lands

A FACTORY_MANIFEST rail in heal_rails (.sandcastle/rehearsal-heal-lib.sh,
re-vendored from Matou/dev-factory backport/idss-2177 @ 291c9bf) so a
healer repair can no longer land a drifted factory-vendored file on main.

The gap (#2177): heal.sh's throwaway HEAL_CLONE never wires
core.hooksPath .sandcastle/git-hooks, so ADR 0287's pre-push factory-drift
gate — which fails CLOSED on an unverified vendored edit — never fires on
heal_push's git push origin HEAD:main, and heal_rails had no
FACTORY_MANIFEST rail. So a heal could land a hand-edited vendored file
straight onto main (the heal twin of the worker-side #1963/#1964) — which
baa7f598 did, re-landed the ADR-0180 way by #2176, which named this rail gap.

The rail: any heal commit touching a FACTORY_MANIFEST path (as
.sandcastle/<p>) is reset + refused with HEAL_RAIL_REASON="vendored-path edit"
(not swarmable) UNLESS it is a genuine re-vendor — .sandcastle/FACTORY_REF
bumped in the same commit AND check-harness-drift.sh returns a CLEAN verdict
(exit 0). A non-clean bump (CONFIRMED drift, a TRANSPORT exit 3, or any other
non-zero) blocks too: a guard that could not reach the code it guards is not a
clean result (GOTCHAS #30, ADR 0287's posture). The common case — a vendored edit
with no bump — refuses offline via a cheap pre-check, so an ordinary heal pays
nothing and never runs the network drift check; the refusal message points the
healer at "land it in dev-factory and file a re-vendor ticket". A rail is
stronger than wiring the hook: it fires before the push, so the heal report names
why nothing landed (the hook path only reports a push failure).

Proof

  • .sandcastle/tests/rehearsal-heal-lib-test.sh 34 → 38 cases (red against the
    old lib, green now): V1 a vendored edit with no FACTORY_REF bump refuses
    offline; V2 a clean re-vendor (bump + exit-0 drift) passes; V3 a
    non-clean (exit 3) bump refuses; V4 an ordinary non-vendored heal is
    untouched and never runs the drift check.
  • Re-vendor is drift-clean: FACTORY_REF 4eae572b → 291c9bf,
    rehearsal-heal-lib.sh + its vendored test byte-identical to the backport,
    FACTORY_MANIFEST unchanged, check-harness-drift.sh exits 0.

Landing note

#2177 is an app-report descendant (origin: app-report #2047) carrying
landing-pr, so it lands by human-merged PR (ADR 0267). The standing runner's
context mis-resolved the mode to push and the change was first pushed to main
in error (6454feb4); that push was reverted (43ee3181) to restore compliance,
and this PR re-lands the identical change for a human merge. OWED (tracked on
#2177): forward-port the rail onto dev-factory main.

Screenshots: none — harness-only change (.sandcastle/ rails + a re-vendor); no UI or other visible surface. Proven by the offline unit suite above.

closes #2177 ## What this lands A `FACTORY_MANIFEST` rail in `heal_rails` (`.sandcastle/rehearsal-heal-lib.sh`, re-vendored from `Matou/dev-factory` `backport/idss-2177` @ `291c9bf`) so a healer repair can no longer land a **drifted factory-vendored file** on `main`. **The gap (#2177):** `heal.sh`'s throwaway `HEAL_CLONE` never wires `core.hooksPath .sandcastle/git-hooks`, so ADR 0287's pre-push factory-drift gate — which fails CLOSED on an unverified vendored edit — never fires on `heal_push`'s `git push origin HEAD:main`, and `heal_rails` had no `FACTORY_MANIFEST` rail. So a heal could land a hand-edited vendored file straight onto `main` (the heal twin of the worker-side #1963/#1964) — which `baa7f598` did, re-landed the ADR-0180 way by #2176, which named this rail gap. **The rail:** any heal commit touching a `FACTORY_MANIFEST` path (as `.sandcastle/<p>`) is reset + refused with `HEAL_RAIL_REASON="vendored-path edit"` (not swarmable) UNLESS it is a genuine re-vendor — `.sandcastle/FACTORY_REF` bumped in the same commit AND `check-harness-drift.sh` returns a CLEAN verdict (exit 0). A non-clean bump (CONFIRMED drift, a TRANSPORT exit 3, or any other non-zero) blocks too: a guard that could not reach the code it guards is not a clean result (GOTCHAS #30, ADR 0287's posture). The common case — a vendored edit with no bump — refuses offline via a cheap pre-check, so an ordinary heal pays nothing and never runs the network drift check; the refusal message points the healer at "land it in dev-factory and file a re-vendor ticket". A rail is stronger than wiring the hook: it fires before the push, so the heal report names why nothing landed (the hook path only reports a push failure). ## Proof - `.sandcastle/tests/rehearsal-heal-lib-test.sh` 34 → 38 cases (red against the old lib, green now): **V1** a vendored edit with no `FACTORY_REF` bump refuses offline; **V2** a clean re-vendor (bump + exit-0 drift) passes; **V3** a non-clean (exit 3) bump refuses; **V4** an ordinary non-vendored heal is untouched and never runs the drift check. - Re-vendor is drift-clean: `FACTORY_REF 4eae572b → 291c9bf`, `rehearsal-heal-lib.sh` + its vendored test byte-identical to the backport, `FACTORY_MANIFEST` unchanged, `check-harness-drift.sh` exits 0. ## Landing note #2177 is an app-report descendant (`origin: app-report #2047`) carrying `landing-pr`, so it lands by human-merged PR (ADR 0267). The standing runner's context mis-resolved the mode to `push` and the change was first pushed to `main` in error (`6454feb4`); that push was reverted (`43ee3181`) to restore compliance, and this PR re-lands the identical change for a human merge. OWED (tracked on #2177): forward-port the rail onto dev-factory `main`. **Screenshots:** none — harness-only change (`.sandcastle/` rails + a re-vendor); no UI or other visible surface. Proven by the offline unit suite above.
heal: refuse a drifted factory-vendored edit in heal_rails — the heal clone wires no hooksPath so ADR 0287's pre-push drift gate never runs (advances #2177)
Some checks failed
ci / seam (pull_request) Failing after 3s
ci / publish (pull_request) Has been skipped
ci / publish-broker (pull_request) Has been skipped
ci / deploy-broker (pull_request) Has been cancelled
b5705928ad
A healer repair clone (heal.sh's HEAL_CLONE) never wires
core.hooksPath .sandcastle/git-hooks, so ADR 0287's pre-push factory-drift gate
never fires on heal_push's push, and heal_rails had no FACTORY_MANIFEST rail —
so a heal could land a hand-edited vendored file straight onto main (the heal
twin of #1963/#1964; baa7f598 did exactly this, re-landed the ADR-0180 way by
#2176, which named this rail gap).

Re-vendored from Matou/dev-factory backport/idss-2177 (291c9bf, off #2176's pin
4eae572b): heal_rails now resets + refuses any heal commit touching a
FACTORY_MANIFEST path (HEAL_RAIL_REASON="vendored-path edit", not swarmable)
UNLESS it is a genuine re-vendor — FACTORY_REF bumped in the same commit AND
check-harness-drift.sh returns a CLEAN verdict (exit 0); a non-clean bump
(confirmed drift, a TRANSPORT exit 3, or any other non-zero) blocks too
(GOTCHAS #30, ADR 0287's posture). The no-bump case refuses offline, so an
ordinary heal never runs the network check.

FACTORY_REF 4eae572b -> 291c9bf (rehearsal-heal-lib.sh + its vendored test
byte-identical, FACTORY_MANIFEST unchanged, drift-gate OK).
tests/rehearsal-heal-lib-test.sh 34->38 (V1-V4). OWED: forward-port onto
dev-factory main. Ruled by agent under ADR 0174 — veto anytime.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Factory-Account: d631bd58e1e9
Owner

Merged to main by hand at Ben's request — merge commit f3b52a1a (FACTORY_REF 4eae572b → 291c9bf, a forward move: the backport is one commit on the current pin). On the merge: check-harness-drift.sh OK (exit 0), rehearsal-heal-lib-test.sh 38 cases OK. Closed by hand because Forgejo did not detect the pushed merge.

**Merged** to `main` by hand at Ben's request — merge commit f3b52a1a (FACTORY_REF 4eae572b → 291c9bf, a forward move: the backport is one commit on the current pin). On the merge: `check-harness-drift.sh` OK (exit 0), `rehearsal-heal-lib-test.sh` 38 cases OK. Closed by hand because Forgejo did not detect the pushed merge.
ben closed this pull request 2026-11-16 17:38:29 +00:00
Some checks failed
ci / seam (pull_request) Failing after 3s
ci / publish (pull_request) Has been skipped
ci / publish-broker (pull_request) Has been skipped
ci / deploy-broker (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss!2179
No description provided.