fix(permissions): pending grant domains — plan/apply with same-run-created group types - #70
Merged
Merged
Conversation
…eated group types (#69) A group_type_role domain declared by reference (groupType: "struktur") to a group type in the same run's create-set no longer hard-aborts the plan. Instead it plans as a pending domain (domainId: null + pendingDomain Ref, grants in toPut) rendered `<group-type:x (created this apply)>`, counted in --json / --detailed-exitcode, and re-resolved against post-execute state at apply time — reusing the resource pending-ref machinery (reresolvePendingValue). One ct apply run converges. The hard error remains only for genuinely unresolvable refs. group_role stays a hard error (its pairing domainId needs a live fetch, not a state lookup) — documented + regression-tested. Closes #69
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.
Closes #69
Problem
A permission domain declared by reference —
ct.groupTypeRole({ groupType: "struktur", grants: [...] })— to a group type that is part of the same run's create-set hard-aborted the entire plan:This made fresh-instance rehearsal (#23) and the plan-both-envs CI check (#24) impossible: a valid, prod-no-op config could not even be planned against an empty env.
Fix
Give permission domains the same pending-ref treatment resources already have (#20/#46):
domainId: null,pendingDomainRef) instead of aborting. Its grants land indiff.toPut, it renders as<group-type:struktur (created this apply)>(consistent with resource pending-ref rendering), and it counts towardhasChanges/ exit code2/ the--jsonsummary. No live grants are fetched for a not-yet-created domain.executePlan→ thenapplyPermissionPlan(items, client, state)with post-execute state). The pending domain id is re-resolved from the fresh group type using the existingreresolvePendingValuemachinery — not forked. Onect applyconverges fully.notFoundmessage.group_role symmetry (checked & reported)
group_roleis deliberately not made symmetric. Its domainId is the (group, role) pairing id, which lives only onGET /groups/{groupId}/roles— re-resolving it needs a live fetch after the group exists, not a post-execute state lookup. So agroup_roledomain on a same-run-created group still fails fast atgroupIdForRolewith its own actionable message (unchanged). Documented indocs/permissions.mdand locked with a regression test. Deferring it properly is a larger, separate change out of #69's scope (#23 is agroup_type_rolescenario).Tests
New
tests/permission-pending-domain.test.ts(6 tests) covering the #23 scenario end-to-end with a mocked client:Verification
No live instance contacted.