/design in production builds, for server administrators only #952

Closed
opened 2026-09-30 05:47:15 +00:00 by claude-bot · 1 comment
Collaborator

Why: lane 0's review item is the /design reference page, which shows 35 components in 160 states. But it is only mounted in development builds (App.jsx: import.meta.env.DEV ? lazy(...) : null), and dev runs the production image, so the owner can't review it there. The owner chose (2026-09-30) to ship it in production builds, visible only to server administrators.

Approach:

  • Always mount the route, lazily loaded, so it adds nothing to the main bundle.
  • Guard it with the app's existing administrator check. A non-admin gets the same "not here" page as any unknown address, not a "forbidden" page, so nothing hints that it exists.
  • Check that nothing the page imports is dev-only (fixtures, mocks), and that the prod CSP allows everything it draws.
  • Add no link to it from Admin for now. The owner can decide later whether Admin should point at it.

Done when:

  • An admin can open /design on a production build.
  • A signed-in non-admin and a signed-out visitor both get "not here".
  • Tests cover all three.
**Why:** lane 0's review item is the `/design` reference page, which shows 35 components in 160 states. But it is only mounted in development builds (`App.jsx`: `import.meta.env.DEV ? lazy(...) : null`), and dev runs the production image, so the owner can't review it there. The owner chose (2026-09-30) to ship it in production builds, visible only to server administrators. **Approach:** - Always mount the route, lazily loaded, so it adds nothing to the main bundle. - Guard it with the app's existing administrator check. A non-admin gets the same "not here" page as any unknown address, not a "forbidden" page, so nothing hints that it exists. - Check that nothing the page imports is dev-only (fixtures, mocks), and that the prod CSP allows everything it draws. - Add no link to it from Admin for now. The owner can decide later whether Admin should point at it. **Done when:** - An admin can open `/design` on a production build. - A signed-in non-admin and a signed-out visitor both get "not here". - Tests cover all three.
Author
Collaborator

Done in #953 (merged 2026-09-30, green CI).

Access: /design is always mounted (lazy, as its own 73 kB chunk) and guarded by DesignAccess:

  • open to anyone in a dev build;
  • in production, administrators only, with everyone else getting the ordinary not-found page;
  • a render check of the production-built e2e stack confirmed a non-admin and a signed-out visitor see exactly /nope's page, with no CSP or console errors.

Fixed along the way:

  • the stale "Dev only." line;
  • a 41 px phone overflow, where phone-width demo frames now scroll inside their own box;
  • after #960, phone-state boxes are also the app container, so container-query phone forms show on the page.
Done in #953 (merged 2026-09-30, green CI). **Access:** `/design` is always mounted (lazy, as its own 73 kB chunk) and guarded by `DesignAccess`: - open to anyone in a dev build; - in production, administrators only, with everyone else getting the ordinary not-found page; - a render check of the production-built e2e stack confirmed a non-admin and a signed-out visitor see exactly `/nope`'s page, with no CSP or console errors. **Fixed along the way:** - the stale "Dev only." line; - a 41 px phone overflow, where phone-width demo frames now scroll inside their own box; - after #960, phone-state boxes are also the `app` container, so container-query phone forms show on the page.
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
rbrooks/Quest-Board#952
No description provided.