J4: an unparseable family tag on a live row fails, never skips
Astra review of R0, round 2 (P1): inputLiveFamilies skipped a whole row when inputFamilyFor failed, so a declared later-only authority row tagged A,J4,unknown (which the census accepts for its one recognized owner) recorded no A requirement and A's witnesses could go. The parse error is now a J4 failure, and the row still keeps every family it does name. The later-only survivor fixture gains that mixed tag list. J4 on the real tree: 0 failures, so no existing row carries such a tag.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+27
−7
internal/provision/census_removal_test.go+12 −3internal/provision/plan14_input_inventory_test.go+15 −4
CI cancelled — superseded by a newer push — run details
diff --git a/internal/provision/census_removal_test.go b/internal/provision/census_removal_test.go| index b4197ef4a..70727fd03 100644 |
| --- a/internal/provision/census_removal_test.go |
| +++ b/internal/provision/census_removal_test.go |
| @@ -309,7 +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] }) |
| + live, liveErrs := inputLiveFamilies(full, func(k string) bool { return declared[k] }) |
| + failures = append(failures, liveErrs...) |
| failures = append(failures, checkInputLiveWitnesses(live, tests)...) |
| return append(failures, checkInputRetiredExemptions(exemptions, retired)...) |
| } |
| @@ -345,14 +346,22 @@ func TestPlan14J4RetiresAFamily(t *testing.T) { |
| 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) |
| } |
| + // A tag J4 does not know beside a family it does: the census accepts |
| + // the row for its one recognized owner, so J4 fails on the tag and |
| + // still keeps A's witnesses (Astra review of R0, round 2). |
| + mixed := row("internal/z/later.go", "Mixed", "A,J4,unknown") |
| + errs = check(carried(b, mixed), map[string]bool{key(b): true, key(mixed): true}, nil) |
| + if !containsPrefix(errs, key(mixed)+": unknown family") || !containsPrefix(errs, "family A missing") { |
| + t.Fatalf("a later-only row with an unknown tag: %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) |
| + if live, errs := inputLiveFamilies(carried(scoped), func(string) bool { return true }); len(live) != 0 || len(errs) != 0 { |
| + t.Fatalf("an out-of-scope row named families: %v %v", live, errs) |
| } |
| // 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") { |
diff --git a/internal/provision/plan14_input_inventory_test.go b/internal/provision/plan14_input_inventory_test.go| index 29d781ec3..d13f3635e 100644 |
| --- a/internal/provision/plan14_input_inventory_test.go |
| +++ b/internal/provision/plan14_input_inventory_test.go |
| @@ -462,22 +462,32 @@ func inputRetired(full rootReadInventory, declared bool, key string) bool { |
| // 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 { |
| +// inventory, up to activation-tools. A row whose task list J4 cannot |
| +// parse is a failure, never a skip, and still keeps every family it does |
| +// name (Astra review of R0, round 2): the census accepts an authority row |
| +// with one recognized owner beside an unknown tag. |
| +func inputLiveFamilies(full rootReadInventory, declared func(key string) bool) (map[string]bool, []string) { |
| live := map[string]bool{} |
| + var failures []string |
| for key, e := range full.Entries { |
| if e.Class != "authority" || !inputActivationEnabled(e) || !declared(key) { |
| continue |
| } |
| families, err := inputFamilyFor(e) |
| if err != nil { |
| + failures = append(failures, key+": "+err.Error()) |
| + for _, owner := range strings.Split(e.Task, ",") { |
| + if _, ok := inputFamilies[owner]; ok { |
| + live[owner] = true |
| + } |
| + } |
| continue |
| } |
| for _, f := range families { |
| live[f] = true |
| } |
| } |
| - return live |
| + return live, failures |
| } |
| // checkInputLiveWitnesses fails a live family with a witness slot that is |
| @@ -590,13 +600,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 { |
| + live, liveErrs := inputLiveFamilies(full, func(key string) bool { |
| d, err := declared(key) |
| if err != nil { |
| declaredErr = err |
| } |
| return d || err != nil |
| }) |
| + failures = append(failures, liveErrs...) |
| failures = append(failures, checkInputLiveWitnesses(live, tests)...) |
| var report []string |
| for _, e := range inputSurviving(inv, retired) { |