Skip to content

fix(pages)!: webUrl put a tag segment in a path no site serves - #786

Merged
Ardnived merged 1 commit into
mainfrom
claude/fix-page-weburl-tag-segment
Sep 15, 2026
Merged

Ardnived merged 1 commit into
mainfrom
claude/fix-page-weburl-tag-segment

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Summary

A page tagged wisdom published webUrl: https://…/wisdom/my-article. No site serves that path — not the new one, not the old one. An untagged page worked, which is why this survived: the failure is only visible when a page happens to carry a tag, and tags is optional.

The evidence

Site Page URL shape /wisdom/<slug>?
WeMeditateWeb (new) /<slug> — ROUTE_BUILDERS.pages is '/' + slug, matcher is ^/([^/]+)/?$, sitemap agrees 404 — its own spec pins that a nested path does not match
wemeditate.com (legacy Rails) /articles/<slug>; wisdom is only /inspiration/wisdom, a category index 404, checked against production 2026-09-15

So [locale, tag, slug] matched neither. The path is now [locale, slug].

Changes

  • src/collections/Pages/Pages.ts — drop the tag segment from buildPath.
  • Same file, livePreview.url moves to serverEnv, so an unset base fails at boot rather than interpolating undefined into the panel's URL. The web: base deliberately stays on raw process.env — it runs per read, and that late bind is what lets a spec stub it with vi.stubEnv. It already guards to null, so it cannot produce a broken URL the way the preview builder could. (I switched it first, and six specs went red with http://localhost:5173 — worth knowing before someone "tidies" it again.)
  • tests/int/pages.int.spec.ts — the two cases that pinned the tag segment were asserting the defect, so they invert. Both watched failing first.

Test results

  • pnpm lint, pnpm typecheck, pnpm test:unit (2017) — green
  • pages, pages-localize-status, client-canonical, collections-smoke — 87 passed

Notes for reviewer

Marked ! because webUrl / webPath are a published API surface and a tagged page's value changes shape. It changes from a URL that 404s to one that resolves, so I read this as a fix rather than a break — but it is a live field, and worth a second opinion on whether any consumer had adapted to the old shape. The only in-repo consumers of webPath/webUrl are the atlas sitemap and SEO endpoints, which read regions and events, never pages; a code search across both client repos finds page webUrl unused.

Found while planning the cross-repo live-preview unification. That work composes the live-preview panel URL from this same buildPath, so without this the panel would have landed on those same 404s for every tagged page.

🤖 Generated with Claude Code

`Pages.buildPath` emitted `[locale, tag, slug]`, so a page tagged `wisdom`
published `webUrl: https://…/wisdom/my-article`. Nothing serves that path.

- **WeMeditateWeb** routes a page at exactly one segment. Its builder is
  `ROUTE_BUILDERS.pages = '/' + slug`, its matcher is `^/([^/]+)/?$`, and its
  own spec pins that a nested path does not match. Its sitemap publishes the
  same one-segment shape.
- **The legacy Rails site** does not serve it either. Checked against
  production on 2026-09-15: `/wisdom` is a 404, articles live at
  `/articles/<slug>`, and `wisdom` appears only as `/inspiration/wisdom`, a
  category index.

So a tagged page published a canonical that 404s, while an untagged page
worked — which is why it survived: the failure is invisible unless the page
happens to carry a tag. `tags` is optional, so both shapes are common.

The path is now `[locale, slug]`. The two specs that pinned the tag segment
asserted the defect, so they invert here; both were watched failing first.

`livePreview.url` in the same file moves to `serverEnv`, so an unset base
fails at boot instead of interpolating `undefined`. The `web:` base stays on
raw `process.env` deliberately — it runs per read, and that late bind is what
lets a spec stub it with `vi.stubEnv`; it already guards to `null` rather than
producing a broken URL.

Found while planning the cross-repo live-preview unification: the same
`buildPath` is what the live-preview panel URL will be composed from, so the
panel would have landed on those same 404s.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@railway-app

railway-app Bot commented Sep 15, 2026

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-786 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Sep 15, 2026 at 1:33 am UTC
1 service not affected by this PR
  • mailpit

@Ardnived
Ardnived merged commit 4828665 into main Sep 15, 2026
6 checks passed
@Ardnived
Ardnived deleted the claude/fix-page-weburl-tag-segment branch September 15, 2026 15:10
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 15, 2026

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-786 — be03d5b0 Deployed Sep 15, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant