Files
alknet/tasks/cleanup/panic-free-static-config.md
glm-5.1 eed3396705 tasks: add 5 cleanup tasks from Phase 1 review, mark review complete
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)
2026-06-08 04:35:52 +00:00

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
review/phase1-core-modifications
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() and panic!() in parse_proxy_config with proper Result::Err returns
  • Replace bare unwrap() calls with ? or explicit error mapping
  • Ensure all error paths produce meaningful ConfigError variants

Acceptance Criteria

  • No panic!(), expect(), or bare unwrap() in static_config.rs production 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