Skip to content

refactor: auth logic and user creation logic; improve test isolation#22

Merged
ReenigneArcher merged 1 commit into
masterfrom
dev
Aug 22, 2025
Merged

refactor: auth logic and user creation logic; improve test isolation#22
ReenigneArcher merged 1 commit into
masterfrom
dev

Conversation

@ReenigneArcher

@ReenigneArcher ReenigneArcher commented Aug 20, 2025

Copy link
Copy Markdown
Member

Description

Refactors authentication to use BCrypt for password hashing and verification, removes explicit password salt fields from the schema, and improves JWT secret handling. User creation now hashes passwords and PINs using BCrypt, and admin privileges are required for creating users after the first. Adds comprehensive integration and unit tests for authentication, user creation, and protected routes, and introduces shared test utilities to reduce code duplication. Removes unused dependencies (serial_test, tokio) and updates test infrastructure for isolated, parallel test execution.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@codecov

codecov Bot commented Aug 20, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.06%. Comparing base (7db10b7) to head (51f0452).
⚠️ Report is 25 commits behind head on master.

Files with missing lines Patch % Lines
crates/server/src/web/routes/auth.rs 20.00% 4 Missing ⚠️
crates/server/src/web/routes/user.rs 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
+ Coverage   62.73%   68.06%   +5.33%     
==========================================
  Files          18       15       -3     
  Lines         432      404      -28     
==========================================
+ Hits          271      275       +4     
+ Misses        161      129      -32     
Flag Coverage Δ
aarch64-apple-darwin 68.23% <66.66%> (+5.59%) ⬆️
aarch64-unknown-linux-gnu 68.06% <66.66%> (+5.56%) ⬆️
x86_64-apple-darwin 68.23% <66.66%> (+5.59%) ⬆️
x86_64-pc-windows-msvc 68.06% <66.66%> (+5.56%) ⬆️
x86_64-unknown-linux-gnu 68.06% <66.66%> (+5.56%) ⬆️

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

Files with missing lines Coverage Δ
crates/server/src/auth.rs 96.49% <100.00%> (+47.36%) ⬆️
crates/server/src/db/schema.rs 100.00% <ø> (ø)
crates/server/src/web/mod.rs 86.95% <100.00%> (+0.91%) ⬆️
crates/server/src/web/routes/user.rs 72.00% <62.50%> (+5.33%) ⬆️
crates/server/src/web/routes/auth.rs 73.33% <20.00%> (+0.25%) ⬆️

... and 3 files with indirect coverage changes

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

@ReenigneArcher ReenigneArcher force-pushed the dev branch 3 times, most recently from dfc99de to 50900d3 Compare August 20, 2025 22:28
@ReenigneArcher ReenigneArcher changed the title refactor: auth logic and improve test isolation refactor: auth logic and user creation logic; improve test coverage Aug 20, 2025
@ReenigneArcher ReenigneArcher force-pushed the dev branch 6 times, most recently from 8f9755a to 288e89a Compare August 22, 2025 01:12
Refactors authentication to use BCrypt for password hashing and verification, removes explicit password salt fields from the schema, and improves JWT secret handling. User creation now hashes passwords and PINs using BCrypt, and admin privileges are required for creating users after the first. Adds comprehensive integration and unit tests for authentication, user creation, and protected routes, and introduces shared test utilities to reduce code duplication. Removes unused dependencies (serial_test, tokio) and updates test infrastructure for isolated, parallel test execution.
@sonarqubecloud

Copy link
Copy Markdown

@ReenigneArcher ReenigneArcher changed the title refactor: auth logic and user creation logic; improve test coverage refactor: auth logic and user creation logic; improve test isolation Aug 22, 2025
@ReenigneArcher ReenigneArcher merged commit 08ebe4a into master Aug 22, 2025
19 checks passed
@ReenigneArcher ReenigneArcher deleted the dev branch August 22, 2025 01:38
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.

1 participant