Commit 3f49db3
feat(feedback): implement feedback-o-tron invoke dispatch (FFI-backed) (#193)
## What
Builds feedback-o-tron *for real* (the follow-up you green-lit),
replacing the "Grade D Alpha" stub in `feedback_ffi.zig`'s
`boj_cartridge_invoke` with a live, state-machine-backed implementation,
and switching the e2e cycle to the cartridge's **actual declared
tools**.
## Key insight
The stub already dispatched the **correct** `cartridge.json` tool names
(`feedback_register_channel/start_collecting/submit/get_stats`) — it
just returned `{"status":"stub"}`. The old e2e cycle invoked tools that
**never existed** (`open_channel/summary/export/status/list_channels`),
which is why it got `{}`. So the fix is: make the FFI real, and point
the test at the real tools.
## Changes
- **`feedback_ffi.zig`** — `boj_cartridge_invoke` now backs the 4
manifest tools with the existing `fb_*` channel state machine:
- `feedback_register_channel` → `fb_register` →
`{"slot":N,"channel":C,"state":1}`
- `feedback_start_collecting` → `fb_start_collecting` →
`{"slot":N,"collecting":true,"state":2}`
- `feedback_submit` → `fb_submit` →
`{"recorded":true,"slot":N,"feedback_count":K}`
- `feedback_get_stats` → `fb_count`/`fb_positive_count`/… →
`{"total_feedback":…,"positive":…,…}`
- `channel`/`slot`/`sentiment` are read from the JSON args via a small,
`std.json`-free byte scanner (`jsonInt`) — sufficient for the flat arg
objects and version-stable.
- **`feedback_ffi.zig` test** — the in-file invoke test now drives the
real `register → start → submit ×2 → get_stats` cycle and asserts the
real shapes (so `zig build test` covers it in CI).
- **`tests/e2e_full.sh` Step 6** — rewritten to exercise the real tools
via the `"arguments"` object (the field BojRest forwards to the FFI);
asserts `slot` / `collecting:true` / `recorded:true` / `total_feedback`.
Removes the `FEEDBACK_OTRON` skip from #192.
- **No Elixir change** — the router already forwards `arguments` and
returns the FFI's parsed JSON as the body. The cross-language flow (Zig
JSON → Invoker parse → Jason re-encode → test) lands the keys the
assertions read.
## Verification — please note
`e2e_full.sh` passes `bash -n` + `shellcheck` locally. **The Zig could
not be compiled locally**: this sandbox's network is GitHub-only —
`ziglang.org` returns **403** and Zig isn't on GitHub releases, and apt
is blocked. So the FFI is verified by **CI** (`abi-drift.yml` +
`e2e.yml` both run `zig build`) and the added Zig unit test. I'll watch
this PR and fix any compile error promptly. (If you'd rather I verify
locally, allowing `ziglang.org` in the environment's network policy
would let me install Zig 0.15.1.)
The ABI is unchanged (only the dispatch body), so `abi-drift` should
stay green.
🤖 Draft via Claude Code.
---
_Generated by [Claude
Code](https://claude.ai/code/session_019tMcRS1Dm1nWjjYP4WvbJa)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 9c540b1 commit 3f49db3
2 files changed
Lines changed: 105 additions & 77 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
263 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
264 | 290 | | |
265 | 291 | | |
266 | 292 | | |
267 | 293 | | |
268 | 294 | | |
269 | 295 | | |
270 | | - | |
271 | 296 | | |
272 | 297 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
285 | 325 | | |
286 | 326 | | |
287 | 327 | | |
| |||
344 | 384 | | |
345 | 385 | | |
346 | 386 | | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
361 | 410 | | |
362 | 411 | | |
363 | 412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 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 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
249 | 229 | | |
250 | | - | |
251 | | - | |
| 230 | + | |
| 231 | + | |
252 | 232 | | |
253 | | - | |
254 | | - | |
255 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
256 | 236 | | |
257 | | - | |
258 | | - | |
| 237 | + | |
| 238 | + | |
259 | 239 | | |
260 | | - | |
261 | | - | |
| 240 | + | |
| 241 | + | |
262 | 242 | | |
263 | | - | |
264 | | - | |
| 243 | + | |
| 244 | + | |
265 | 245 | | |
266 | | - | |
267 | | - | |
| 246 | + | |
| 247 | + | |
268 | 248 | | |
269 | | - | |
270 | | - | |
| 249 | + | |
| 250 | + | |
271 | 251 | | |
272 | | - | |
273 | | - | |
| 252 | + | |
| 253 | + | |
274 | 254 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
| 255 | + | |
| 256 | + | |
279 | 257 | | |
280 | | - | |
281 | | - | |
282 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
283 | 262 | | |
284 | 263 | | |
285 | 264 | | |
| |||
0 commit comments