Skip to content

chore: refactor overall architecture and error handling#11

Merged
kyokuping merged 12 commits intomainfrom
chore/refactor
Feb 21, 2026
Merged

chore: refactor overall architecture and error handling#11
kyokuping merged 12 commits intomainfrom
chore/refactor

Conversation

@kyokuping
Copy link
Copy Markdown
Owner

Summary

This PR introduces minor refactoring and features to improve the overall architecture and error handling.

Key Changes

  • feature:
    • Introduced structured logging with tracing.
    • Improved error handling with caching and templating.
    • Implemented directory index and caching with moka and minijinja.
  • bug fix:
    • Sanitized directory paths in the auto-generated index page to prevent local path disclosure.
    • Eliminated double writing of errors.
    • Fixed auto-indexing logic.
  • refactor/optimization:
    • Encapsulated route serving logic into RouterHandler.
    • Improved error diagnostics by integrating miette.
    • Renamed templates to .jinja for clarity.
    • Modularized request handling and utility functions.
    • Moved Jinja environment management to the Server struct.
    • Simplified response logic.
  • test
  • CI

Details

  • Error handling is now more robust with the integration of miette, providing better diagnostic reports.
  • Structured logging using tracing has been added to provide more insight into the application's behavior.
  • Caching for directory listings has been implemented using moka to improve performance.

Technical Notes

Quality Control

Related Issues

@kyokuping kyokuping merged commit 7d199a4 into main Feb 21, 2026
2 checks passed
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 78.72340% with 120 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/error/damas_error.rs 26.08% 34 Missing ⚠️
src/server.rs 32.25% 19 Missing and 2 partials ⚠️
src/router.rs 76.71% 14 Missing and 3 partials ⚠️
src/http.rs 76.27% 11 Missing and 3 partials ⚠️
src/main.rs 0.00% 14 Missing ⚠️
src/util.rs 78.84% 9 Missing and 2 partials ⚠️
test/main_test.rs 93.84% 8 Missing ⚠️
src/error/error_registry.rs 98.55% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Flag Coverage Δ
rust 89.61% <78.72%> (-0.64%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/index.rs 93.40% <100.00%> (+0.46%) ⬆️
src/lib.rs 100.00% <ø> (+39.15%) ⬆️
src/response.rs 100.00% <100.00%> (ø)
src/error/error_registry.rs 99.46% <98.55%> (ø)
test/main_test.rs 89.24% <93.84%> (+2.34%) ⬆️
src/util.rs 78.84% <78.84%> (ø)
src/http.rs 76.27% <76.27%> (ø)
src/main.rs 0.00% <0.00%> (ø)
src/router.rs 96.30% <76.71%> (-2.24%) ⬇️
src/server.rs 76.33% <32.25%> (-5.18%) ⬇️
... and 1 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kyokuping kyokuping changed the title Chore/refactor chore: refactor overall architecture and error handling Mar 2, 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.

2 participants