Commit 7c9b409
feat(v1.100 Amendment 3): code-B — dispatcher wires ExternalIndicator + Amendment-3 OrphanEvidence gathering (#527)
* feat(v1.100 Amendment 3): code-B — dispatcher wires ExternalIndicator + Amendment-3 OrphanEvidence gathering
Closes the dispatcher-side wiring gap surfaced by the post-merge audit
of Amendment-3-code-A (PR #523). Without this PR, the engine's
G1/AmbiguityConflictExternal split (added in PR #523) cannot be reached
because the dispatcher does not (a) plumb auth.External into
DecisionInput.ExternalIndicator, and (b) trigger gatherOrphanEvidence
on the Amendment 3 quintuple shape.
cmd/-side wiring only. Decision-layer engine.go untouched. Contract.md
untouched. Mutation surfaces unchanged. State machine, exit codes,
classifier, and CI all unchanged.
Changes:
cmd/nftban-installer/restore_decide.go (+50/-13)
- DecisionInput initializer now sets ExternalIndicator: auth.External
so the engine's §62 entry condition (external == "csf") can be
evaluated.
- OrphanEvidence-gathering condition extended to recognize EITHER
candidate quintuple:
* Amendment 2 (§54.3): AuthorityNFTBan + NoRecord + DA + flags
* Amendment 3 (§62): AuthorityAmbiguous + ConflictExternal +
external=="csf" + NoRecord + DA + flags
- Diagnostic log line now reports both predicates (amd2_all_true,
amd2_failed_row, amd3_all_true, amd3_failed_row) for observability;
the engine consumes whichever is appropriate per the entry path.
cmd/nftban-installer/restore_decide_evidence.go (+47/-3)
- E.2 reframed per Amendment 3 §64.1: bool is true under EITHER
Amendment 2's AuthorityNFTBan entry OR Amendment 3's
AuthorityAmbiguous + AmbiguityConflictExternal + external=="csf"
entry. Both candidate quintuples produce E.2=true; all other
classifier states produce E.2=false (defensive — empty external,
non-csf external, multi-external, OrphanNFTBan ambiguity, and
AuthorityExternal all fail E.2).
- E.13 evaluation tightened to match §54.1 / §64.1 wording exactly
("no AmbiguityOrphanNFTBan" — not the looser "no AuthorityAmbiguous"
that conflated the two Amendment 3 ambiguity sub-kinds). Amendment 2
behavior preserved (its entry implies Ambiguity==None which is
!= OrphanNFTBan).
cmd/nftban-installer/restore_decide_amendment3_test.go (NEW, +200)
- TestAmd3Dispatcher_E2Reframed_AllTrueAmendment3_True confirms the
Amendment 3 entry condition produces E.2=true and AllTrueAmendment3
passes (and Amendment 2's AllTrue() correctly fails because E.12
cannot be true under the §62 entry by construction).
- TestAmd3Dispatcher_E2_FalseWhenMisclassified pins 7 classifier
shapes: amd2-path-true, amd3-path-true, empty-external-false,
ufw-external-false, multi-external-false, OrphanNFTBan-false,
AuthorityExternal-false.
- TestAmd3Dispatcher_FailedRow_Amendment3 verifies
FailedRowIDAmendment3() returns "" on happy path and AMD3-E.7
when E.7 is mutated false.
NOT touched:
- internal/installer/restore/engine.go (lattice unchanged)
- internal/installer/restore/types.go (struct unchanged)
- internal/installer/restore/contract.md (no amendment)
- internal/installer/uninstall/* (classifier unchanged)
- internal/installer/state/* (state machine unchanged)
- cmd/nftban-installer/main.go (history gate unchanged)
- cmd/nftban-installer/flags.go (flag surface unchanged)
- .github/workflows/* (CI unchanged)
Test results (lab4):
- go test ./cmd/nftban-installer/... → ok
- go test ./internal/installer/restore/... → ok
- go test ./... → 64 packages ok, 0 FAIL
No host action. No binary rebuild. dns2 stays in canonical post-Gate-A
state.
Unblocks Gate B retry once a fresh Tier 1 binary is built from
post-merge HEAD, distributed to dns2, signoff captured, reachability
monitor activated, and pre-execution Gate B audit returns GO.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(v1.100 Amendment 3): code-B — split into separate gatherOrphanEvidenceAmendment3 helper per auditor recommendation
Per auditor pre-draft review: implement Sub-gap 2a as a separate
gatherOrphanEvidenceAmendment3() helper rather than a mode-conditional
inside the existing gatherOrphanEvidence(). Mirrors the AllTrue() vs
AllTrueAmendment3() split that PR #523 introduced in types.go and the
decideAuthorityNFTBan() vs decideAmbiguityConflictExternal() split in
engine.go. "Two helpers, shared rows, different entry-condition
filling" — symmetric with the engine pattern.
Refactor changes (no behavior delta vs the prior code-B commit on
this branch):
cmd/nftban-installer/restore_decide_evidence.go
- populateSharedOrphanEvidenceRows(): private helper populates all
rows EXCEPT E.2 (the entry-condition row).
- gatherOrphanEvidence(): Amendment 2 — calls shared helper +
sets E.2 = (Authority == AuthorityNFTBan). Restored to
Amendment-2-byte-clean E.2 evaluation.
- gatherOrphanEvidenceAmendment3(): Amendment 3 — calls shared
helper + sets E.2 = (AuthorityAmbiguous + ConflictExternal +
external == "csf"). New sibling helper.
- E.13 retained at the contract-wording-exact form (Ambiguity !=
AmbiguityOrphanNFTBan); shared by both helpers via the populate
function.
cmd/nftban-installer/restore_decide.go
- Dispatcher's evidence-gathering now switches on the candidate
type: amd2Candidate calls gatherOrphanEvidence (unchanged from
pre-Amendment-3 main); amd3Candidate calls
gatherOrphanEvidenceAmendment3.
- Diagnostic log line is now amendment-specific (no dual-predicate
noise) — clearer audit trail per amendment.
cmd/nftban-installer/restore_decide_amendment3_test.go
- Renamed and reorganized test cases to test the two helpers
independently:
* TestGatherOrphanEvidenceAmendment3_* tests the Amendment 3
helper specifically (rejects Amendment 2 entry, accepts §62
entry, AMD3-E.2 attribution on external=ufw, omits E.12).
* TestGatherOrphanEvidence_Amendment2Unchanged regression-tests
the Amendment 2 helper: still strict on AuthorityNFTBan,
rejects Amendment 3 entry.
Why two helpers (auditor reasoning):
- Audit-chain clarity: one helper per amendment, mirroring the
engine.go and types.go split structure.
- Each helper's CI grep gates and tests can reason about it
independently.
- No runtime classifier-state coupling between the dispatcher's
inspection and the evidence-gathering.
- Symmetric with AllTrue()/AllTrueAmendment3() in types.go.
Test results (lab4):
- go test ./cmd/nftban-installer/... → ok
- go test ./internal/installer/restore/... → ok
- go test ./... → 64 packages ok, 0 FAIL
No host action. No engine.go change. No contract.md change. No new
mutation surface.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b81fe3c commit 7c9b409
3 files changed
Lines changed: 430 additions & 18 deletions
File tree
- cmd/nftban-installer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
137 | 145 | | |
138 | 146 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
145 | 172 | | |
146 | 173 | | |
147 | 174 | | |
148 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
149 | 178 | | |
150 | 179 | | |
151 | | - | |
| 180 | + | |
152 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
153 | 187 | | |
154 | 188 | | |
155 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
0 commit comments