Skip to content

Commit dabcc2c

Browse files
committed
test(desktop): do not credit inherited coverage across a layout's early return
Ancestor resolution is static, so it credits any file under a layout that mentions a lane-aware shell. That is wrong when the layout returns the surface *instead of* its chrome: `workspace/[workspaceId]/layout.tsx` returns `<WorkspaceAccessDenied />` at the top and only reaches `<WorkspaceChrome>` far below, so at runtime the denied page has no chrome at all. The page does reserve the lane today, but a regression would have read as inherited and passed. `SessionExpired` is deliberately not listed: it renders as a sibling within the chrome tree, so its inherited coverage is real. The distinction is which side of the early return the surface sits on, not which directory it lives in. Verified by reverting the access-denied page exactly as described — it now fails.
1 parent 163b184 commit dabcc2c

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

apps/sim/app/_shell/desktop-title-bar-surfaces.test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,22 @@ const LANE_EXEMPT_PREFIXES: Record<string, string> = {
221221
const isExempt = (file: string) =>
222222
file in LANE_EXEMPT || Object.keys(LANE_EXEMPT_PREFIXES).some((prefix) => file.startsWith(prefix))
223223

224+
/**
225+
* Surfaces a layout returns *instead of* its lane-aware chrome, not inside it.
226+
*
227+
* Ancestor resolution is static, so it credits any file under a layout that mentions a
228+
* lane-aware shell. That is wrong for an early return: `workspace/[workspaceId]/layout.tsx`
229+
* returns `<WorkspaceAccessDenied />` at the top and only reaches `<WorkspaceChrome>` much
230+
* later, so at runtime the denied page has no chrome and must reserve for itself. Without
231+
* this, a regression there would read as inherited and pass.
232+
*
233+
* `SessionExpired` is deliberately absent: it renders as a sibling *within* the chrome
234+
* tree, so its inherited coverage is real.
235+
*/
236+
const SELF_RESERVE_REQUIRED = new Set([
237+
'app/workspace/[workspaceId]/components/workspace-access-denied.tsx',
238+
])
239+
224240
/** Every file under `app/`, so ancestor layouts can be resolved without extra fs calls. */
225241
const ALL_APP_FILES = new Set(
226242
readdirSync(new URL('../', import.meta.url), { recursive: true, encoding: 'utf8' }).map(
@@ -254,7 +270,9 @@ function viewportRoots() {
254270
file,
255271
fillsViewport: FILLS_VIEWPORT.test(source),
256272
self: reservesLane(source),
257-
inherited: ancestorLayouts(file).some((l) => reservesLane(sourceOf(l))),
273+
inherited:
274+
!SELF_RESERVE_REQUIRED.has(file) &&
275+
ancestorLayouts(file).some((l) => reservesLane(sourceOf(l))),
258276
}
259277
})
260278
.filter((r) => r.fillsViewport)

0 commit comments

Comments
 (0)