Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion cmd/nftban-installer/restore_decide.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,22 @@ func runRestoreExecutionFromProceed(
// values come from the PR-24 path the planner already used —
// the dispatcher does NOT re-probe or re-detect them, per
// INV-PR25-AUTHORITY-IMMUTABILITY (§17.3) + §33 E.7.
deps := newRestoreDeps(exec, log, priorRec, panel)
//
// PR-26-code-A: also resolve firewallType from the target so the
// inline-verify dep's safety predicate is target-specific (§51.3
// Option B + §51.4 firewallType plumbing). For Kind=RecordedPrior
// the value is on the TargetAuthority directly; for Kind=PanelNative
// the value comes from the static §20 panel mapping
// (restore.ResolvePanelFirewall). No precomputed targetUnit drift
// — we pass the raw firewallType identity.
resolvedFirewallType, ftErr := resolveFirewallTypeForDeps(target)
if ftErr != nil {
log.Error("restore execute: firewallType resolution failed: %v", ftErr)
_ = sf.Transition(state.StateRestoreFailedExecution, state.PhaseDetect, ftErr.Error())
log.Result("[NFTBan] restore execution: FAILED at firewallType resolution — %s", ftErr.Error())
return sf.State.ExitCode()
}
deps := newRestoreDeps(exec, log, priorRec, panel, resolvedFirewallType)

// Step C — Execute the §23 six-step sequence.
execRes := restore.Execute(ctx, target, deps)
Expand Down Expand Up @@ -302,3 +317,4 @@ func runRestoreExecutionFromProceed(

return sf.State.ExitCode()
}

20 changes: 12 additions & 8 deletions cmd/nftban-installer/restore_decide_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ func withFakeDeps(t *testing.T, fake *fakeDispatcherDeps) {
_ *logging.Logger,
_ *uninstall.PriorRecord,
_ detect.PanelType,
_ string, // PR-26-code-A: firewallType plumbing — fakes ignore it.
) restore.ExecuteDeps {
return restore.ExecuteDeps{
Preflight: fake,
Expand Down Expand Up @@ -575,10 +576,11 @@ func readSelfRestoreDecide() (string, error) {
// recordingFactoryCall captures one call to the deps factory so tests
// can assert exactly which evidence reached it.
type recordingFactoryCall struct {
exec executor.Executor
log *logging.Logger
priorRec *uninstall.PriorRecord
panel detect.PanelType
exec executor.Executor
log *logging.Logger
priorRec *uninstall.PriorRecord
panel detect.PanelType
firewallType string // PR-26-code-A: §51.4 plumbing
}

// withFakeDepsRecordingEvidence swaps newRestoreDeps with a factory
Expand All @@ -594,12 +596,14 @@ func withFakeDepsRecordingEvidence(t *testing.T, fake *fakeDispatcherDeps) *[]re
log *logging.Logger,
priorRec *uninstall.PriorRecord,
panel detect.PanelType,
firewallType string,
) restore.ExecuteDeps {
calls = append(calls, recordingFactoryCall{
exec: exec,
log: log,
priorRec: priorRec,
panel: panel,
exec: exec,
log: log,
priorRec: priorRec,
panel: panel,
firewallType: firewallType,
})
return restore.ExecuteDeps{
Preflight: fake,
Expand Down
Loading
Loading