Philosophy: Silence over noise, clarity over excess
This roadmap outlines planned improvements for the Seris Discord bot, prioritized by impact and effort.
Strengths:
- Clean modular architecture (commands/embeds/services)
- Comprehensive deployment options (Docker, local install, GitHub releases)
- Modern Rust 2021 edition with minimal attack surface
Key Areas for Improvement:
- Error handling reliability
- Test coverage
- Code documentation
- Production hardening
Goal: Eliminate panics and improve fault tolerance
- Replace all
.unwrap()calls with proper error handling- Priority:
main.rslines 52-53 (client startup) - Priority: All service layer API calls
- Priority:
- Implement structured error types with
thiserror- Create
SerisErrorenum with variants for each failure mode - Add error context for debugging
- Create
- Fix silent error swallowing in
commands/clear.rs- Log errors even when not showing to user
- Add input validation
- Validate API keys are non-empty at startup
- Validate Discord permissions before operations
Estimated Effort: 2-3 days
Impact: ⭐⭐⭐⭐⭐
Goal: Consistent, structured logging across the codebase
- Replace all
println!()withlog/env_loggercommands/anime.rscommands/manga.rs
- Add structured logging with
tracingcrate (optional upgrade) - Implement log levels consistently
error!for failureswarn!for recoverable issuesinfo!for significant eventsdebug!for development
Estimated Effort: 1 day
Impact: ⭐⭐⭐⭐
Goal: Self-documenting code with Rust doc comments
- Add
///doc comments to all public functions - Document all types and structs
- Add module-level documentation (
//!) - Include usage examples where applicable
- Run
cargo docto verify no warnings
Estimated Effort: 2 days
Impact: ⭐⭐⭐⭐
Goal: Achieve 80%+ code coverage
- Set up test infrastructure
- Add
tokio-testfor async tests - Configure test utilities module
- Add
- Write tests for service layer
services/jikan.rs- mock API responsesservices/nasa.rs- mock API responses
- Write tests for command logic
- Test embed builders in
embeds/ - Test validation logic
- Test embed builders in
- Add CI test job to GitHub Actions
Estimated Effort: 4-5 days
Impact: ⭐⭐⭐⭐⭐
Goal: End-to-end testing for critical paths
- Create integration test suite
- Test full command execution flow
- Test error scenarios
- Mock Discord API interactions
- Test configuration loading edge cases
Estimated Effort: 2-3 days
Impact: ⭐⭐⭐⭐
Goal: Consistent code style and catch common issues
- Add
rustfmt.tomlconfiguration - Add
clippy.tomlwith project-specific lints - Configure CI to run
cargo fmt --checkandcargo clippy - Fix existing clippy warnings
- Consider adding
denylints for critical issues
Estimated Effort: 1 day
Impact: ⭐⭐⭐
Goal: Clean shutdown without data loss or orphaned resources
- Implement proper signal handling
- Flush logs before exit
- Close HTTP connections cleanly
- Disconnect from Discord gracefully
- Add shutdown timeout
Estimated Effort: 1-2 days
Impact: ⭐⭐⭐⭐
Goal: Secure and flexible configuration
- Add environment variable fallbacks for secrets
SERIS_DISCORD_TOKENSERIS_NASA_API_KEY
- Validate configuration at startup with clear error messages
- Add
.envto.gitignore - Document all configuration options in README
- Consider adding config schema validation
Estimated Effort: 1-2 days
Impact: ⭐⭐⭐⭐
Goal: Handle external API failures gracefully
- Add HTTP request timeouts (currently missing)
- Implement retry logic with exponential backoff
- Add circuit breaker pattern for failing APIs
- Cache responses where appropriate (reduce API calls)
- Add rate limiting awareness
Estimated Effort: 2-3 days
Impact: ⭐⭐⭐⭐
Goal: Reduce attack surface
- Audit all external command execution (
cli.rs)- Sanitize all paths and inputs
- Consider using
std::process::Commandwith explicit args
- Review permission requirements for all commands
- Add rate limiting for commands (prevent abuse)
- Consider adding audit logging for admin actions
Estimated Effort: 2 days
Impact: ⭐⭐⭐⭐
Goal: Faster, more reliable builds and deployments
- Remove unnecessary workspace configuration
- Add feature flags for optional components
cli- admin CLI toolsbot- Discord bot functionality
- Optimize Docker build (multi-stage already good)
- Add automated release changelog generation
- Consider adding benchmark tests
Estimated Effort: 1-2 days
Impact: ⭐⭐⭐
Goal: Observability for production deployments
- Add metrics collection (optional:
prometheus) - Document logging and monitoring recommendations
Estimated Effort: 1-2 days
Impact: ⭐⭐⭐
Goal: Better onboarding and user experience
- Add CONTRIBUTING.md
- Add architecture diagram
- Document API endpoints used
- Add troubleshooting guide to README
- Create deployment guide for different platforms
Estimated Effort: 1-2 days
Impact: ⭐⭐⭐
Goal: Expand bot capabilities (optional)
- Add more utility commands
- Implement command cooldowns
- Add database support for persistence
- Consider plugin architecture
- Add admin dashboard (web UI)
Estimated Effort: Variable
Impact: Depends on features
Goal: Reduce resource usage
- Profile memory usage
- Optimize API call patterns
- Consider connection pooling
- Benchmark critical paths
Estimated Effort: 2-3 days
Impact: ⭐⭐ (current performance likely adequate)
| File | Issue | Priority |
|---|---|---|
src/main.rs:52-53 |
.unwrap() on client startup |
Critical |
src/commands/clear.rs:22 |
Magic number (40) | High |
src/commands/clear.rs:36 |
Silent error swallowing | High |
src/commands/anime.rs |
println!() instead of logging |
Medium |
src/commands/manga.rs |
println!() instead of logging |
Medium |
src/cli.rs:12 |
Hardcoded system path | Medium |
src/services/jikan.rs |
Redundant error handling | Low |
src/services/nasa.rs |
Redundant error handling | Low |
Cargo.toml |
Unnecessary workspace config | Low |
[dev-dependencies]
tokio-test = "0.4" # Async testing
[dependencies]
thiserror = "1.0" # Error type derivation
tracing = "0.1" # Structured logging (optional)
tracing-subscriber = "0.3" # Log formatting- Zero
.unwrap()calls in production code - 80%+ test coverage
- All public APIs documented
- CI passes with fmt, clippy, and tests
- Graceful shutdown completes in < 5 seconds
- No panic logs in production (30-day period)
Last updated: 2026-04-02