Migrate from Trillium [part 7B]: aggregators and tasks#2246
Merged
Conversation
Migrate all aggregator and task routes from Trillium to Axum. These are
the "hard handlers" — they make outbound HTTP calls to DAP aggregator
services via trillium_client::Client.
Notable changes:
- Split aggregators::index into index_shared (GET /api/aggregators) and
index_for_account (GET /api/accounts/{id}/aggregators) instead of
checking conn.param("account_id") at runtime
- admin_create checks actor.is_admin() inline, returns NotFound for
non-admins (matching existing behavior of hiding admin endpoints)
- tasks::delete uses Query<DeleteParams> instead of QueryStrong for the
?force=true parameter
- tasks::show uses httpdate for Last-Modified header
That change to the `force` query makes it strict: before, any unparseable value
(e.g. ?force=garbage, ?force=) silently became false, while now if it's not a bool,
serde is going to error it out. I think that's an improvement, but I want to call
it out.
The Trillium router now contains only admin routes. All Trillium handler
functions for aggregators and tasks are removed. Test assertions updated
from assert_not_found to assert_response 403 for routes that now go
through the Axum extract_entity / FromRequestParts path.
jcjones
commented
May 7, 2026
Comment on lines
+157
to
+159
| if !actor.is_admin() { | ||
| return Err(Error::NotFound); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Here I'm following the model above of inline checking is_admin, but in 7C I am going to create a thin AdminPermissionsActor newtype extractor that wraps PermissionsActor, checks is_admin()and returns Error::NotFound on failure. The handlers then will just extract AdminPermissionsActor instead of PermissionsActor.
Contributor
Author
There was a problem hiding this comment.
I actually decided that was brittle while mucking with it, and the correct way to do this was a route_layer, which you can see here: https://github.com/divviup/divviup-api/pull/2247/changes#diff-2f935612004a95b0b20ea32f896554a8d594d2fd9faa19319e37470a9ff34689R56
tgeoghegan
approved these changes
May 7, 2026
Contributor
tgeoghegan
left a comment
There was a problem hiding this comment.
I don't think I have any blocking remarks.
divergentdave
approved these changes
May 7, 2026
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.
Migrate all aggregator and task routes from Trillium to Axum. These are the "hard handlers" -- they make outbound HTTP calls to DAP aggregator services via
trillium_client::Client.Notable changes:
aggregators::indexintoindex_shared(GET /api/aggregators) andindex_for_account(GET /api/accounts/{id}/aggregators) instead of checkingconn.param("account_id")at runtime, to make it more, uh, Axum-ish.admin_createchecksactor.is_admin()inline now, and returns NotFound for non-admins (matching existing behavior of hiding admin endpoints). This is somewhat a difference of how we work with middleware in Axum.tasks::deleteusesQuery<DeleteParams>instead ofQueryStrongfor the?force=trueparametertasks::showuseshttpdatefor theLast-Modifiedheader to match part 7A.That change to the
forcequery makes it strict: before, any unparseable value (e.g.?force=strong_with_this_one,?force=) silently became false, while now if it's not a bool, serde is going to error it out. I think that's an improvement, but I want to call it out.The Trillium router now contains only admin routes. All Trillium handler functions for aggregators and tasks are removed. Test assertions updated from
assert_not_foundtoassert_response 403for routes that now go through the Axumextract_entity/FromRequestPartspath.