Skip to content

Render the PolicyEngine site shell on /uk/chat - #240

Merged
vahid-ahmadi merged 1 commit into
mainfrom
fix/render-site-shell
Aug 11, 2026
Merged

vahid-ahmadi merged 1 commit into
mainfrom
fix/render-site-shell

Conversation

@vahid-ahmadi

Copy link
Copy Markdown
Collaborator

Fixes #239.

/uk/chat is served on policyengine.org through a multizone rewrite, which does not inject the parent app's header into this response. Since PolicyEngine/policyengine-app-v2#1148 emptied SHELL_BRAND_EXEMPT_SOURCES, every zone child renders the shell itself — and the audit was failing here with PolicyEngine brand missing from top shell, blocking PolicyEngine/policyengine-app-v2#1073.

What this does

  • Adds SiteHeader with the wordmark and the Research, Model, API and Donate links the audit asserts appear within the top 140px. Links are absolute to policyengine.org so they resolve from the standalone deployment too, where /uk/* belongs to the chat rather than the website.
  • Mounts it in the root layout rather than ChatPage, so it is in the server-rendered HTML — ChatPage is loaded with ssr: false.
  • Publishes the header height as --pe-shell-h. The chat is a full-height layout, so without this the composer is pushed below the fold: the five full-height panes become calc(100dvh - var(--pe-shell-h)) and the two sticky sidebars anchor at that offset instead of 0.
  • Skips the header for embedded copies (?embed), which already sit inside another page's chrome, and drops --pe-shell-h to 0px so the layout is unchanged there.

Verification

Ran the actual audit script from policyengine-app-v2 against a local production build:

OK /uk/chat
    PolicyEngine shell present
1/1 enforced app-zone routes have the PolicyEngine shell.

Also confirmed ?embed renders no header and reports --pe-shell-h: 0px.

Frontend tests pass (43) and npm run build succeeds. tsc --noEmit reports the same 16 pre-existing errors in backend-url.test.ts before and after — none from this change.

/uk/chat is served on policyengine.org through a multizone rewrite, which
does not inject the parent app's header into this response. Since
PolicyEngine/policyengine-app-v2#1148 every zone child renders the shell
itself, and the app-zone-shell-audit failed here with "PolicyEngine brand
missing from top shell", blocking the beta launch PR.

Adds a SiteHeader with the wordmark and the Research, Model, API and
Donate links the audit asserts are present in the top 140px. It lives in
the root layout rather than ChatPage so it is in the server-rendered HTML
— ChatPage is loaded with ssr: false.

The chat is a full-height layout, so the header would otherwise push the
composer below the fold. Its height is published as --pe-shell-h; the
full-height panes are now calc(100dvh - var(--pe-shell-h)) and the sticky
sidebars anchor at that offset instead of 0. Embedded copies (?embed)
already sit inside another page's chrome, so the header is skipped there
and --pe-shell-h drops to 0px.

Fixes #239

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
policyengine-uk-chat Ready Ready Preview Aug 11, 2026 10:55am

Request Review

@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Beta preview has been cleaned up because this PR was closed.

@codecov

codecov Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.81%. Comparing base (156e8b3) to head (c02c4a2).

Files with missing lines Patch % Lines
frontend/src/components/SiteHeader.tsx 0.00% 12 Missing ⚠️
frontend/src/app/ChatPage.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #240      +/-   ##
==========================================
- Coverage   62.92%   62.81%   -0.12%     
==========================================
  Files         100      101       +1     
  Lines        6579     6591      +12     
  Branches     1313     1315       +2     
==========================================
  Hits         4140     4140              
- Misses       2166     2178      +12     
  Partials      273      273              
Flag Coverage Δ
backend 81.69% <ø> (ø)
frontend 8.99% <0.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
frontend/src/app/layout.tsx 0.00% <ø> (ø)
frontend/src/app/ChatPage.tsx 0.00% <0.00%> (ø)
frontend/src/components/SiteHeader.tsx 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vahid-ahmadi
vahid-ahmadi merged commit c14aca4 into main Aug 11, 2026
9 checks passed
@anth-volk
anth-volk deleted the fix/render-site-shell branch August 11, 2026 13:05

This branch was successfully deployed

1 active deployment
Preview — c02c4a24 Deployed Aug 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render the PolicyEngine site shell on /uk/chat

1 participant