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 - needed for ErrorPage
  • cot_core::error::error_impl::* - to allow implementing of errors in cot
  • Error.backtrace() - needed for supplying error backtrace in ErrorPageTemplateBuilder
  • Backtrace.frames() - needed for the Template derive for ErrorPageTemplate (used in error.html template)
  • StackFrame.symbol_name() - as above
  • StackFrame.location() - as above
  • StackFrame - as above
  • Body.axum() - needed for request_axum_to_cot in project.rs
  • InvalidContentType
  • AppName
  • RouteName
  • BoxRequestHandler - used in openapi.rs and router.rs
  • into_box_request_handler - used in method.rs and router.rs

Stayed private with following gotchas:

  • NotFound.router() - removed deprecated NotFound constructor methods from Error

@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.

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.63296% with 17 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/request/extractors.rs 86.66% 2 Missing ⚠️
cot-core/src/request.rs 98.21% 0 Missing and 1 partial ⚠️
cot/src/error_page.rs 0.00% 1 Missing ⚠️
Flag Coverage Δ
rust 90.37% <93.63%> (-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.13% <100.00%> (ø)
cot-core/src/error/method_not_allowed.rs 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 97.50% <ø> (ø)
cot-core/src/response/into_response.rs 99.27% <100.00%> (ø)
... and 26 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings January 18, 2026 12:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 41 out of 47 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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 amazing - in the thorough review, I found a few documentation issues; when you fix them, please feel free to merge this!

@m4tx
Copy link
Member

m4tx commented Jan 26, 2026

By the way, asking out of curiosity - did you try to find out why the semver-checks is complaining? Seems like it produces a lot of false positives about modules/structures not accessible using old paths, which isn't true. I'm wondering if anyone has reported that yet (and if not, it's definitely worth reporting!)

EDIT: ah, I guess this is obi1kenobi/cargo-semver-checks#638

@seqre seqre force-pushed the cot-core-reloaded branch from 60e51a7 to 76b741b Compare January 26, 2026 17:23
@seqre seqre force-pushed the cot-core-reloaded branch from 76b741b to f813f7c Compare January 26, 2026 17:28
@seqre seqre enabled auto-merge (squash) January 26, 2026 17:37
@seqre seqre merged commit 09a0210 into master Jan 26, 2026
37 of 38 checks passed
@seqre seqre deleted the cot-core-reloaded branch January 26, 2026 17:45
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