Commit c5cf8fa
fix(devkit): testkit host-stubs cover SubagentConfig + Knobs so register() runs host-free (protoLabsAI#1773)
The plugin-devkit testkit's default host-stubs omitted `graph.subagents.config`
entirely (ModuleNotFoundError) and handed back a raise-when-called `Knobs` /
`make_knob_tools` from `graph.sdk`. So a scaffolded plugin whose `register()`
registers a subagent (`registry.register_subagent(SubagentConfig(...))`) or wires
runtime knobs failed its OWN host-free smoke test before the author wrote a line.
These seams are CONSTRUCTED at register() time, not merely imported, so they need
permissive RECORD-ONLY stand-ins (not the raise-when-called placeholder):
- Stub `graph.subagents` + `graph.subagents.config` exposing `SubagentConfig`, a
record that stores its kwargs as attributes — `from graph.subagents.config import
SubagentConfig` imports and `reg.subagents[0].name` is assertable.
- `graph.sdk` now exposes a chainable no-op `Knobs` (`.define`/`.preset` return self,
reads mirror the surface) and `make_knob_tools(...)` returning record-only stub
tools named like the real `<prefix>_knobs`/`_tune`/`_preset` — a plugin can
`register_tools(make_knob_tools(...))` host-free and the contribution stays
assertable. The remaining `graph.sdk` seams (complete/run_subagent/...) stay
raise-unpatched so a model-touching test still fails loudly if unpatched.
`graph/plugins/testkit.py` is the single source of truth — the scaffolder vendors it
verbatim into each plugin's `tests/_plugin_testkit.py`, so newly-scaffolded plugins
inherit the fix automatically.
Closes protoLabsAI#1764
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 7237513 commit c5cf8fa
2 files changed
Lines changed: 130 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 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 | + | |
112 | 172 | | |
113 | 173 | | |
114 | 174 | | |
115 | 175 | | |
116 | 176 | | |
117 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
118 | 181 | | |
119 | 182 | | |
120 | 183 | | |
121 | 184 | | |
122 | 185 | | |
123 | 186 | | |
| 187 | + | |
| 188 | + | |
124 | 189 | | |
125 | 190 | | |
126 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 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 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
0 commit comments