Skip to content

refactor!: move auth state, auth middleware and the admin app - #727

Draft
shadowcpy wants to merge 1 commit into
cot-rs:masterfrom
shadowcpy:refactor-move-auth
Draft

shadowcpy wants to merge 1 commit into
cot-rs:masterfrom
shadowcpy:refactor-move-auth

Conversation

@shadowcpy

@shadowcpy shadowcpy commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

refactor!: move auth state, auth middleware and the admin app into their own modules

Prepares the auth refactor by moving auth-related modules:

  • the authentication state (Auth) moves to cot::auth::state,
  • the authentication middleware moves to cot::middleware::auth,
  • the admin app moves to cot::admin::app,
  • cot::auth::db is renamed to cot::auth::user_pass (including its migrations), as it will hold the username/password backend.

BREAKING CHANGE: cot::auth::db is now cot::auth::user_pass.

Related issue or discussion

Related to the Auth Refactor, see #634

Description

Moves auth-related modules to more sensible places, this is done primarly to avoid tons of conditional db gates since the refactored auth system will require the db feature to be enabled.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / cleanup
  • Performance improvement
  • Other (describe above)

Checklist

  • I've read the contributing guide
  • Tests pass locally (just test-all)
  • Code passes clippy (just clippy)
  • Code is properly formatted (cargo fmt)
  • New tests added (regression test for bugs, coverage for new features)
  • Documentation (both code and site) updated (if applicable)

@github-actions github-actions Bot added A-docs Area: Documentation C-cli Crate: cot-cli (issues and Pull Requests related to Cot CLI) C-lib Crate: cot (main library crate) labels Nov 5, 2026
@shadowcpy shadowcpy changed the title refactor!: move auth state, auth middleware and the admin app into th… refactor!: move auth state, auth middleware and the admin app Nov 5, 2026
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.04192% with 105 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cot/src/admin/app.rs 70.98% 53 Missing and 21 partials ⚠️
cot/src/auth/state.rs 87.14% 5 Missing and 13 partials ⚠️
cot/src/middleware/auth.rs 89.23% 5 Missing and 2 partials ⚠️
cot/src/auth.rs 85.00% 0 Missing and 6 partials ⚠️
Flag Coverage Δ
rust 91.08% <79.04%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
cot/src/admin.rs 80.48% <ø> (+8.19%) ⬆️
cot/src/auth/user_pass.rs 82.91% <ø> (ø)
cot/src/config.rs 94.63% <ø> (ø)
cot/src/db/migrations/graph_export.rs 96.40% <ø> (ø)
cot/src/middleware.rs 95.20% <ø> (+1.23%) ⬆️
cot/src/project.rs 87.29% <ø> (ø)
cot/src/request/extractors.rs 89.28% <ø> (-0.94%) ⬇️
cot/src/test.rs 85.11% <100.00%> (ø)
cot/src/auth.rs 92.41% <85.00%> (+1.40%) ⬆️
cot/src/middleware/auth.rs 89.23% <89.23%> (ø)
... and 2 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…eir own modules

Prepares the auth refactor by moving auth-related modules:

* the authentication state (`Auth`) moves to `cot::auth::state`,
* the authentication middleware moves to `cot::middleware::auth`,
* the admin app moves to `cot::admin::app`,
* `cot::auth::db` is renamed to `cot::auth::user_pass` (including its
  migrations), as it will hold the username/password backend.

BREAKING CHANGE: `cot::auth::db` is now `cot::auth::user_pass`.

This branch has not been deployed

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

Labels

A-docs Area: Documentation C-cli Crate: cot-cli (issues and Pull Requests related to Cot CLI) C-lib Crate: cot (main library crate)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant