Skip to content

feat(api_v2): import landing's feature-route pages into the estate (#3256) - #3716

Open
IsaiahSama wants to merge 6 commits into
v2-rewritefrom
worktree-3256-feature-route-records
Open

IsaiahSama wants to merge 6 commits into
v2-rewritefrom
worktree-3256-feature-route-records

Conversation

@IsaiahSama

@IsaiahSama IsaiahSama commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Part of #3256 (step 1 of the steps comment).

What

api_v2's estate snapshot held only landing's .md pages. Landing builds three more pages from code, and none of them had an api_v2 record:

  • /bank-holiday-calendar (work-employment);
  • /health-and-emergency-services/find-an-emergency-shelter;
  • /health-and-emergency-services/water-outages.

So they're missing from api_v2-driven category listings today (sandbox), and from search, the sitemap and GET /catalog once those stop adding the static registry pages. #3604 lists this as something the API_V2_URL switch-on (alpha-infra#801) waits for.

build-seed-data.ts now writes a page from the META in every -meta.ts under apps/landing/src/routes, and estate.json gains the three pages (125 → 128).

How

  • Fields. Each page takes from its META:

    • url, title and description;
    • its category (subcategory ?? category);
    • frontmatter.keywords, which api_v2 search reads from there;
    • its visibility (default public).

    It has no parent, form or publish date.

  • content_slug is the META url. That is landing's registry slug for a feature page and the service_status key, so the import's visibility overlay still applies.

  • The body is empty. Landing renders these pages from their own routes, which take precedence over the $ catch-all, so it never shows the body. The public chat assistant's api_v2 ingest (apps/chat/src/ingest/api-v2-source.ts) chunks every /catalog page's body, though, so any text there becomes a source chat cites. An earlier version of this PR carried an editor note there; review caught it reaching chat, and the decision on the issue changed to an empty body. Chat now ingests only the title and description.

  • require() with one lint-disable comment. tsx runs this script as CommonJS, and top-level await import() fails with "Top-level await is currently not supported with the cjs output format". The -meta.ts files have only type-only imports.

  • A local FeatureMeta type. The script copies from landing rather than importing from it, as with NESTED_WITHOUT_URL.

Left out: the StormReady checklist (.tsx). routes/$.tsx does v2Page ?? findPage(splat), so an api_v2 row at its url would take precedence over the self-rendered page. It waits on #3239.

Landing's render parity test is unchanged. apps/landing/src/lib/api-v2-render-parity.test.tsx (#3135) requires every seeded page to render the same HTML as its static twin. With an empty body, these three do, so the test now checks them too. (The note version needed an exemption list there; this version reverts it.)

Not in this PR

Checks

On the final version:

  • seed.test.ts: a new case checks each page's category, parent, form id, visibility, content_slug, keywords and empty body. It failed before the script change, fails when the feature pages are left out of the snapshot, and fails when they're forced to draft. The existing per-page test also seeds a database and serves the three pages under their categories.
  • Full nx run api_v2:test: 44 files, 1068 tests pass.
  • Full nx run landing:test: 93 files, 1557 tests pass, with the parity test at its base version.
  • eslint and prettier are clean on every changed file. Running pnpm seed-data again changes nothing.

On the first version (the note body), not re-run since; CI covers them:

  • nx run editor_v2:test, which also reads estate.json: 224 files, 2040 tests pass.
  • api_v2:lint, tsc -p apps/api_v2/tsconfig.check.json, api_v2:build and pnpm exec tsc -b are clean.
  • Local smoke: api_v2 with SEED=true on a throwaway database.
    • GET /catalog lists all three as public.
    • /categories/work-employment lists the calendar, and /categories/health-and-emergency-services lists the other two.
    • /search/documents carries their keywords.
    • GET /pages?url=/bank-holiday-calendar returns 200.

Closes doesn't take effect on a v2-rewrite PR, and #3256 stays open for step 2 and the checklist anyway.

🤖 Generated with Claude Code

IsaiahSama and others added 2 commits November 13, 2026 15:44
…3256)

The estate snapshot held only landing's .md pages, so the bank holiday
calendar, Find an emergency shelter and water outages (-meta.ts routes)
had no api_v2 record and dropped out of api_v2-driven category listings,
search, the sitemap and GET /catalog.

build-seed-data.ts now writes a page for every -meta.ts under
apps/landing/src/routes from its META: url, title, description,
category, keywords and visibility, with content_slug set to the META url
so the import's service_status overlay still applies. Landing renders
these pages from their own routes, so the body is a fixed note telling
editors only the listing fields are used. META is loaded with require()
because tsx runs the script as CommonJS, where top-level await import()
fails.

The StormReady checklist (.tsx) is left out until #3239 decides what it
becomes: an api_v2 row at its url would take precedence over the
self-rendered page in landing's catch-all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@IsaiahSama IsaiahSama added enhancement New feature or request area:backend Backend area (API, server, packages) subsystem:migrations Database migrations and seed SQL v2-rewrite Work for the v2-rewrite branch (api_v2, editor_v2); tracked on project 28 labels Nov 13, 2026
@IsaiahSama IsaiahSama self-assigned this Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Amplify PR previews

App Status URL
forms ⏭ Not affected —
landing ✅ Ready https://worktree-3256-feature-route-records.d3kbl8o0ovutw4.amplifyapp.com
chat ⏭ Not affected —
form-builder ⏭ Not affected —
analytics ⏭ Not affected —

Commit: a7bbb07 · Branches auto-delete when this PR closes.

ℹ️ feature-flagging uses a single shared preview slot at a fixed URL (preview.feature-flagging.sandbox.alpha.gov.bb) — GitHub login works, but only one FF preview exists at a time (the most recent FF PR build wins). It reads/writes sandbox flag data.

IsaiahSama and others added 4 commits November 13, 2026 16:05
#3256)

The render parity test (#3135) renders every seeded page through
fromApiV2 and requires the same HTML as its static twin. The three
feature-route pages now in the estate carry a note for editors as their
body, while their static twins have none, so the HTML differs on purpose:
landing serves these pages from their own routes and never renders that
body.

RENDERED_BY_ROUTE lists them. They skip the HTML comparison but keep the
field comparison, and the test fails if a listed page's static twin gains
markdown, so the list can't hide a page the catch-all renders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The public chat assistant's api_v2 ingest chunks the body_markdown of
every /catalog page, so the editor note in these three bodies would have
become a source chat cites to the public, and its claim that only the
listing fields are used would have been untrue. With an empty body chat
ingests only the title and description, which is what it should get for
pages landing renders from code.

An empty body also renders the same as each page's static twin, so
landing's render parity test passes unchanged and its RENDERED_BY_ROUTE
exemption is reverted: the test now checks these pages' HTML too.

The seed test also asserts the pages are public; forcing them to draft
fails all three cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Backend area (API, server, packages) enhancement New feature or request subsystem:migrations Database migrations and seed SQL v2-rewrite Work for the v2-rewrite branch (api_v2, editor_v2); tracked on project 28

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant