Repository navigation
Commit b5bb1a7
orchestrator: nil-app guards + transitive-call audit (P2b PR1) (#26)
* refactor(orchestrator): nil-app guards for stateless subset (P2b-T2)
Make the 3 stateless steps (step.lsp_diagnose, step.self_improve_validate,
step.self_improve_diff) safe to execute with app=nil — the condition the gRPC
legacy-bridge imposes (typed_contracts.go AgentPlugin.CreateStep calls
factory(name, config, nil)). This unblocks serving them via the workflow-plugin-agent
gRPC binary in a subsequent PR (Phase 2b adapter + fold-in).
Two nil-guards (additive — only the app==nil branch is new; real-app path unchanged):
- findGuardrailsModule (step_agent_execute.go): prepend `if app == nil { return nil }`.
Reached transitively by self_improve_validate.Execute -> checkImmutability (:121).
- resolveServices (services.go): prepend `if app == nil { return <null bundle> }` BEFORE
the `reg := app.SvcRegistry()` panic site (:509). Reached transitively by
self_improve_diff.Execute -> postToBlackboard (:118). The null bundle mirrors the
all-Null defaults the function builds for an empty registry, so every caller's
IsNull()/null check degrades gracefully.
lookupLSPProvider (step_lsp_diagnose.go:108) was already guarded — no change.
The transitive-call audit (D1/D10 — NOT a flat grep) is recorded as a comment
header at the top of stateless_nilapp_test.go. A flat grep on the step files is
false-clean: step_self_improve_diff has zero direct s.app derefs yet panics
transitively via resolveServices.
T1 fold-in compile+launch smoke (de-risk ADR 0053 unconditional fold-in) PASSED
prior to this change: cross-compiled clean across the full goreleaser matrix
(linux/darwin/windows x amd64/arm64, CGO_ENABLED=0 — no FAIL) and the launched
binary served without startup panic (zero stderr, killed by timeout signal — the
orchestrator package has no func init(), and its transitive deps don't fatal at
startup). The throwaway cmd/foldin-smoke probe was removed; the durable regression
test lands in a later task (T5).
Evidence:
- go test ./orchestrator/ -run TestStatelessNilApp -v -> PASS (all 3 subtests)
- go test ./orchestrator/ ./executor/ -> green (real-app path unaffected; A5)
- go test -race ./orchestrator/ -> green
- go vet ./... -> clean
- cd /Users/jon/workspace/ratchet && go build ./... -> clean (published-pin smoke)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs(orchestrator): clarify audit line numbers are pre-guard sites (P2b-T2)
The transitive-audit comment header in stateless_nilapp_test.go cited specific
line numbers (findGuardrailsModule :734, resolveServices :509) and labelled them
"current". They are the PRE-GUARD origin/master panic sites — the guards this PR
adds sit above each cited line, so in the current tree the derefs are a few lines
lower. Reworded the header so a future reader tracing "what was the bug" lands on
the right code. Doc-only; no behavior change.
Co-Authored-By: Claude <noreply@anthropic.com>
* test(orchestrator): assert blackboard_warning in diff nil-app subtest
Tightens TestStatelessNilApp/self_improve_diff: assert the
blackboard_warning output key is present, proving the transitive
postToBlackboard -> resolveServices(nil) path actually executed (not
just 'no panic'). Regression guard against deleting the postToBlackboard
branch. Review nit (PR1 two-stage review).
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2584c98 commit b5bb1a7
3 files changed
Lines changed: 238 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
509 | 533 | | |
510 | 534 | | |
511 | 535 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
729 | 729 | | |
730 | 730 | | |
731 | 731 | | |
732 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
733 | 735 | | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
734 | 739 | | |
735 | 740 | | |
736 | 741 | | |
| |||
0 commit comments