Skip to content

fix(ephapax): sweep .expect("TODO: handle error") — 116 sites - #32

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/expect-todo-sweep
Apr 26, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
fix/expect-todo-sweep

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Comprehensive sweep of all .expect("TODO: handle error") anti-patterns across the ephapax codebase.

Total sites cleared: 116

Policy breakdown:

  • Test code (89 sites): Converted to .unwrap()
  • Production invariants (5 sites): Meaningful .expect() with "invariant:" prefix
  • Error propagation (2 sites): Proper pattern matching
  • Registry lookups (2 sites): Error conversion with ok_or_else()

Verification:

  • cargo check: PASS
  • cargo test --lib: 273/273 PASS

🤖 Generated with Claude Code

Replaced all 116 occurrences of .expect("TODO: handle error") across the codebase:

Policy breakdown:
- Test code (89 sites): converted to .unwrap() per test convention
- Production invariants (5 sites): added meaningful .expect() messages with "invariant:" prefix
  - Parser sequencing: len() == 1 guarantees next() returns Some
  - Match arm processing: len() == 2 and len() == 1 branches with explicit checks
  - Parser tuple/list construction: invariant preconditions documented
- Error propagation (2 sites): replaced with proper error handling
  - DAP Content-Length header: match to safely extract string
  - DAP response JSON serialization: match to skip on serialization failure
- Registry lookups (2 sites): converted to ok_or_else() with UnknownType error

All changes maintain type safety and error semantics:
- cargo check: PASS
- cargo test --lib: 273/273 tests PASS (0 failures)

Files modified:
- src/ephapax-parser/src/{lib,lists_tuples,surface}.rs
- src/ephapax-desugar/src/lib.rs
- src/ephapax-package/src/{lib,manifest,registry,resolver}.rs
- src/ephapax-typing/src/lib.rs
- src/ephapax-vram-cache/src/lib.rs
- src/ephapax-wasm/src/debug.rs
- tools/ephapax-dap/src/main.rs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hyperpolymath
hyperpolymath merged commit a1fd5bb into main Apr 26, 2026
11 checks passed
@hyperpolymath
hyperpolymath deleted the fix/expect-todo-sweep branch April 26, 2026 13:32
Repository owner deleted a comment from chatgpt-codex-connector Bot May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant