auth/codegen: multi-role required_roles emits compilable require_any_role guard (conformance T1) - #310
Merged
Conversation
…quired_roles (T1) A multi-role required_roles (e.g. ["admin","editor"]) interpolated into the single-role guidance produced an uncompilable 2-arg require_role/_tenant.require_role call; an agent then narrows authorization to the first role. Add a free require_any_role(actual, allowed) to jerrycan-auth (mirroring Tenant::require_any_role) and, in genroute::guard_comment, emit the any-of form when required_roles.len() > 1. Single-role output is byte-identical.
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.
Docs↔codegen conformance sweep — code-wrong bucket. A multi-element
required_roles(accepted bycheck) madeguard_commentemit an uncompilable single-role call (require_role(&_user.0.role, "admin", "editor")), steering an agent to either a compile error or silently dropping roles (narrowing auth). Adds a freerequire_any_role(actual, &[&str])to jerrycan-auth (mirrors the existingTenant::require_any_role), andguard_commentemits the any-of form when >1 role. Single-role output is byte-identical (585 genroute tests + explicit string-equality assertions). No version bump.