Conversation
Legacy model grants were recopied on every catalog migration, so an explicitly revoked offering became visible again after reload. Copy legacy grants only while creating a new offering and cover the revoke-then-reload path.
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.
Summary
Preserve explicit model-offering access revocations across catalog reloads.
Root cause
GET /api/host/model-offeringscallsmigrateLegacyModelOfferings(). The migration copied matching rows fromhost_model_entitlementintohost_model_offering_entitlementon every invocation, including for offerings that already existed.If an administrator removed an offering entitlement while a matching legacy wildcard grant remained, the next catalog request recreated the removed entitlement. The UI therefore reported a successful save, but a reload widened access again.
Proposed fix
Copy legacy grants only when the migration creates a new offering. Existing offerings then use their current offering-level entitlements as the source of truth, so later administrator changes are preserved.
This keeps the initial legacy migration behavior while making repeated migration calls genuinely idempotent with respect to explicit revocations.
Regression coverage
The integration test now verifies this sequence:
Validation
pnpm exec vitest run packages/backend/src/identity/roles-model-offerings.integration.test.tspnpm exec vp check packages/backend/src/identity/identity.ts packages/backend/src/identity/roles-model-offerings.integration.test.tspnpm run slop-check