Skip to content

Conversation

@seqre
Copy link
Member

@seqre seqre commented Jan 11, 2026

This PR attempts to extract the core functionality of the framework to separate crate to speed up compilation among other reasons.

The modules fully/partially moved:

  • basic Cot types
  • body
  • error
  • headers
  • html
  • json
  • response
  • request
  • middleware
  • handler

I think moving router would be valid move as well, but in the current format it's too intertwined with OpenAPI functionality (that we don't want to pull into core) that it can be done at a later time.

With cot-core being a separate crate, the following items had to become public:

  • cot_core::error::backtrace
  • cot_core::error::error_impl::*
  • Error.backtrace()
  • NotFound.router()
  • Backtrace.frames()
  • StackFrame.symbol_name()
  • StackFrame.location()
  • StackFrame
  • Body.axum()
  • Body.wrapper()
  • Body.inner
  • BodyInner
  • InvalidContentType
  • AppName
  • RouteName
  • BoxRequestHandler
  • into_box_request_handler

@github-actions github-actions bot added the C-lib Crate: cot (main library crate) label Jan 11, 2026
@github-actions

This comment was marked as resolved.

@seqre seqre force-pushed the cot-core-reloaded branch from a799923 to c1c890a Compare January 11, 2026 19:30
@seqre seqre self-assigned this Jan 11, 2026
@seqre seqre requested review from ElijahAhianyo and m4tx January 11, 2026 19:36
@seqre seqre marked this pull request as ready for review January 11, 2026 19:36
Copilot AI review requested due to automatic review settings January 11, 2026 19:36

This comment was marked as resolved.

@seqre
Copy link
Member Author

seqre commented Jan 12, 2026

The nightly error should be fixed by rust-lang/rust#150939

@seqre seqre force-pushed the cot-core-reloaded branch from 0033822 to ead28ff Compare January 12, 2026 18:59
Copilot AI review requested due to automatic review settings January 12, 2026 18:59

This comment was marked as duplicate.

Copy link
Member

@m4tx m4tx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice, and seems like it lays a solid foundation for our eventual extraction of the ORM to a separate crate!

I've tried to generate the docs with just docs and it seems like there's a ton of warnings coming from cot-core (outside of missing examples, which are expected) - please make sure these are fixed before we consider merging this.

Self::build_error_data(&mut error_data, error);
}
Kind::WithMessage(message) => {
Kind::WithMessage { 0: message, .. } => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it makes sense to change this enum variant to be a struct variant with named field rather than enum variant? After all, we might (however unlikely) want to add some more fields to it, at which point we'll probably need to add some naming so it's clear what they do. Think "future-proofing the APIs".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do it, but I doubt we'll want to expand that variant, so there's little to it

Copilot AI review requested due to automatic review settings January 16, 2026 18:08
@seqre seqre force-pushed the cot-core-reloaded branch from e364514 to 6a3a723 Compare January 16, 2026 18:08

This comment was marked as outdated.

@seqre seqre force-pushed the cot-core-reloaded branch from 6a3a723 to 9b372af Compare January 16, 2026 18:11
Copilot AI review requested due to automatic review settings January 16, 2026 18:14
@seqre seqre requested a review from m4tx January 16, 2026 18:14

This comment was marked as duplicate.

@seqre seqre force-pushed the cot-core-reloaded branch from ced97e4 to 0536013 Compare January 16, 2026 18:19
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 93.28358% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cot-core/src/request/extractors.rs 94.11% 3 Missing and 4 partials ⚠️
cot-core/src/middleware.rs 85.71% 6 Missing ⚠️
cot/src/error_page.rs 33.33% 2 Missing ⚠️
cot/src/request/extractors.rs 86.66% 2 Missing ⚠️
cot-core/src/request.rs 98.21% 0 Missing and 1 partial ⚠️
Flag Coverage Δ
rust 90.33% <93.28%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
cot-core/src/body.rs 84.89% <100.00%> (ø)
cot-core/src/error/backtrace.rs 96.82% <100.00%> (ø)
cot-core/src/error/error_impl.rs 90.50% <100.00%> (ø)
cot-core/src/error/method_not_allowed.rs 100.00% <ø> (ø)
cot-core/src/error/not_found.rs 80.00% <100.00%> (ø)
cot-core/src/error/uncaught_panic.rs 75.00% <ø> (ø)
cot-core/src/handler.rs 78.26% <100.00%> (ø)
cot-core/src/html.rs 97.44% <ø> (ø)
cot-core/src/request/path_params_deserializer.rs 63.49% <ø> (ø)
cot-core/src/response.rs 96.66% <ø> (ø)
... and 26 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-lib Crate: cot (main library crate)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants