@@ -154,12 +154,12 @@ describe("RBAC fallback — branch header guards", () => {
154154 expect ( result . error ) . toContain ( "preview and dev" ) ;
155155 } ) ;
156156
157- // Documents a known collision from overloading the "default" sentinel across
158- // preview + dev: a PREVIEW branch literally named "default" can't be reached
159- // through this path — the sentinel short-circuits the pivot and resolves the
160- // preview parent instead . (Preview branch names are normally PR refs, so this
161- // is an accepted edge case rather than a supported one .)
162- postgresTest ( "preview + 'default' resolves the parent, not a branch named 'default'" , async ( {
157+ // The "default" sentinel is DEVELOPMENT-only: it maps the dev root env to its
158+ // (branchless) self. For PREVIEW, "default" is an ordinary branch name, so a
159+ // PREVIEW branch literally named "default" is reachable and the request pivots
160+ // to it like any other branch . (Preview branch names are normally PR refs, so
161+ // a branch named "default" is unusual — but it's supported, not a collision .)
162+ postgresTest ( "preview + 'default' pivots to the branch named 'default' (sentinel is dev-only) " , async ( {
163163 prisma,
164164 } ) => {
165165 const { organization, project } = await createTestOrgProjectWithMember ( prisma ) ;
@@ -179,8 +179,9 @@ describe("RBAC fallback — branch header guards", () => {
179179
180180 expect ( result . ok ) . toBe ( true ) ;
181181 if ( ! result . ok ) return ;
182- // Resolves the parent, NOT the branch literally named "default".
183- expect ( result . environment . id ) . toBe ( previewParent . id ) ;
184- expect ( result . environment . id ) . not . toBe ( previewDefaultBranch . id ) ;
182+ // Pivots to the branch named "default", carrying the parent's api key.
183+ expect ( result . environment . id ) . toBe ( previewDefaultBranch . id ) ;
184+ expect ( result . environment . id ) . not . toBe ( previewParent . id ) ;
185+ expect ( result . environment . apiKey ) . toBe ( previewParent . apiKey ) ;
185186 } ) ;
186187} ) ;
0 commit comments