refactor(server-ng): move password crypto into server_common#3562
Open
jayakasadev wants to merge 1 commit into
Open
refactor(server-ng): move password crypto into server_common#3562jayakasadev wants to merge 1 commit into
jayakasadev wants to merge 1 commit into
Conversation
|
Thanks for the PR. It is labeled Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3562 +/- ##
=============================================
- Coverage 74.07% 61.06% -13.01%
Complexity 937 937
=============================================
Files 1249 1247 -2
Lines 128248 117573 -10675
Branches 104116 93487 -10629
=============================================
- Hits 94994 71791 -23203
- Misses 30219 42585 +12366
- Partials 3035 3197 +162
🚀 New features to boost your workflow:
|
eb32f00 to
6b41184
Compare
server-ng pulled password hashing and verification from the legacy server crate, forcing a compile-time dependency on the binary it is meant to replace. The crypto module is three free functions over argon2 and rand with no server-internal state, so it relocates cleanly to the shared server_common crate. server keeps the symbols at their original module path via a re-export, so its own call sites are untouched. The argon2 and rand dependencies move with the code, since crypto was their only consumer in server. Refs apache#3315. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6b41184 to
5a84ad2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Moves the password crypto helpers (
hash_password,verify_password,generate_secret) out ofcore/serverinto the sharedserver_commoncrate, and repointsserver-ngat the new home.Why
core/server-ng(the new Viewstamped-Replication server that is meant to replace the legacycore/server) still reaches intocore/serverviause server::*. That welds the next-gen server to the very crate it is supposed to deprecate, soserver-ngcannot compile or ship without dragging in dead code.#3315 tracks unpicking those ties one cluster at a time: each shared piece moves into
server_common(the legitimate shared crate, not deprecated),server-ngis repointed at it, and the work continues untilserver-ngcan dropserver = { workspace = true }entirely. This PR cuts the crypto slice:server-ngimportedserver::streaming::utils::crypto, a compile-time edge on the legacy crate. Moving the helper toserver_commongives both servers a shared home with no dependency onserver.Changes
crypto.rsmoved toserver_common(rename, zero body changes)server_commonpub mod crypto;argon2andrandadded — crypto's only dependencies, previously pulled in byserverserverargon2andranddropped —cryptowas their only consumerstreaming::utils::crypto, so its in-crate call sites (http_server,shard/execution,shard/system/users,user.rs) are unchangedserver-ngauth.rsandusers.rsnowuse server_common::cryptoScope
One slice of #3315. On its own it does not let
server-ngdrop theserverdependency — otheruse server::*clusters (logging, segment storage, consumer offsets, shard allocator, root-user bootstrap, fs utils) still remain. It removes one of them and gives the root-user-bootstrap phase a clean foundation to build on.Verification
cargo fmt --all,cargo sort --no-format --workspace— cleancargo clippy --all-features --all-targets -- -D warningsonserver,server_common,server-ng— cleancargo machete— no unused depscargo check/build—server,server_common,server-ngbuildcargo test -p server_common— 64 passedrg 'streaming::utils::crypto' core/server-ng/src— no matchesNo behavior change: existing password hashes still verify; legacy
serverbuilds via the re-export. Rebased onto latestmaster;once_cellis not introduced (consistent with #3524'sonce_cell→ std migration).Refs #3315.
🤖 Generated with Claude Code