feat(reconcile): add Permission and Role kinds, bootstrap only creates missing roles#1737
feat(reconcile): add Permission and Role kinds, bootstrap only creates missing roles#1737rohilsurana wants to merge 18 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 29411290406Coverage increased (+0.5%) to 45.466%Details
Uncovered Changes
Coverage Regressions285 previously-covered lines in 9 files lost coverage.
Coverage Stats
💛 - Coveralls |
|
From the RFC review (#1751), verified on a live sandbox built from this branch: |
|
Checked this against a fresh sandbox built from the current branch, and the exact scenario works: narrowing The review still caught real gaps right next to it, fixed in 2cb94ca:
Kept the differs-only export rather than always exporting predefined roles — the fixes are small, the files stay minimal, and the round-trip rule holds. |
|
Verified the reconciler against the database identity model:
One edge fixed in d555799: slugs flatten |
# Conflicts: # docs/content/docs/reference/cli.mdx
…ns, resetting drift when unlisted
c0dae6a to
44e365a
Compare
Review notes (self-review after an independent pass)Needs a decision — role metadata is wiped on update
Nothing in non-test code reads role Three ways to fix it:
Leaning towards A. Open to input before I implement. Fixed
Nits (not blocking)
|
|
Update on the metadata-wipe item above: The only residual is a metadata key someone sets directly on a platform role outside this |
Stacked on #1731; will rebase onto main once that squash-merges.
What
Two new desired-state kinds for
frontier reconcileandfrontier export, plus a bootstrap behavior change that makes role management through the API stick.Permission kind
A permission is identity only (namespace + name). It is added or deleted, never updated.
appnamespaces) are server-managed: the diff and export ignore them, and spec entries targeting them are rejected.service/resourcenamespace.Role kind
Platform-level roles only. The role name is the identity and never changes. Title, permissions, and scopes are the managed fields. For custom roles, a field that is present in an entry is managed and a field that is omitted keeps its server value. Predefined roles converge to their shipped definitions instead: an entry overrides the fields it lists, an omitted field takes the definition's value, and a predefined role with no entry resets to the definition.
delete: true— so the plan fails loudly on unaccounted roles instead of removing anything by omission.slug,service/resource:verb,service.resource.verb); slugs are canonical.managed_by: frontier-reconcilein metadata for provenance.Bootstrap change: existing roles are left alone
MigrateRolesused to write a role's definition back whenever its permission set drifted. That meant any change made through the API — including this reconciler's — was reverted on the next boot. Now boot creates a role only when it is missing and never updates an existing one. Operators own existing roles; the reconcile flow is the way to change them.The definition-update job boot loses moves to reconcile: when a new frontier version changes a predefined role's definition, the first reconcile run with the new image plans that change for every role the file does not override, and applying it converges the deployment. The same update that used to happen invisibly at every restart now happens once, reviewed. This also means the reconcile CLI image should match the server's release — it carries the definitions the reset converges to.
Why no role renames
An earlier draft allowed renaming predefined roles. Verifying it showed the server resolves predefined roles by name at runtime in 13+ places (org owner constraint checks, group creation, invitation acceptance, service-user creation, admin listings, notifications). Renaming a predefined role would break all of them, so the name is fixed as the identity and only the display title is renameable.
Tests