test(web): dashboard standalone source assertion is stale #414

Closed
opened 2026-06-04 07:46:38 +00:00 by simon · 1 comment
Owner

While validating the read-only authorization fix, I ran pnpm --filter web test:unit and found an unrelated failure in apps/web/lib/actions/dashboard-standalone.test.mjs.\n\nFailure:\n- Test: fresh standalone sessions promote the first active user to instance admin\n- Expected source pattern: activeUsers[0]?.id !== user.id\n- Current implementation in apps/web/lib/auth/session.ts uses firstAssignedRoleUser?.id !== user.id after finding the first active assigned-role user.\n\nWhy it matters:\n- The full web unit command exits non-zero even though the implementation appears to have intentionally changed shape.\n- This can hide real regressions when engineers run the full unit suite locally.\n\nSuggested fix:\n- Update the source-level assertion to match the current implementation intent, or replace it with a behavior-focused test for the standalone first-admin promotion flow.

While validating the read-only authorization fix, I ran `pnpm --filter web test:unit` and found an unrelated failure in `apps/web/lib/actions/dashboard-standalone.test.mjs`.\n\nFailure:\n- Test: `fresh standalone sessions promote the first active user to instance admin`\n- Expected source pattern: `activeUsers[0]?.id !== user.id`\n- Current implementation in `apps/web/lib/auth/session.ts` uses `firstAssignedRoleUser?.id !== user.id` after finding the first active assigned-role user.\n\nWhy it matters:\n- The full web unit command exits non-zero even though the implementation appears to have intentionally changed shape.\n- This can hide real regressions when engineers run the full unit suite locally.\n\nSuggested fix:\n- Update the source-level assertion to match the current implementation intent, or replace it with a behavior-focused test for the standalone first-admin promotion flow.
Author
Owner

Already resolved on main. The stale assertion now matches the current implementation: apps/web/lib/actions/dashboard-standalone.test.mjs asserts firstAssignedRoleUser?.id !== user.id, and apps/web/lib/auth/session.ts uses that same first-assigned-role-user guard. Verified with: pnpm --filter web exec node --experimental-strip-types --test lib/actions/dashboard-standalone.test.mjs (29/29 passing).

Already resolved on main. The stale assertion now matches the current implementation: apps/web/lib/actions/dashboard-standalone.test.mjs asserts firstAssignedRoleUser?.id !== user.id, and apps/web/lib/auth/session.ts uses that same first-assigned-role-user guard. Verified with: pnpm --filter web exec node --experimental-strip-types --test lib/actions/dashboard-standalone.test.mjs (29/29 passing).
simon closed this issue 2026-06-14 14:21:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carrtech/ct-ops#414
No description provided.