|
| 1 | +package deliverycontrol |
| 2 | + |
| 3 | +// registry is the single declaration of Boatstack's delivery transitions, |
| 4 | +// mirroring ../../notes/delivery-control-inventory.md. Each HandlerRef names a |
| 5 | +// real exported function in package boatstack; the parity conformance test keeps |
| 6 | +// this faithful. This is a shadow catalog — nothing consumes it at runtime yet. |
| 7 | +var registry = []TransitionDescriptor{ |
| 8 | + { |
| 9 | + ID: "delivery.activate", From: []StateID{StateUninitialized}, To: StateBuild, |
| 10 | + Kind: KindCommittedMutation, CostClass: CostMutation, Reversible: true, |
| 11 | + HandlerRef: "ActivatePlan", CLIVerb: "activate-plan", |
| 12 | + Note: "Requires CheckPlan + repository-safety PASS and a human/policy approval receipt; writes the plan lock via the mutation boundary. Reversible via delivery.undo while no gate receipt exists.", |
| 13 | + }, |
| 14 | + { |
| 15 | + ID: "delivery.record_gate_test", From: []StateID{StateBuild}, To: StateTestPassed, |
| 16 | + Kind: KindCommittedMutation, CostClass: CostMutation, Reversible: true, |
| 17 | + HandlerRef: "RecordDeliveryGate", CLIVerb: "record-delivery-gate", |
| 18 | + Note: "Records the test gate (PASS/PASS_WITH_GAPS) against a validated plan lock and a matching evidence ledger. Reversible via record-change re-gate.", |
| 19 | + }, |
| 20 | + { |
| 21 | + ID: "delivery.record_gate_review", From: []StateID{StateTestPassed}, To: StateReviewPassed, |
| 22 | + Kind: KindCommittedMutation, CostClass: CostMutation, Reversible: true, |
| 23 | + HandlerRef: "RecordDeliveryGate", CLIVerb: "record-delivery-gate", |
| 24 | + Note: "Records the review gate; requires prior TEST_PASSED with a matching diff and reviewer identity/method on high-risk paths. Clears rework mode.", |
| 25 | + }, |
| 26 | + { |
| 27 | + ID: "delivery.record_change", From: []StateID{StateTestPassed, StateReviewPassed, StatePublished}, To: StateBuild, |
| 28 | + Kind: KindCommittedMutation, CostClass: CostMutation, Reversible: true, |
| 29 | + HandlerRef: "RecordChangeObservation", CLIVerb: "record-change", |
| 30 | + Note: "Rework resets the addressable slice to BUILD (bounded by RepairAttempt<3); amendment/plan-invalid set Mode; a fully-published delivery emits a corrective child with no state mutation.", |
| 31 | + }, |
| 32 | + { |
| 33 | + ID: "delivery.publish", From: []StateID{StateReviewPassed, StatePublished}, To: StatePublished, |
| 34 | + Kind: KindCommittedMutation, CostClass: CostMutation, Reversible: false, |
| 35 | + HandlerRef: "PublishPR", CLIVerb: "publish-pr", |
| 36 | + Note: "Publishes the reviewed slice behind a human-confirmed preview fingerprint and advances ActiveIndex to the next slice. Re-publishing a PUBLISHED-open slice is idempotent and does not advance the pointer.", |
| 37 | + }, |
| 38 | + { |
| 39 | + ID: "delivery.undo", From: []StateID{StateBuild}, To: StateUninitialized, |
| 40 | + Kind: KindReversibleMutation, CostClass: CostMutation, Reversible: true, |
| 41 | + HandlerRef: "UndoManagedMutation", CLIVerb: "undo", |
| 42 | + Note: "Reverses a plan-activation/compiled-plan mutation through the boundary (closed under inversion, so redo is undo of the returned receipt). Refused once any gate receipt exists (would strand delivery state).", |
| 43 | + }, |
| 44 | + { |
| 45 | + ID: "delivery.discard_delivery", From: []StateID{StatePending, StateBuild, StateTestPassed, StateReviewPassed, StatePublished}, To: StateDiscarded, |
| 46 | + Kind: KindReversibleMutation, CostClass: CostMutation, Reversible: true, |
| 47 | + HandlerRef: "DiscardDelivery", CLIVerb: "discard-delivery", |
| 48 | + Note: "Archives (never deletes) the delivery state directory. Refuses a slice with a set PRState unless --force; preserves published authority and git/lock/merged history.", |
| 49 | + }, |
| 50 | + { |
| 51 | + ID: "delivery.repair_state", From: []StateID{StateInvalid}, To: StateUninitialized, |
| 52 | + Kind: KindRecovery, CostClass: CostRecovery, Reversible: true, |
| 53 | + HandlerRef: "RepairState", CLIVerb: "repair-state", |
| 54 | + Note: "Quarantines a malformed unregistered feature draft by moving it aside; refuses when a plan lock, pr.md, managed state, tracked files, or an active/published delivery is present. Typed and bounded — never a generic bypass.", |
| 55 | + }, |
| 56 | + { |
| 57 | + ID: "delivery.ignore_delivery", From: []StateID{StatePending, StateBuild, StateTestPassed, StateReviewPassed, StatePublished}, To: "", |
| 58 | + Kind: KindCommittedMutation, CostClass: CostMutation, Reversible: true, |
| 59 | + HandlerRef: "IgnoreDelivery", CLIVerb: "ignore-delivery", |
| 60 | + Note: "Appends the feature to project.json workflow.ignored_deliveries, filtering it from ResolveNext and publication authority. Changes no slice status; reversible by removing the entry.", |
| 61 | + }, |
| 62 | + { |
| 63 | + ID: "delivery.status", From: []StateID{StateBuild, StateTestPassed, StateReviewPassed, StatePublished}, To: "", |
| 64 | + Kind: KindObserve, CostClass: CostObserve, Reversible: false, |
| 65 | + HandlerRef: "CurrentDeliveryState", CLIVerb: "delivery-status", |
| 66 | + Note: "Reads delivery state and validates the plan lock. No state change.", |
| 67 | + }, |
| 68 | + { |
| 69 | + ID: "delivery.check_ship", From: []StateID{StateReviewPassed, StatePublished}, To: "", |
| 70 | + Kind: KindQuery, CostClass: CostQuery, Reversible: false, |
| 71 | + HandlerRef: "CheckDeliveryReadyForShip", CLIVerb: "ship-gate", |
| 72 | + Note: "Re-checks receipt freshness and gate policy for the addressable slice and returns its PR sources. No state change.", |
| 73 | + }, |
| 74 | + { |
| 75 | + ID: "delivery.next", From: nil, To: "", |
| 76 | + Kind: KindObserve, CostClass: CostObserve, Reversible: false, |
| 77 | + HandlerRef: "ResolveNext", CLIVerb: "next-status", |
| 78 | + Note: "Derives the recommended next move. Read-only, except that the published branch caches an observed terminal PRState as a best-effort side effect (a known bypass, modeled not fixed).", |
| 79 | + }, |
| 80 | + { |
| 81 | + ID: "delivery.recovery_status", From: []StateID{StateBuild, StateTestPassed, StateReviewPassed, StatePublished}, To: "", |
| 82 | + Kind: KindObserve, CostClass: CostObserve, Reversible: false, |
| 83 | + HandlerRef: "ResolveRecovery", CLIVerb: "recovery-status", |
| 84 | + Note: "Derives a correction decision; carries no edit/approve/publish authority. Read-only, except the same best-effort terminal-PRState cache.", |
| 85 | + }, |
| 86 | +} |
| 87 | + |
| 88 | +// Transitions returns a copy of the declared transition set. |
| 89 | +func Transitions() []TransitionDescriptor { |
| 90 | + out := make([]TransitionDescriptor, len(registry)) |
| 91 | + copy(out, registry) |
| 92 | + return out |
| 93 | +} |
| 94 | + |
| 95 | +// Transition returns the descriptor with the given ID. |
| 96 | +func Transition(id TransitionID) (TransitionDescriptor, bool) { |
| 97 | + for _, t := range registry { |
| 98 | + if t.ID == id { |
| 99 | + return t, true |
| 100 | + } |
| 101 | + } |
| 102 | + return TransitionDescriptor{}, false |
| 103 | +} |
| 104 | + |
| 105 | +// HandlerRefs returns the distinct real function names the registry declares. |
| 106 | +func HandlerRefs() []string { |
| 107 | + seen := map[string]bool{} |
| 108 | + var out []string |
| 109 | + for _, t := range registry { |
| 110 | + if !seen[t.HandlerRef] { |
| 111 | + seen[t.HandlerRef] = true |
| 112 | + out = append(out, t.HandlerRef) |
| 113 | + } |
| 114 | + } |
| 115 | + return out |
| 116 | +} |
0 commit comments