-
Notifications
You must be signed in to change notification settings - Fork 67
Allow implementations of AuthorizedResource::load_roles to use async fn syntax. #9693
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
base: main
Are you sure you want to change the base?
Conversation
Created using jj-spr 0.1.0
|
This makes sense to me. Couple of things I wonder while reviewing:
When I was asking LLMs these questions, they suggested based on the diff alone that this change might be a problem if we use edit: not true that RPITIT lets this work, see below
|
|
It seems there are presently a bunch of places where the |
|
Regarding @david-crespo's question,
My guess is that it wasn't done this way before because return position |
Created using jj-spr 0.1.0
|
@david-crespo, regarding:
did whichever LLM claimed this actually provide any reference for that claim? I don't believe this is correct at all. I haven't been able to find any source suggesting that this is the current semantics of RPITIT --- only blog posts discussing how a feature like that could be added in the future. I went and checked in the Rust playground and, indeed, this does not compile: Any return-position |
|
I don't actually think we do use omicron/nexus/db-queries/src/policy_test/resource_builder.rs Lines 177 to 245 in 3d94f95
This was the case prior to @mergeconflict's change, too. |
I sure hope not.
What Eliza said. I updated the PR description with motivation/background.
Yeah I messed around with this a bit to try and understand what we could get away with... To be honest I'm still not sure I get it. I'm also not sure if it's worth merging this, or if this is the beginning of a much larger yak shave (migrating other uses of |
|
It did not provide a source, and it did sound like an elaborate claim. Sorry for the noise! We do have several mentions of Turns out the answer is |
|
The LLM response is ... sort of directionally correct, but it's also wrong. If one explicitly places The thing the LLM got wrong is the suggestion that any use of RPITIT causes this to happen automagically. |
|
I see now the |

Motivation: I was reviewing some code that added an
impl AuthorizedResource(#9679) and was curious about the'futlifetime and use offutures::BoxFuture. I learned that this is the pre-Rust 1.75 way of writing(async fnor-> impl Futurein a trait).This change enables native
async fnsyntax forAuthorizedResource::load_rolesby replacing dynamic dispatch with associated types.Key changes:
ApiResourceinto two traits:ApiResource- object-safe base trait with all existing methods exceptparent().ApiResourceWithParent- extendsApiResource, adds associated typeParentandparent()method. We use theNoParentuninhabited type for root resources (e.g.Fleet).AuthorizedResource::load_rolessignature:fn load_roles<'fut>(...) -> BoxFuture<'fut, Result<(), Error>>fn load_roles(...) -> impl Future<Output = Result<(), Error>>async fnsyntax directly instead of.boxed(), and no longer need an explicit'futlifetime.authz_resource!macro to generate bothApiResourceandApiResourceWithParentimpls.resource_builder.rs- removed unused import and redundant trait bound.