Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ Upgrade axum and related dependencies #626

Merged
merged 15 commits into from
Mar 7, 2025
Merged

Conversation

JMicheli
Copy link
Collaborator

@JMicheli JMicheli commented Mar 5, 2025

This pull request upgrades Axum to the latest version, 0.8.1.

This was a fairly extensive set of changes. Axum route handlers now follow a different syntax (/:id => /{id}) and a few other APIs changed. We also had to update a lot of downstream crates that rely on Axum themselves. The most significant change on that front was the necessary upgrading of utoipa to 5.3.1 and utoipa-swagger-ui to 9.0.0.

The utoipa changes were pretty far-reaching as well. I had to make a minor modification to the smart filter generation macro and implement ToSchema for a good number of structures because utoipa now requires all nested structs to also implement ToSchema. The aliases attribute was also removed, so those types are now represented by pub types. Finally, because of changes to utoipa, it is now possible to cause stack overflows by having loops in the dependency graph for a struct/enum. To solve this, I added #[schema(no_recursion)] annotations to several fields. It would be a good idea for someone to review the API documentation and make sure it still feels sensible in light of these changes.

@JMicheli
Copy link
Collaborator Author

JMicheli commented Mar 5, 2025

Didn't realize that is_none_or was experimental in Stump's MSRV. I'll revert those changes later today.

Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 14.68927% with 151 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/server/src/routers/api/v1/library.rs 0.00% 16 Missing ⚠️
apps/server/src/routers/api/v1/media/individual.rs 0.00% 16 Missing ⚠️
apps/server/src/routers/api/v1/book_club.rs 0.00% 13 Missing ⚠️
apps/server/src/routers/api/v1/smart_list.rs 0.00% 13 Missing ⚠️
apps/server/src/routers/api/v1/user.rs 0.00% 11 Missing ⚠️
apps/server/src/routers/api/v1/emailer.rs 0.00% 10 Missing ⚠️
apps/server/src/routers/api/v1/series.rs 0.00% 10 Missing ⚠️
apps/server/src/routers/opds/v2_0.rs 0.00% 7 Missing ⚠️
apps/server/src/routers/api/v1/notifier.rs 0.00% 6 Missing ⚠️
apps/server/src/routers/api/v1/upload.rs 0.00% 6 Missing ⚠️
... and 19 more
Files with missing lines Coverage Δ
apps/server/src/errors.rs 26.00% <ø> (+0.49%) ⬆️
apps/server/src/filter/basic_filter.rs 48.81% <100.00%> (ø)
apps/server/src/http_server.rs 5.81% <100.00%> (-0.29%) ⬇️
apps/server/src/middleware/auth.rs 91.90% <100.00%> (-1.61%) ⬇️
apps/server/src/middleware/host.rs 58.18% <ø> (+17.27%) ⬆️
apps/server/src/routers/api/v1/filesystem.rs 0.00% <ø> (ø)
apps/server/src/routers/api/v1/media/bulk.rs 0.00% <ø> (ø)
apps/server/src/routers/utoipa.rs 0.00% <ø> (ø)
core/src/db/entity/book_club/club.rs 0.00% <ø> (ø)
core/src/db/entity/book_club/schedule.rs 0.00% <ø> (ø)
... and 45 more

... and 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aaronleopold aaronleopold changed the title Jm/upgrade axum ⬆️ Upgrade axum and related dependencies Mar 6, 2025
Copy link
Collaborator

@aaronleopold aaronleopold left a comment

Choose a reason for hiding this comment

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

I gave this a good look over lunch and don't see any issues. I was curious what changed that made it so we couldn't use extractors in middleware, like HostExtractor, but didn't have time to look in the changelog for hints. Not a biggie either way.

Thanks for knocking this out! Feel free to merge whenever

@aaronleopold
Copy link
Collaborator

Also:

Didn't realize that is_none_or was experimental in Stump's MSRV. I'll revert those changes later today

We can probably bump that after this whenever

@JMicheli
Copy link
Collaborator Author

JMicheli commented Mar 6, 2025

I gave this a good look over lunch and don't see any issues. I was curious what changed that made it so we couldn't use extractors in middleware, like HostExtractor, but didn't have time to look in the changelog for hints. Not a biggie either way.

Seems to be related to this issue: tokio-rs/axum#3170

I'll spend a bit investigating to see if there's a better solution before merging.

@JMicheli
Copy link
Collaborator Author

JMicheli commented Mar 7, 2025

Well, there isn't really a good explanation for why I changed it to not use HostExtractor in the function signature. I reverted my changes and redid auth.rs and came to this much simpler diff. I'm glad you pointed that out.

@JMicheli JMicheli merged commit a34a745 into experimental Mar 7, 2025
9 checks passed
@JMicheli JMicheli deleted the jm/upgrade-axum branch March 7, 2025 14:45
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.

2 participants