protected-path boundary exempts gitignored runtime trees under .sandcastle/ (#273) #274

Closed
matou-build-agent wants to merge 1 commit from agent/issue-273 into main

closes #273

What

Exempt the gitignored runtime-artifact trees .sandcastle/logs/* and
.sandcastle/.state/* from the protected-path fingerprinted set, so the
Sandcastle harness's own uniquely-named per-run worker log
(.sandcastle/logs/sandcastle-worker-<ts>-<id>-worker.log) no longer trips the
#445 boundary on every worker-bearing run.

Why

protected-paths-lib.sh fingerprinted PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo" wholesale. The harness writes that uniquely-named log into the
snapshotted workspace after verify_pp_snapshot takes the before-snapshot
(run-swarm.sh), so the after-snapshot always sees an appeared path,
attributes the harness's own log to the worker, and rolls it back (deletes it) —
which also emptied the heal bundle's worker-logs.txt tail. Deterministic on
every run a worker launches; surfaced the moment PP_ENFORCE reached the
running copy (#193 default-on, 2026-10-16 re-vendor; run 22723, both legs).

How

  • protected-paths-lib.sh — PP_EXEMPT_GLOBS_DEFAULT gains .sandcastle/logs/* .sandcastle/.state/*, the same exempt-globs mechanism already used for the
    healer's *matou-heal-* evidence dirs, so pp_is_protected stays the single
    source of truth and both pp_snapshot and pp_rollback honour it. Machinery
    (*.sh, *.mts, prompts, workflows) under .sandcastle/ stays protected —
    the exemption is scoped to the two runtime trees, not the whole dir.
  • tests/protected-paths-lib-test.sh — +6 red-first checks (29 → 35): the
    worker log and .sandcastle/.state/* are NOT protected by default, while
    .sandcastle/run-swarm.sh still IS; an end-to-end case plants both a worker
    log AND a .sandcastle/evil.sh in one run and asserts only the script is
    attributed and rolled back, the log surviving untouched.
  • GOTCHAS 75 (body + index row), journal 2026-10-16-273.md, STATUS.md header.

Blast radius

Root protected-paths-lib.sh is INERT in the running .sandcastle/ self-copy
and every consumer until a human re-vendors + bumps FACTORY_REF (GOTCHAS 4) —
and the running copy is itself a protected path a worker cannot edit, so every
worker-bearing run stays RED until the re-vendor. Break-glass for a human who
needs green runs sooner: PP_ENFORCE=0 (trades the #445 boundary away).

Tests

Full offline suite green except the pre-existing, unrelated
rehearsal-heal-lib-test.sh failure (trailer-fingerprint stamping — fails
identically on a clean tree, not in this slice).

Screenshots: none — the change is a bash lib's exempt-glob list and its
offline test; there is no visible/UI surface. Proven by
tests/protected-paths-lib-test.sh (35 checks).

closes #273 ## What Exempt the gitignored runtime-artifact trees `.sandcastle/logs/*` and `.sandcastle/.state/*` from the protected-path *fingerprinted* set, so the Sandcastle harness's own uniquely-named per-run worker log (`.sandcastle/logs/sandcastle-worker-<ts>-<id>-worker.log`) no longer trips the #445 boundary on every worker-bearing run. ## Why `protected-paths-lib.sh` fingerprinted `PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo"` wholesale. The harness writes that uniquely-named log into the snapshotted workspace *after* `verify_pp_snapshot` takes the before-snapshot (`run-swarm.sh`), so the after-snapshot always sees an `appeared` path, attributes the harness's own log to the worker, and rolls it back (deletes it) — which also emptied the heal bundle's `worker-logs.txt` tail. Deterministic on every run a worker launches; surfaced the moment `PP_ENFORCE` reached the running copy (#193 default-on, 2026-10-16 re-vendor; run 22723, both legs). ## How - `protected-paths-lib.sh` — `PP_EXEMPT_GLOBS_DEFAULT` gains `.sandcastle/logs/* .sandcastle/.state/*`, the same exempt-globs mechanism already used for the healer's `*matou-heal-*` evidence dirs, so `pp_is_protected` stays the single source of truth and both `pp_snapshot` and `pp_rollback` honour it. Machinery (`*.sh`, `*.mts`, prompts, workflows) under `.sandcastle/` stays protected — the exemption is scoped to the two runtime trees, not the whole dir. - `tests/protected-paths-lib-test.sh` — +6 red-first checks (29 → 35): the worker log and `.sandcastle/.state/*` are NOT protected by default, while `.sandcastle/run-swarm.sh` still IS; an end-to-end case plants both a worker log AND a `.sandcastle/evil.sh` in one run and asserts only the script is attributed and rolled back, the log surviving untouched. - GOTCHAS 75 (body + index row), journal `2026-10-16-273.md`, STATUS.md header. ## Blast radius Root `protected-paths-lib.sh` is INERT in the running `.sandcastle/` self-copy and every consumer until a human re-vendors + bumps `FACTORY_REF` (GOTCHAS 4) — and the running copy is itself a protected path a worker cannot edit, so every worker-bearing run stays RED until the re-vendor. Break-glass for a human who needs green runs sooner: `PP_ENFORCE=0` (trades the #445 boundary away). ## Tests Full offline suite green except the pre-existing, unrelated `rehearsal-heal-lib-test.sh` failure (trailer-fingerprint stamping — fails identically on a clean tree, not in this slice). **Screenshots:** none — the change is a bash lib's exempt-glob list and its offline test; there is no visible/UI surface. Proven by `tests/protected-paths-lib-test.sh` (35 checks).
sandcastle: #273 — protected-path boundary exempts gitignored runtime trees under .sandcastle/ (worker log no longer trips #445)
All checks were successful
ci / static (pull_request) Successful in 2m19s
ci / test (pull_request) Successful in 5m16s
341fbf5983
Every worker-bearing swarm run died RED at `protected-path violation (#445)`
naming the harness's OWN per-run worker log
(`.sandcastle/logs/sandcastle-worker-<ts>-<id>-worker.log`): the lib
fingerprinted `.sandcastle` + `.forgejo` WHOLESALE, including the gitignored
runtime-artifact trees `.sandcastle/logs/` and `.sandcastle/.state/`. The
harness writes that uniquely-named log into the snapshotted workspace AFTER the
before-snapshot, so the after-snapshot always sees an `appeared` path, attributes
it to the worker, and ROLLS IT BACK (delete) — which also emptied the healer's
`worker-logs.txt` tail. Deterministic on every run a worker launches.

Decisions / files:
- protected-paths-lib.sh — `PP_EXEMPT_GLOBS_DEFAULT` gains
  `.sandcastle/logs/* .sandcastle/.state/*` (the same exempt-globs mechanism
  already used for `*matou-heal-*`), so `pp_is_protected` stays the single
  source of truth and both pp_snapshot and pp_rollback honour it. Machinery
  (`*.sh`, `*.mts`, prompts, workflows) under `.sandcastle/` stays protected;
  the exemption is scoped to the two runtime trees, NOT the whole dir.
- tests/protected-paths-lib-test.sh — +6 checks (29 → 35): worker log and
  `.sandcastle/.state/*` are NOT protected by default, `run-swarm.sh` still IS,
  and an end-to-end case plants both a worker log AND a `.sandcastle/evil.sh` in
  one run asserting only the script is attributed/rolled back.
- GOTCHAS 75 (body + index row); journal 2026-10-16-273.md; STATUS.md header.

Blast radius: root `protected-paths-lib.sh` is INERT in the running
`.sandcastle/` self-copy and every consumer until a human re-vendors + bumps
`FACTORY_REF` (GOTCHAS 4) — and the running copy is itself a protected path a
worker cannot edit, so every worker-bearing run stays RED until re-vendor.
Break-glass for a human: `PP_ENFORCE=0` (trades the #445 boundary away).

Full offline suite green except the pre-existing, unrelated
rehearsal-heal-lib-test.sh failure (trailer-fingerprint stamping, not this
slice — fails identically on a clean tree).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Factory-Account: d631bd58e1e9
Author
Member
close-report gates passed for #273 — every claim verified; this PR is cleared for merge.
<!-- close-report: gates-passed --> close-report gates passed for #273 — every claim verified; this PR is cleared for merge.
Owner

Superseded, closed unmerged (Ben, 2026-10-17). #273's fix reached main via #280 (a4be7db, the complete protected-path fix landed on ROOT) plus the fbdd7d8 host-land; #273 is closed with the #280 audit note. This PR's 341fbf5 conflicts with that landed code and adds nothing on top — nothing left to merge.

Superseded, closed unmerged (Ben, 2026-10-17). #273's fix reached `main` via #280 (`a4be7db`, the complete protected-path fix landed on ROOT) plus the `fbdd7d8` host-land; #273 is closed with the #280 audit note. This PR's `341fbf5` conflicts with that landed code and adds nothing on top — nothing left to merge.
ben closed this pull request 2026-10-17 19:37:44 +00:00
All checks were successful
ci / static (pull_request) Successful in 2m19s
ci / test (pull_request) Successful in 5m16s

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/dev-factory!274
No description provided.