Skip to content

Conversation

@chenba
Copy link
Collaborator

@chenba chenba commented Oct 1, 2025

Description

sync server's extractors.rs was quite large. This patch simply breaks it up. There are no type or functionality changes.

Testing

Existing tests should pass.

Issue(s)

Closes STOR-367 / #1820

@chenba chenba force-pushed the STOR-367-split-extractors branch 2 times, most recently from c073b18 to 8b598dc Compare October 1, 2025 15:03
@chenba chenba marked this pull request as ready for review October 1, 2025 17:39
mod constants;
pub use constants::*;
mod utils;
pub use utils::*;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Couldn't come up with good name for this. :-/

taddes
taddes previously approved these changes Oct 1, 2025
Copy link
Collaborator

@taddes taddes left a comment

Choose a reason for hiding this comment

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

👍 I would get heart palpitations every time I opened the extractors.rs file. This really helps. Let @pjenvey take a look too, but looks great. Thanks for doing this

Copy link
Member

@pjenvey pjenvey left a comment

Choose a reason for hiding this comment

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

do we really have that many extractors? that's a lot of extractors. thanks!

}

#[test]
fn test_invalid_query_args() {
Copy link
Member

Choose a reason for hiding this comment

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

We could also move these tests into their specific modules (e.g. bso_query_params) but totally fine for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

move these tests into their specific modules

Oh yeah, my bad. I should've done that in the first place; that's my preference as well.

@@ -0,0 +1,56 @@
use crate::web::extractors::{
Copy link
Member

Choose a reason for hiding this comment

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

Couple nitpicks here that I won't block on:

  • we're not consistent but we try to organize imports by a grouping of std/external/crate separated by a newline. rustfmt doesn't enforce this but I'll note it has an option for this grouping in nightly, "StdExternalCrate". So this crate block would go below the last import, separated by a newline like in batch_request.rs
  • You could also replace crate::web::extractors:: with super:: (or more specifically super::validation:: here) -- not just because it's shorter but I think it could help avoid wildcard imports in mod.rs. Ideally mod.rs would only pub use what's exposed outside of extractors vs internal -- e.g. everything in validation.rs is internal and doesn't need pub in mod.rs. But I'm not complaining, still beats 2k lines of extractors.rs

@@ -0,0 +1,50 @@
use serde::Deserialize;
Copy link
Member

Choose a reason for hiding this comment

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

Forgot my only actual request: could you move the contents of this module into bso_query_params.rs? As it's specific to there and doesn't have its own FromRequest

@chenba
Copy link
Collaborator Author

chenba commented Oct 3, 2025

@pjenvey Thank you for the feedback. I think I've made all the suggested changes. They are in a separate commit: 7678e88. (I'll squash and rebase master once approved.)

@chenba chenba requested a review from pjenvey October 3, 2025 20:53
@chenba chenba force-pushed the STOR-367-split-extractors branch from 7678e88 to 3404150 Compare October 7, 2025 01:41
@chenba chenba merged commit e26ab91 into master Oct 7, 2025
9 checks passed
@chenba chenba deleted the STOR-367-split-extractors branch October 7, 2025 12:34
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.

4 participants