carlos / platform Public

J4: a family's witnesses stay while any declared row of the full chain names it

Astra review of R0 (P1): J4 checks only its 27-overlay inventory, so
once a family's last row there was retired its witnesses could go while
a row only a later overlay added still named the family (roster-binding's
servingPriorBinding, C,J4, is one). Witnesses now stay required while
any in-scope authority row of the full chain names the family and its
unit is still declared. J4's caller check is unchanged and still covers
its own inventory only; a retired row is not caller-checked. AGENTS.md
says exactly that, and the absence rule now names Lstat and symlinks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 8253f8a87257893b47eb2e328fb6e314fa73d45c parent 11c14e3
4 files changed, +98 −15
  • AGENTS.md +25 −12
  • docs/superpowers/plans/2026-10-25-claims-cleanup-r0.md +6 −0
  • internal/provision/census_removal_test.go +18 −0
  • internal/provision/plan14_input_inventory_test.go +49 −3

CI passed — run details

diff --git a/AGENTS.md b/AGENTS.md
index ce0494a73..a05cc3c01 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -238,10 +238,13 @@ approved like this:
- `sites`: more or fewer reads of kinds the unit already makes;
- `envelope`: a package was re-pinned;
- `removed`: the scan finds neither the unit's declaration nor any of
- its sites, or an envelope's directory is gone from the tree;
+ its sites, or an envelope's directory is gone. A path counts as gone
+ only if it is absent by Lstat: no file, directory or symlink there,
+ and no symlink above it;
- `reads` (a kind of read the unit did not make before), `new`,
- `quiet` (a unit still declared that reads nothing now, or a directory
- still there with no source the census scans) or `other` (any census
+ `quiet` (a unit still declared that reads nothing now, a directory
+ still there with no source the census scans, or a path replaced by a
+ symlink) or `other` (any census
discrepancy none of these explains, shown with the census's own
message): a decision.
2. Write a CLAIMS file with one line per changed unit:
@@ -257,8 +260,8 @@ approved like this:
while the declaration stays out of the tree, even one that reads
nothing;
- for each deleted directory, `@coverage <dir> -`, which retires its
- envelope. The census fails while that directory exists, even if it
- holds only tests;
+ envelope. The census fails while anything is at that path, even a
+ directory of tests or a symlink;
- the `@legacy` fingerprints, the envelope re-pins and the new seal (a
deletion alone leaves the seal as it was);
- its line in `testdata/plan14-root-reads-chain.tsv`;
@@ -302,13 +305,23 @@ A deletion is an approval, not a decision (Paul, 2026-10-25, ruling 1 on
#280): a deletion cannot add a read, and the scan, not the claim, proves
the unit absent. Code that moved is not a deletion. A unit moved whole
shows as `new`, and a read that moved shows as a change to the unit that
-took it. J4 (`TestPlan14RootInputInventoryCoverage`) follows the same
-rule. A row the chain has removed, for a unit the tree no longer
-declares, is retired. A family whose rows are all retired may lose its
-witness tests in the same change. While one row of the family survives,
-its witnesses stay. A surviving row with no production caller still
-fails, so a deleting branch removes the row or keeps the caller. An
-exemption for a retired unit fails until it is deleted with the unit.
+took it.
+
+J4 (`TestPlan14RootInputInventoryCoverage`) checks its own inventory,
+the 27 overlays up to `activation-tools`, and its caller check covers
+those rows only. A row a later overlay added is never caller-checked. A
+row of J4's inventory is retired when the full chain no longer carries
+it and the tree no longer declares its unit. J4 skips a retired row. A
+row the chain removed whose unit is still declared is still checked. A
+family's witness tests stay required while any authority row in the full
+chain names the family and its unit is still declared. That includes a
+row only a later overlay added. Rows outside J4's scope do not count:
+those tagged only E4 or J1 to J4, and the relocation and activator
+worker files. Once no such
+row names the family, its witnesses may go in the same change. A
+surviving row of J4's inventory with no production caller still fails,
+so a deleting branch removes the row or keeps the caller. An exemption
+for a retired unit fails until it is deleted with the unit.
The tool refuses decisions (`reads`, `new`, `quiet`, `other`): a new
kind of read can make a unit's disposition wrong, so it is the owner's
diff --git a/docs/superpowers/plans/2026-10-25-claims-cleanup-r0.md b/docs/superpowers/plans/2026-10-25-claims-cleanup-r0.md
index f528c4a0c..489398cff 100644
--- a/docs/superpowers/plans/2026-10-25-claims-cleanup-r0.md
+++ b/docs/superpowers/plans/2026-10-25-claims-cleanup-r0.md
@@ -72,3 +72,9 @@
Result (2026-10-25): deleting `internal/sim/hostlife` gave a card with one removed unit (`mutate.sh`, frozen legacy) and one retired envelope, and an overlay of `@remove`, `@removed` (absent) and `@coverage internal/sim/hostlife -` with the seal unchanged. `TestPlan14RootReadCensus` and J4 both passed on the deleted tree. Restored; `git status` clean. J4's new retired-exemption check caught the roster-binding exemption for the deleted `servingPriorRevision`, which the retirement rule now covers, so that exemption was removed.
- [x] `go vet ./internal/provision/`, the census and census-propose tests, `GOOS=darwin` and `GOOS=windows go build ./...`; push; `amadan ci status carlos/platform -branch claims-cleanup-r0`.
+
+## Review fixes (Astra, NOT READY at 4c85788e)
+
+- P1, J4: a family's witnesses stay required while any in-scope authority row of the full chain names it and its unit is still declared (`inputLiveFamilies`, `checkInputLiveWitnesses`), so a later-only row such as roster-binding's `servingPriorBinding` keeps them. J4's caller check still covers only its 27-overlay inventory. A retired row is not caller-checked.
+- P1, symlinks: a removed unit's file and a retired directory must be absent by Lstat with no symlinked ancestor (`rootReadPathAbsent`), when classifying and when re-checking a retired envelope.
+- P2: `census_removal_fs_test.go` runs `rootReadProduction` over a temp module for deletion, tests left behind, recreation, symlinks and a tagged declaration.
diff --git a/internal/provision/census_removal_test.go b/internal/provision/census_removal_test.go
index 982899fc0..b4197ef4a 100644
--- a/internal/provision/census_removal_test.go
+++ b/internal/provision/census_removal_test.go
@@ -309,6 +309,8 @@ func TestPlan14J4RetiresAFamily(t *testing.T) {
for _, e := range inputSurviving(inv, retired) {
failures = append(failures, checkInputRow(e, callers, tests)...)
}
+ live := inputLiveFamilies(full, func(k string) bool { return declared[k] })
+ failures = append(failures, checkInputLiveWitnesses(live, tests)...)
return append(failures, checkInputRetiredExemptions(exemptions, retired)...)
}
carried := func(rows ...classifiedRootRead) rootReadInventory {
@@ -336,6 +338,22 @@ func TestPlan14J4RetiresAFamily(t *testing.T) {
if errs := check(carried(b), map[string]bool{key(a1): true, key(b): true}, nil); !containsPrefix(errs, key(a1)+": no production caller") {
t.Fatalf("a still-declared row escaped J4: %v", errs)
}
+ // A row only a later overlay added (outside J4's inventory) still names
+ // family A and is still declared: A's witnesses stay required (Astra
+ // review of R0, P1; servingPriorBinding in roster-binding is one).
+ later := row("internal/z/later.go", "Bind", "A,J4")
+ if errs := check(carried(b, later), map[string]bool{key(b): true, key(later): true}, nil); !containsPrefix(errs, "family A missing") {
+ t.Fatalf("a later-only surviving row lost its witnesses: %v", errs)
+ }
+ // Deleted too, it no longer holds them.
+ if errs := check(carried(b, later), map[string]bool{key(b): true}, nil); len(errs) != 0 {
+ t.Fatalf("a deleted later-only row: %v", errs)
+ }
+ // Only J4's scope counts: a later row of E4 and J tags alone names no family.
+ scoped := row("internal/z/later.go", "Grant", "E4,J4")
+ if live := inputLiveFamilies(carried(scoped), func(string) bool { return true }); len(live) != 0 {
+ t.Fatalf("an out-of-scope row named families: %v", live)
+ }
// An exemption for a retired unit is stale: delete it with the unit.
if errs := check(carried(b), map[string]bool{key(b): true}, map[string]inputExemption{key(a1): {Ruling: "x"}}); len(errs) != 1 || !strings.Contains(errs[0], "retired") {
t.Fatalf("a retired unit's exemption: %v", errs)
diff --git a/internal/provision/plan14_input_inventory_test.go b/internal/provision/plan14_input_inventory_test.go
index de7d371e2..29d781ec3 100644
--- a/internal/provision/plan14_input_inventory_test.go
+++ b/internal/provision/plan14_input_inventory_test.go
@@ -449,14 +449,52 @@ func checkInputRow(e classifiedRootRead, callers map[string]string, tests map[st
// inputRetired reports whether a row in J4's view has been retired since
// (claims cleanup R0): the full census chain no longer carries it and the
// tree no longer declares the unit. A row the chain removed whose unit is
-// still declared is not retired, so J4 keeps checking it. A family whose
-// every row is retired names no surviving row, so its witnesses may go in
-// the same change; while one row survives, checkInputRow keeps them.
+// still declared is not retired, so J4 keeps checking it. A retired row is
+// not caller-checked (its unit is gone); its family's witnesses stay
+// required while inputLiveFamilies still names the family.
func inputRetired(full rootReadInventory, declared bool, key string) bool {
_, carried := full.Entries[key]
return !carried && !declared
}
+// inputLiveFamilies is every family named by an authority row of the full
+// chain, after every overlay, that J4's scope covers (inputActivationEnabled)
+// and whose unit the tree still declares. A family's witnesses may go only
+// once it is not here (Astra review of R0, P1): a row only a later overlay
+// added keeps them required, though J4's caller check covers only its own
+// inventory, up to activation-tools.
+func inputLiveFamilies(full rootReadInventory, declared func(key string) bool) map[string]bool {
+ live := map[string]bool{}
+ for key, e := range full.Entries {
+ if e.Class != "authority" || !inputActivationEnabled(e) || !declared(key) {
+ continue
+ }
+ families, err := inputFamilyFor(e)
+ if err != nil {
+ continue
+ }
+ for _, f := range families {
+ live[f] = true
+ }
+ }
+ return live
+}
+
+// checkInputLiveWitnesses fails a live family with a witness slot that is
+// empty or names no test in the tree, as checkInputRow does for a row.
+func checkInputLiveWitnesses(live, tests map[string]bool) []string {
+ var failures []string
+ for name := range live {
+ f := inputFamilies[name]
+ for slot, test := range []string{f.Hostile, f.Rename, f.Erasure, f.Retry, f.Positive} {
+ if test == "" || !tests[test] {
+ failures = append(failures, "family "+name+" missing "+[]string{"hostile", "rename", "erasure", "retry", "positive"}[slot]+" fixture "+test)
+ }
+ }
+ }
+ return failures
+}
+
// inputSurviving is the rows J4 checks: neither removed within its own
// overlays nor retired since.
func inputSurviving(inv rootReadInventory, retired func(key string) bool) map[string]classifiedRootRead {
@@ -552,6 +590,14 @@ func TestPlan14RootInputInventoryCoverage(t *testing.T) {
}
failures := checkInputExemptions(inv, callers, inputExemptions, inputTrackEComplete)
failures = append(failures, checkInputRetiredExemptions(inputExemptions, retired)...)
+ live := inputLiveFamilies(full, func(key string) bool {
+ d, err := declared(key)
+ if err != nil {
+ declaredErr = err
+ }
+ return d || err != nil
+ })
+ failures = append(failures, checkInputLiveWitnesses(live, tests)...)
var report []string
for _, e := range inputSurviving(inv, retired) {
failures = append(failures, checkInputRow(e, callers, tests)...)