From bb00c7173096d4534740b37ff1b5567a09e28bde Mon Sep 17 00:00:00 2001 From: Lucas Berger Date: Sat, 13 Jun 2026 14:23:09 -0400 Subject: [PATCH] feat(10-01): seed dev-bypass user id=1 as is_admin=true in e2e global-setup - INSERT INTO users (id=1, is_admin=true) ON DUPLICATE KEY UPDATE is_admin=true (idempotent) - Supplies placeholder non-null oidc_iss='dev-bypass', oidc_sub='dev-user-1', color='#4A90D9' - requireAdmin (Plan 02) does a DB lookup for the bypass user; without this seed it would 403 - Existing calendar/event/list seeds unchanged (INSERT IGNORE INTO calendars, Seeded Test Event) --- apps/pwa/e2e/global-setup.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/pwa/e2e/global-setup.ts b/apps/pwa/e2e/global-setup.ts index 5cbb139..e1cc78d 100644 --- a/apps/pwa/e2e/global-setup.ts +++ b/apps/pwa/e2e/global-setup.ts @@ -109,6 +109,18 @@ export default async function globalSetup(): Promise { await conn.execute('TRUNCATE TABLE calendar_events'); await conn.execute('SET FOREIGN_KEY_CHECKS=1'); + // Seed the dev-bypass admin user row for id=1 (D-01 dev note, Phase 10). + // DEV_USER (id=1) is injected by devBypass.ts WITHOUT a DB upsert, so the users table + // has no row for id=1 by default. requireAdmin (Plan 02) does a DB lookup and would 403 + // the bypass admin UI locally and in e2e. This idempotent seed ensures is_admin=true for + // id=1 so admin-UI verification works under DEV_AUTH_BYPASS=true. + // oidc_iss/oidc_sub are placeholder non-null values — the bypass path never reads them. + await conn.execute( + `INSERT INTO users (id, oidc_iss, oidc_sub, display_name, color, is_admin) + VALUES (1, 'dev-bypass', 'dev-user-1', 'Dev User', '#4A90D9', true) + ON DUPLICATE KEY UPDATE is_admin=true`, + ); + // CI guard (Pitfall 4): ensure calendar row id=10 exists before inserting events. // INSERT IGNORE is a no-op if the row already exists (dev DB), creates it if not (CI fresh DB). await conn.execute(