Review found Phase 1 approved with minor issues. Created cleanup tasks: - napi-identity-provider-wiring (bug: NAPI bypasses IdentityProvider) - panic-free-static-config (code smell: panic/unwrap in production path) - non-exhaustive-public-api (future-proofing public API types) - adr-doc-comments (doc convention: ADR references in new modules) - ssh-session-recv-stub-doc (documentation: mark stubs as planned)
1.7 KiB
1.7 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | |
|---|---|---|---|---|---|---|---|---|
| cleanup/panic-free-static-config | Replace panic/expect/unwrap with Result-based error handling in StaticConfig | pending |
|
narrow | low | component | implementation |
Description
The parse_proxy_config function and related code in crates/alknet-core/src/config/static_config.rs uses expect(), panic!(), and bare unwrap() calls. This is bad form for production code — panics in library code should be avoided unless truly unreachable.
Since StaticConfig::from_serve_options() already returns Result<..., ConfigError>, the proxy config parsing should propagate errors through the Result chain instead of panicking. A misconfigured proxy string should produce a clear ConfigError, not crash the process.
Fix:
- Replace
expect()andpanic!()inparse_proxy_configwith properResult::Errreturns - Replace bare
unwrap()calls with?or explicit error mapping - Ensure all error paths produce meaningful
ConfigErrorvariants
Acceptance Criteria
- No
panic!(),expect(), or bareunwrap()instatic_config.rsproduction code paths - All error paths return
Result<..., ConfigError>with descriptive messages - Invalid proxy config strings produce clear errors instead of panicking
- All existing tests pass
- New test: malformed proxy string returns
Err(ConfigError), doesn't panic
References
- crates/alknet-core/src/config/static_config.rs — lines with panic/expect/unwrap
- crates/alknet-core/src/error.rs — ConfigError type
Notes
Identified during Phase 1 review (W5)
Summary
To be filled on completion