Repository navigation
feat(api): an enumeration endpoint for sitemaps (/api/atlas/sitemap) - #651
Conversation
GET /api/atlas/sitemap answers every canonical URL the calling client owns, so a consumer can build a sitemap without composing atlas URLs itself. `loc` is the document's own `webUrl` — the identical virtual field /api/atlas/seo returns as `canonical`, read from the identical place — so a sitemap and a page's <link rel="canonical"> cannot name different URLs. A consumer deriving routes from /api/regions + /api/events/geojson would be a second implementation of the URL rule, free to disagree about mount joining and query-vs-path routing, and a sitemap that disagrees is a set of 404s submitted to a crawler on purpose. Ownership is read off the resolved owner map, so the nearest-ancestor rule applies in this direction too: a country-level client's sitemap excludes a city another client owns. Refs #650 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Hand-authored path + AtlasSitemapResponse/AtlasSitemapUrl schemas, since payload-oapi generates nothing for custom endpoints. The description carries the four things a consumer would otherwise guess at and get silently wrong: the nearest-ancestor carve-out, the empty-not-404 answer, the finished-class exclusion, and that this answer is per-client. Unit-covers the pure ownership + shaping rules alongside it, including the subtree a nearer client owns dropping out of the ancestor's list. Refs #650 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Asserts the agreement the ticket is about rather than inspecting it: for every URL the endpoint publishes, /api/atlas/seo is called with that route and its `canonical` compared to `loc`. Run against two owners with different routing shapes (path and query), so the claim covers both URL forms rather than the one the builder is simplest at. Also pins the nearest-ancestor carve-out (a city another client owns drops out of the country-level client's list), the empty-not-404 answer, the exclusion of draft and finished classes, and Vary: Authorization — which is the only thing keeping the edge from serving one client's routes to another. The carve-out case was mutation-checked: relaxing the ownership filter to match every region fails it with the utrecht route present. Refs #650 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Root endpoints are now three, not two; the endpoint catalog, the finished-events table and the origin-enforcement note all enumerate them, so each needed the third. Also records the one thing the endpoint deliberately does not cover: the We Meditate fallback is not a client, so an unowned region belongs to nobody's sitemap. Corrects the custom-endpoint count in the cache plugin to 9 — it read 7 and was already one behind before this branch. Refs #650 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…bility claim Ownership resolution already loads every region's path, so the `regions` read looks redundant and a future optimization is bound to rebuild `loc` from the in-memory paths instead — which would make this the second implementation of the URL rule, the exact thing the endpoint exists to prevent. Says so at the read, and names the test that would catch it. Also corrects "byte-stable body": `generated` moves on every request, so the body never is. The sort makes the URL *list* stable, which is what a consumer should diff. Refs #650 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…temap Payload types `user.id` as `string | number`; the handler asserted `as number` against a numeric `CanonicalOwner.clientId`. `'7' === 7` is false, so a non-numeric id would match no owner and answer "you own nothing" — which is byte-identical to the legitimate empty answer this endpoint is required to give a client with no owned subtree. That is the one failure this endpoint must not have silently: a consumer told it owns nothing publishes an empty sitemap, which is how a site asks to be de-indexed. Converts rather than asserts, and 500s on anything that isn't an integer. Test pins the distinction against the empty-list case beside it. Refs #650 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🚅 Deployed to the SahajCloud-pr-651 environment in sahajcloud
|
Publishing a region with no classes anywhere beneath it was unspecified behaviour that happened to fall one way — no fixture covered it. It is now a decision: regions are curated by hand rather than generated from a geography feed, so an empty one is a place expecting classes shortly, not filler. That is what separates it from the thin-content pattern search engines penalise, where the pages are mass-generated and stay empty. Filtering them would also make a region flicker in and out of the sitemap as its last class expires, which tells a crawler less than a stable URL with an honest lastmod. Adds an owned-but-empty region to the fixture and records the reasoning in the OpenAPI contract, where a consumer will read it. Refs #650 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Two open questions from review are now settled. The We Meditate coverage gap (the "Flagged for a decision" section above) is tracked separately as #652. Unowned regions stay out of every client's sitemap in this PR; that ticket costs the three ways of closing it, including making the fallback a real owner so ownership becomes total. Empty regions are deliberately published, decided against filtering them. Regions here are curated by hand rather than generated from a geography feed, so one with no classes is a place expecting classes shortly — not filler, which is what separates it from the thin-content pattern search engines penalise. Filtering would also make a region flicker in and out of the sitemap as its last class expires, which tells a crawler less than a stable URL with an honest That behaviour was previously unspecified and happened to fall one way — no fixture covered it. |
PR #651 adds `/api/atlas/sitemap` as another root endpoint, so wording that asserted "exactly one" / "the only root endpoint" would have been false the moment either PR merged, whichever went first — and would have collided textually in the same paragraphs. The durable point was never the count: it is that "unpersisted" is not "ownerless", which is what #632 demonstrated by deleting an endpoint whose only claim to being ownerless was that it chose not to store anything. That survives any number of siblings. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
#651 landed `/api/atlas/sitemap` as a third root endpoint while this branch was deleting `contactAdmin`, so both touched the same paragraphs of four docs plus `payload.config.ts` and `responseTypes.ts`. Resolved by taking both sides everywhere: the root-endpoint list keeps `atlas/seo` and `atlas/sitemap` and drops `contact-admin`, and the note about *why* it was dropped ("unpersisted is not ownerless") is kept, now phrased against a third rather than a second endpoint. `responseTypes.ts` is shared by both survivors again, which is its original justification. Verified after resolution: lint, both typechecks, 1497 unit, and 92 integration across this branch's specs plus #651's new sitemap suite. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Cost ~30 minutes of this session. `main` moved under this branch (#651), the PR went CONFLICTING, and GitHub silently stopped scheduling runs — a `pull_request` workflow runs against the merge commit, and a conflicted PR has none. Nothing surfaces that: `gh pr checks` showed only Railway (which kept deploying, since it builds the branch head, not the merge), `gh run list --branch` was empty, and no job appeared failed. It reads exactly like a stuck scheduler, so the instinct is to wait, or to close/reopen the PR — neither of which touches the cause. Documents the one-command diagnostic (`gh pr view <n> --json mergeable,mergeStateStatus`) in AGENTS.md, and puts it as a precondition in the finalize pipeline's CI-watch step, which is where the workflow actually meets it. Two traps recorded with it: a green run can be STALE (it predates `main` moving, so a conflicted PR looks tested — check the run's `head_sha`), and docs conflict far more readily than code, because sibling feature PRs edit the same paragraph of the same rules file even when they share no functions. Hence the advice to write shared rule docs as a criterion rather than a count. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
* refactor(emails): rename the contact-admin send path to user messages The intake is becoming a `user-messages` collection screened by a job, so the email path is named for what it carries rather than for the endpoint that used to own it: - `sendContactAdmin` -> `sendUserMessage` - `ContactAdminEmail` -> `UserMessageEmail` (plus `buildContactDetails` -> `buildUserMessageDetails` and the two exported types) - `ContactAdminContext` -> `UserMessageContext`, relocated out of `endpoints/responseTypes.ts` into the collection that will store it Also corrects the template footer, which promised "nothing about this message is stored; this email is the only record". That was true under #602 and is about to be false — a copy is kept for screening and triage, then purged. What the sender is told about their own data is not bookkeeping trivia, so it changes with the behaviour. `CONTACT_EMAIL` is untouched: it is the public support address, not part of this intake. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(user-messages): async intake with deep spam screening Replaces the synchronous send inside `POST /api/contact-admin` with a persisted collection plus a screening job, applying the shape `ScreenEventSubmissions` established to a second public intake. Intake moves onto the collection seam — API clients create through the built-in `POST /api/user-messages` — which is what earns it the usage plugin's origin enforcement and the write-guard's anti-spam policy instead of hand-rolling both. Screening runs what the request path could not afford: an MX lookup (fail-open), a disposable-list re-check, how many messages this sender sent in the last 24h, and whether this exact body arrived before. Clean messages are emailed and marked `delivered`; the rest are kept as `spam` for triage. The failure story survives async delivery. A send failure marks the row `failed` *before* rethrowing — the job runner gives each task an isolated transactionID, so that write commits and the row is visible immediately, while the throw still earns a retry that re-attempts the send. Access is deliberately tighter than event-submissions: `user-messages` is in RESTRICTED_COLLECTIONS and granted by NO manager role, so reading one takes the admin bypass. `sahaj-atlas-client` holds create only. Two things are duplicated on purpose, both noted in the code: this job owns its copy of `hasMxRecords` (the two intakes stay independent, and the verdict *wording* was never shareable), and `screening.ts` writes its own notes rather than reusing the event-submission ones. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(user-messages): nightly retention sweep Persisting messages was accepted on the understanding that they do not accumulate, so the retention policy ships with the intake rather than being deferred. Delivered messages are deleted after 7 days — short enough to nearly keep #602's "nothing is stored" promise, long enough that the two 24-hour screening windows still have history to count against. That lower bound is the load-bearing part: shorten it past the window and the repeat-sender and duplicate-body checks would silently pass everything. Spam is kept 90 days, because a sender's history is what makes a pattern visible, and `failed` is never swept — it is the one state where deleting the row destroys the only record that a message went undelivered. Runs at 04:00 UTC on the existing `nightly` queue, after the 02:00/03:00 sweeps. Note that `monthly` has no autoRun entry, so a task scheduled there would never fire. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(api)!: replace POST /api/contact-admin with the user-messages intake BREAKING CHANGE: `POST /api/contact-admin` is gone. Clients create through `POST /api/user-messages` instead. Three things move on the wire: - the Turnstile token goes in the `x-turnstile-token` HEADER, not the body (the write-guard reads it there — it is transport metadata, not document data); - the response is Payload's `{ doc, message }` at 201, not `{ ok: true }`; - the machine code moves from `errors[].code` to `errors[].data.code`, which is where Payload's `formatErrors` puts an APIError's `data`. Safe to cut over in one step: the Atlas widget is still pre-release and no third-party host embeds it yet. SahajAtlasWeb needs the matching change. Deletes with it: the `ContactAdmin*` types in `endpoints/responseTypes.ts`, the hand-authored OpenAPI path + schemas, and `antiSpamErrorResponse` — whose only production consumer was that handler. `parseBody`, `checkNoUrls` and `verifyTurnstileOrFail` all have other consumers and stay. `atlas/seo` is now the ONLY root endpoint, so every doc that used contact-admin as the canonical example is re-pointed. `.claude/rules/ endpoints.md` keeps the story rather than erasing it: "stored nowhere and owned by nothing" was true only because the endpoint chose not to store anything, and that is the trap — ask whether a resource is genuinely ownerless or merely unpersisted before reaching for the root. `responseTypes.ts` stays put despite now serving one endpoint; client repos sync it by a stable raw GitHub URL. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * refactor(lib): move antiSpamGuard out of lib/endpoints Its consumers are now the write-guard plugin and the two screening jobs — not a single endpoint, since `contactAdmin` became a collection. Leaving it under `endpoints/` would have made the folder name a lie for the next reader. `requireActiveClient` / `parseBody` / `parseQuery` stay: those are still genuinely endpoint helpers. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore(migrations): add user_messages table and status enum Generated by `db:migrations:create`, unedited. Validated: - `up` is purely additive — 0 DROP statements. The two the validator flags are both in `down`, reversing the new table, which is correct. - The task-slug enums gain their values via `ADD VALUE ... BEFORE`, not the drop-and-recreate that a value *rename* would have produced. - `client_id` / `user_id` are `ON DELETE set null`: deleting a client or a registrant must not destroy the message they relayed or sent. - Indexes land on `sender_email` and `body_hash` — the two columns the screening job's history counts look up by. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * test(user-messages): cover the intake, screening, and retention Three integration lanes plus a unit lane. Three of the assertions were checked by breaking the thing they guard, because each could otherwise pass vacuously: - the field-access tests forge `screeningResult` and `deliveredAt`, not `status` — status is defended twice (field access AND the prepare hook overwrites it), so it cannot isolate the guard. Removing `systemFieldAccess` makes both fail; with it, both stick as stripped. - the intake spec runs `overrideAccess: false` with a real published client. The override the sibling event-submissions spec uses skips field access entirely, so a spec using it could not tell a stripped field from an accepted one. - the retention/window invariant (delivered retention must outlive the screening window, or the history checks count against deleted rows and silently pass everything) fails when the constant is lowered. Two findings recorded rather than papered over: - The screening spec's fixtures originally shared one message body and seven cases failed on the duplicate-body check. That was the check working; `seed()` now varies the body unless a case names one. - `ALLOW_POST_FOR` turns out to be necessary but NOT sufficient: tier 2 hides any path whose collection is in no project, so both public intakes' POSTs are `x-internal`. The test asserts the real behaviour for both, and `.claude/rules/openapi.md` now says what would actually change it. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore(admin): regenerate the import map for UserMessageStatus The status banner is registered as a field `components.Field`, which the admin import map has to resolve at runtime. Generated, not hand-edited. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * refactor: simplify per /simplify pass Three cleanups, no behaviour change: - `screen()` returned its verdict from five places, three of which hand-carried the diagnostic via a repeated spread and two of which correctly omitted it — a shape a reader has to verify rather than read. One `settle()` exit now carries it wherever it has been set. - `screen()` took `messageId` alongside the `message` it came from. - `context`'s validator was inline while `message`'s was extracted; both are named functions now. Reuse angle found nothing to reuse: no shared hash or name-from-email helper exists, and `hasMxRecords`'s duplication is the recorded decision. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(user-messages): validate a restored verdict against the real set `isScreeningResult` asserted `value is UserMessageScreeningResult` while checking only that `verdict` was a string — an assertion wider than its check, which the compiler then propagates. The review that raised this described the wrong failure (notes filled with `undefined` via `messageVerdictNote`); that cannot happen, because the note is only ever composed from a freshly computed verdict, never from the restored one. The real consequence is worse and is now pinned by a test: a `failed` row whose stored verdict is unrecognisable was TRUSTED, so screening was skipped and a disposable-address message got delivered. Loosening the guard makes that test fail with `expected 'delivered' to be 'spam'`. `MESSAGE_VERDICTS` is now a runtime list with the type derived from it — the same shape as `USER_MESSAGE_STATUSES` — because a value read back out of a JSON column needs something to check against. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(user-messages): restore the 254-char bound on the sender address Found by the security pass, as a parity gap rather than a vulnerability. The endpoint this collection replaces bounded `email` at 254 via Zod, and its OpenAPI schema published that. Payload's `email` field has **no** `maxLength` option — the option is absent from `EmailField`, present only on text-shaped fields — so moving the intake onto a collection dropped the bound silently, leaving an unbounded string on a public write path. Restored as a validator composing Payload's own `email` check, the same shape `message` already uses. Tested in both directions so it cannot pass by rejecting everything. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs: sync Turnstile and access docs with the collection move Docs-sync sweep of the branch diff turned up three stale spots and one that was misleading before this branch: - DEPLOYMENT.md quoted a log line operators grep for, `contactAdmin: Turnstile verification could not be completed`, which no longer exists — the guard logs under `antiSpamGuard:` now. Both it and .env.example also described the secret as belonging to one endpoint; it covers the whole public write surface, via a header. - `.claude/rules/access.md` said a collection in no project is reachable only by explicit-permission users. That is the opposite of what step 5 of its own permission flow says: no project means SHARED, i.e. implicitly readable by every role. `RESTRICTED_COLLECTIONS` exists precisely because of that, and the section never mentioned it — which is a trap for anyone adding a collection that holds personal data. Rewritten with the two knobs and how they compose. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs: state the root-endpoint criterion, not the count PR #651 adds `/api/atlas/sitemap` as another root endpoint, so wording that asserted "exactly one" / "the only root endpoint" would have been false the moment either PR merged, whichever went first — and would have collided textually in the same paragraphs. The durable point was never the count: it is that "unpersisted" is not "ownerless", which is what #632 demonstrated by deleting an endpoint whose only claim to being ownerless was that it chose not to store anything. That survives any number of siblings. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Revert "fix(user-messages): restore the 254-char bound on the sender address" Removed at the user's request. The bound was raised by the security pass as a parity gap rather than a vulnerability — an over-long address is a storage concern, not an exploitable one — and Payload's `email` field still rejects anything that isn't a well-formed address. This reverts d8f5a2b, including its test. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(ci): a conflicted PR runs no CI, and nothing says so Cost ~30 minutes of this session. `main` moved under this branch (#651), the PR went CONFLICTING, and GitHub silently stopped scheduling runs — a `pull_request` workflow runs against the merge commit, and a conflicted PR has none. Nothing surfaces that: `gh pr checks` showed only Railway (which kept deploying, since it builds the branch head, not the merge), `gh run list --branch` was empty, and no job appeared failed. It reads exactly like a stuck scheduler, so the instinct is to wait, or to close/reopen the PR — neither of which touches the cause. Documents the one-command diagnostic (`gh pr view <n> --json mergeable,mergeStateStatus`) in AGENTS.md, and puts it as a precondition in the finalize pipeline's CI-watch step, which is where the workflow actually meets it. Two traps recorded with it: a green run can be STALE (it predates `main` moving, so a conflicted PR looks tested — check the run's `head_sha`), and docs conflict far more readily than code, because sibling feature PRs edit the same paragraph of the same rules file even when they share no functions. Hence the advice to write shared rule docs as a criterion rather than a count. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(e2e): name the stale-preview-admin case instead of a bare 403 The smoke lane's `ensureAdmin` bootstraps a preview by logging in and, on failure, calling Payload's `first-register`. Payload returns Forbidden from `first-register` as soon as the auth collection holds any document, so once a preview has been seeded the only 403 it can produce means "an admin already exists that PREVIEW_ADMIN_PASSWORD does not open" — the opposite of what the raw error reads like. That is the state this PR's preview is in. Its Postgres has been up since 2026-08-26T22:47Z and the first smoke run seeded [email protected] with the password that was still hardcoded in this file; #656 then moved the credential to the PREVIEW_ADMIN_PASSWORD secret (created 2026-08-27T17:35Z), and a preview's volume outlives its deploys, so the seeded admin kept the old value. Login fails on the new secret, first-register is Forbidden, and all five auth-dependent smoke specs die on a Payload stack that says only "You are not allowed to perform this action". #656's own CI could not catch this: the preview-URL discovery step found no preview on #656, #657 or #658, so the smoke lane skipped there and this branch is the only place the change has ever run. Report the real cause and the remedy, drop the getter's stale pointer at the Railway service variables (nothing server-side reads that name), and record in AGENTS.md that the secret is stable per preview rather than rotatable on its own. This does not turn the lane green — the preview database still has to be reset so it can be seeded again — but it stops the failure from reading as a registration bug. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * refactor(user-messages): let jsonSchema own the JSON columns' shape and types (#660) Applies the review on #653. The JSON fields now carry a `jsonSchema`, which Payload compiles to a write-time validator AND generates the field's type from — so `types.ts`'s `UserMessageContext` and `screening.ts`'s `UserMessageScreeningResult` are gone rather than kept in agreement by eye. - `context`: open schema (unknown keys still pass, per the intake contract); `validateContext` and its serialized-length cap deleted. - `screeningResult`: closed schema, `verdict` enum derived from MESSAGE_VERDICTS so the runtime list and stored contract cannot drift. - `message`: built-in `minLength`/`maxLength` replace the composed validator; both bounds inline. - `messageVerdictNote` becomes the `MESSAGE_VERDICT_NOTES` record. - `UserMessageStatus`: `Severity`/`BANNER_TYPE` collapse into `Banner`'s own type; the defensive `notesOf` filter goes, the schema having closed the hole. - `normalizedBodyHash` folds into its one consumer, `prepareUserMessage`. Per-key documentation survives as JSON Schema `description`, which Payload renders into the generated type's JSDoc. Claude-Session: https://claude.ai/code/session_01Jry6g9kMG1UQ63N99vABAC Co-authored-by: Claude <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Devindra <[email protected]> Co-authored-by: SYDevelopers Bot <[email protected]>
What
GET /api/atlas/sitemap— every canonical atlas URL the calling client owns, so a consumer can build a sitemap.{ "generated": "2026-08-26T00:00:00.000Z", "urls": [ { "loc": "https://sahajayoga.nl/find-a-class/nl", "lastmod": "2026-08-01T…", "route": "/nl" }, { "loc": "https://sahajayoga.nl/find-a-class/nl/amsterdam", "lastmod": "…", "route": "/nl/amsterdam" }, { "loc": "https://sahajayoga.nl/find-a-class/nl/amsterdam/1204", "lastmod": "…", "route": "/nl/amsterdam/1204" } ] }/api/atlas/seoanswers one route at a time and nothing enumerated the routes, which left the WordPress plugin (C5) and WeMeditateWeb (#62) able to render every page's metadata and unable to tell a crawler those pages exist.The one design decision worth reading
locis read, never recomposed. It is the document's ownwebUrl— the identical virtual field/seoreturns ascanonical, fetched from the identical place. A consumer composing routes from/api/regions+/api/events/geojsonwould be a second implementation of the URL rule, in PHP, free to disagree withcanonicalUrl.tsabout mount joining, trailing slashes and query-vs-path routing. A sitemap is the one artefact whose whole job is to publish URLs a crawler will fetch, so a disagreement there is a set of 404s submitted to Google on purpose.That is asserted, not asserted-by-inspection: for every URL the endpoint publishes, the test calls
/api/atlas/seowith that route and comparescanonicaltoloc— run against two owners with different routing shapes (pathandquery), so it covers both URL forms rather than the one the builder is simplest at.A comment at the
regionsread explains why it is not redundant with the already-loaded region tree, since the obvious future optimization (rebuildlocfrom the in-memory paths) is exactly what would break this.Acceptance criteria
auth gate+ownershipdescribeslocbyte-identical to/seo'scanonicalfor the same routeagreement with GET /api/atlas/seo{ "urls": [] }, not a 404gives a client with no owned subtree an empty list, not a 404Contract choices a consumer can't infer
null— the count is the consumer's only signal.generatedis the only field that moves between two otherwise identical answers, so diffurls, not the body.Flagged for a decision — WeMeditateWeb gets an empty sitemap
The ticket's rule is ownership-based, and the We Meditate fallback surface is not a client — it's where a region with no owning ancestor falls through to. So under the rule as specified, WeMeditateWeb receives
{ "urls": [] }until it has a canonical-ownership record of its own.I implemented the rule as written (AC 3 states it explicitly), but #62 is listed as a consumer, so this likely needs either a canonical-ownership record for We Meditate or a follow-up ticket. Recorded in
.claude/docs/architecture.mdso it isn't rediscovered later.Verification notes
254764a: the handler assertedreq.user.id as numberagainst a numericCanonicalOwner.clientId.'7' === 7is false, so a non-numeric id would have matched no owner and answered "you own nothing" — byte-identical to the legitimate empty answer this endpoint is required to give. That is the one failure it must not have silently, since a consumer told it owns nothing publishes an empty sitemap. Now converts rather than asserts, and 500s on anything that isn't an integer, with a test pinning it against the empty-list case beside it.Vary: Authorizationis now load-bearing for isolation rather than belt-and-braces. It's set and asserted by test, and depends on the zone Cache Rule pairing already configured (vary.authorization = passthrough+ requiringAuthorizationpresent). Blast radius is bounded either way — the payload is public URLs of published content.Test plan
tests/int/atlas-sitemap.int.spec.ts— 16 cases: auth gate, ownership + carve-out, unowned-subtree isolation, empty-not-404, unusable-id 500, draft + finished exclusion,lastmod, byte-identity vs/seoacross both routing shapes,Vary/Cache-Tag.tests/unit/atlas-sitemap.spec.ts— the pure ownership + shaping rules.tests/unit/openapi-custom-endpoints.spec.ts— the new path + both schemas stay registered and project-visible.Closes #650
🤖 Generated with Claude Code