fix(controller): return an error for an unconfigured model #217
<!-- ccr-overview-v2 -->
🟢 Approval recommended
The localized guard preserves callback dispatch and has focused regression coverage, though full contribution gates remain unverified.
No open issues 🎉
<details>
<summary><strong>What changed in this PR</strong></summary>
Prevents Controller.Exec from panicking when no model callback is configured, while preserving nil callbacks for replay and streaming-only controllers.
Changes:
| File | Description |
| ---- | ----------- |
| controller/controller.go | Guards against an unconfigured model and documents the behavior. |
| controller/controller_test.go | Tests callback configurations and verifies journal integrity. |
</details>
<sub>Review effort: Balanced</sub>
Thanks Slava, looks good. One small test nit: assert the missing-callback error in the unconfigured case, so an unrelated failure can't satisfy it.
nit: could the unconfigured row assert the specific error (errors.Is or the message), so an unrelated Exec failure can't satisfy it?
nit: could this be an exported sentinel like ErrMissingSessionUID, so callers can tell a missing model from a provider failure and the test can pin it?
Approved these changes.
gambtho
vfalico
Summary
Controller.Execpanics when a live model call has neither a regular nor a streaming model callback.Return an error at invocation instead. Keep nil model callbacks valid during construction because replay and streaming-only controllers support them.
Add a table-driven regression covering missing, regular and streaming-only callbacks, including journal-chain verification.
Verification
go test -p=2 -count=1 -timeout=90s -run=^TestExecModelConfiguration$ -v ./controllergo test -race -p=2 -count=1 -shuffle=on -timeout=180s ./controllergo vet -p=2 ./controller.Full-repository contribution gates have not been run locally.