mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-09-01 17:19:24 +00:00
fix: remove debug_assert guards that panic on valid error paths (#1385)
* fix: remove debug_assert guards that panic on valid error paths (#1312) Two debug_assert! calls added in #1312 fire on expected runtime error paths (not programmer bugs), turning graceful error returns into panics in debug/test builds: - state.rs: Completed→Cancelled is a user-facing error handled by transition_to() returning Err — not a bug - execute.rs: empty tool_name from malformed LLM output is handled by ToolError::NotFound — not a bug Removes both asserts; keeps the circuit-breaker assert (genuinely guards a caller invariant). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix: tighten empty tool name test to assert ToolError::NotFound variant Address review feedback: assert the specific error variant instead of just is_err() so the regression test actually enforces the expected error path. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * style: cargo fmt Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
4566181f40
commit
b7a1edf346
@@ -258,13 +258,6 @@ impl JobContext {
|
||||
new_state: JobState,
|
||||
reason: Option<String>,
|
||||
) -> Result<(), String> {
|
||||
debug_assert!(
|
||||
self.state.can_transition_to(new_state),
|
||||
"BUG: invalid job state transition {} -> {} for job {}",
|
||||
self.state,
|
||||
new_state,
|
||||
self.job_id
|
||||
);
|
||||
if !self.state.can_transition_to(new_state) {
|
||||
return Err(format!(
|
||||
"Cannot transition from {} to {}",
|
||||
|
||||
Reference in New Issue
Block a user