Skip to content

feat(seo): supply the atlas root view's metadata by default, with an opt-out - #23

Merged
Ardnived merged 6 commits into
mainfrom
claude/feat-16-root-seo
Sep 13, 2026
Merged

Ardnived merged 6 commits into
mainfrom
claude/feat-16-root-seo

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The Atlas page — the one a host links from its own nav — now carries its own title, description, canonical, hreflang, Open Graph and JSON-LD, from GET /api/atlas/seo (feat(api): /api/atlas/seo answers the atlas root and bare view routes SahajCloud#739).
  • A bare view route (/search, /calendar, /filters, /online, /share) gets the same document, decided from type in the answer rather than a local copy of that segment list.
  • One new checkbox, "Let my SEO plugin describe the Atlas page", hands the page back. Unticked by default, per site on multisite.
  • A root answer whose canonical names another domain is refused, trap 15's guard on the one tag that decides who owns the page.
  • Trap 16 is untouched: a 404 or an unreachable endpoint still leaves the host's own metadata in place, opt-out or not.

Changes

  • includes/seo.php — an empty route on the Atlas page is its root view, asked about as /. Two opt-out gates, one read: before the request for the root spelling, after it on the answer's type. The root renders from its top-level title, so it is decided before the content guard the other two renderers need. sahaj_atlas_seo_root_points_elsewhere() then refuses a root answer whose canonical is not this host's, before suppression.
  • includes/settings.php — the second option, its checkbox, and a hidden 0 so unticking arrives at all.
  • includes/diagnostics.php — a fifth row naming the side that owns the page description, warning when a root answer names another site, and strong added to the renderer's wp_kses allowlist so the title it shows is not silently stripped.
  • includes/sitemap.php — a docblock line only: sahaj_atlas_is_local_url() is now shared with the SEO takeover, and a second copy there would be free to disagree with this one.
  • tests/fixtures/seo-answer.php — the root answer beside the region one, seeded by the PHP suite and both render blueprints.

Test results

  • Lean gate: ✓ pnpm test:all — 12 files syntax-clean, 230 behaviour assertions, 112 render assertions across both theme kinds, 0 failures.
  • Contract step: ✓ tests/atlas-url-contract.json byte-identical to SahajCloud's copy on main.
  • Every new assertion was watched failing first, against the defect it exists to catch: the old root exclusion restored, the opt-out ignored, the type gate dropped, suppression moved ahead of the fetch, the slot stripped of its locale, the root branch put back behind the shared content guard, the canonical guard removed, that same guard widened past the root, and the diagnostics row that reports it deleted.

Manual verification

  1. On a site with Yoast or AIOSEO active, load the Atlas page and confirm the description is the atlas one, emitted once, with no competing canonical.
  2. Tick "Let my SEO plugin describe the Atlas page", reload, and confirm the host's own description returns and the fifth diagnostics row says so.
  3. On multisite, confirm the checkbox on one site does not move on another.

Notes for reviewer

Three judgement calls worth your eye:

  • The second setting. Principle 4 argues against one; the ticket makes the case for this one. It governs the root view alone.
  • Opting out also drops the crawlable <h1> and paragraphs inside <sahaj-atlas>, because the early return skips the children filter too. That matches the ticket's criterion ("the plugin emits none of it"), and no SEO plugin supplies body content, so nothing replaces it. Say if you would rather the children stayed.
  • An opted-out host still pays one cached round trip per bare view route, since only the answer names which routes resolve to the root. The saving is real for /, which is the route their nav points at. The suite pins both halves. The branch review asked whether that gate earns its place; the thread carries the answer and stays open for you.

Filed on the way: #22 — sahaj_atlas_seo_title() returns the endpoint's title into pre_get_document_title unescaped, and core echoes that raw. Pre-existing, found by this branch's security review, not fixed here.

Detail

A root canonical this site does not own is a failed fetch. The endpoint answers what the client owns, and an owned subtree is not necessarily served from the domain asking: an unverified canonical target is answered with the We Meditate surface, and a shared key or a mis-set canonical.domain does the same. Printed on the Atlas page, after core's own rel_canonical has been removed, that hands the host's most-linked page to another domain. Dropping only the tag would be worse, since rel_canonical is gone by then. The rule is the root view's alone — a region may consolidate onto another surface, and that is the endpoint's decision to make. The suite pins both halves, and tests/fixtures/seo-answer.php keeps its local rootCanonical, so the default path is unchanged.

This branch was rebuilt on main after #21 landed. #21 rewrote the same two files: sahaj_atlas_current_route() now answers for ?atlas= as well as the path route, and it added a tests/seo.php of its own. The merge commit carries the four resolutions. The load-bearing one: #21's sahaj_atlas_seo_slot() won over this branch's duplicate sahaj_atlas_seo_cache_key(), because #21's own simplify pass had deliberately removed the locale parameter that duplicate reintroduced.

A refused ?atlas= now falls back to the root view, since the page is the root view either way. The assertion that matters survives the change: the crafted value reaches neither the endpoint nor the canonical. includes/routing.php said the opposite and now says this.

Rejected, with reasons. Serving a stale answer while refreshing, and aliasing a bare view route's cache slot onto the root's: both change caching for every route rather than this ticket's, and belong in their own ticket. The fixture's rootRoute/rootCanonical keys stay, matching the route/canonical pair already beside them.

Fixture pre-mortem. The root half assumes buildRootSeo() in src/endpoints/atlas/seo/seoDocument.ts on SahajCloud main: id: null, route normalized to / whichever bare view route was asked for, empty breadcrumbs, a WebSite JSON-LD node, and content carrying paragraphs alone — so the heading has to come from title. Verified against that file, not against this plugin's reader.

Preview: SahajAtlasWordpress deploys none.

Closes #16

🤖 Generated with Claude Code

https://claude.ai/code/session_01CyxoefN47eov1tQxCQ4Y7Z


Generated by Claude Code

`GET /api/atlas/seo` 404'd the atlas root, so the one page a host links
from its own nav — the page the settings-screen button creates — was the
only atlas page with no metadata of its own. SahajCloud#739 answers it,
and this consumes it: the root view is requested as `/`, and its title,
description, canonical, hreflang, Open Graph and JSON-LD are emitted
exactly as a region route's are.

A bare view route (`/search`, `/calendar`, …) needs no code here. It is
already sent verbatim, and the endpoint answers it with the root
document.

The opt-out is a second site setting, and principle 4 argues against one.
It has the use case principle 4 asks for: a host that wrote its own
description for the Atlas page had no way to keep it, and a silent
takeover is what turns that into a support request the local volunteer
cannot answer. It governs the root view alone — every other atlas route
is an address the host's SEO plugin has never seen, so there is no
host-written description to preserve there.

Two guards, not one. The route is checked before the request, so an
opted-out host pays no round trip on their busiest page. `type` is
checked after it, because only the answer names which bare view routes
resolve to the root — a copy of that segment list here would drift the
day a view is added upstream.

Trap 16 is untouched: suppression still happens only after a successful
fetch, so a 404 or an unreachable endpoint leaves the host's own
metadata in place, opt-out or not.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014G2kncmnvzARd9KDsXo6CT
45 assertions across two lanes. Every one was watched fail first, against
the defect it exists to catch — the old root exclusion restored, the
opt-out ignored, the opt-out widened to every route, suppression moved
ahead of the fetch, the root branch dropped from the children dispatch,
the JSON-LD re-escaped, the cache slot stripped of its route, locale and
key, and the checkbox sanitizer let loose.

The behaviour suite stubs the endpoint through `pre_http_request` and
drives `sahaj_atlas_seo_boot()` on a real Atlas page, so it asserts the
suppression as well as the emission. That pairing is the point: every way
of inverting trap 16 looks identical from outside — a page with no
description either way — and an emission assertion alone passes against
all of them.

The render lane seeds the answer in both blueprints and asserts the head
block and the crawlable children on a real request, per theme kind, the
same shape the sitemap checks already use.

Two assertions in the trap 16 group — that nothing is emitted, and that
the theme keeps its title — could not be made to fail on their own. The
emitter guards its own null, so they ride on the suppression assertion
beside them, which did fail.

The fixture is an `AtlasSeoResponse` of `type: root`, verified against
`src/endpoints/responseTypes.ts` and `buildRootSeo()` in
`src/endpoints/atlas/seo/seoDocument.ts` in sydevs/SahajCloud at 70f12c6.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014G2kncmnvzARd9KDsXo6CT
The guide said the plugin exposes one setting, in four places. It now
exposes two, so those four lines were about to teach the next agent
something false about a file they were reading.

Principle 4 keeps its bar and gains the worked example: #16 is the shape
that qualifies, and a third setting still needs its own use case.

Trap 17 is new, and it is the one a reader cannot recover from the code
alone: a bare view route resolves to the atlas root upstream, and the
plugin learns which routes those are from `type` in the answer. A copy of
that segment list here would look correct and drift silently the day a
view is added to the widget.

readme.txt gains the FAQ entry a volunteer will actually arrive at —
"my SEO plugin's description stopped showing" — with the checkbox as the
answer and the reason the deep pages stay ours.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014G2kncmnvzARd9KDsXo6CT
`main` moved under this branch with #21, which rewrote the same two files:
`sahaj_atlas_current_route()` now answers for `?atlas=` as well as the path
route, and `tests/seo.php` arrived there first, covering the query-routed
shape. Both halves are kept; four resolutions were needed.

- `sahaj_atlas_seo_cache_key()` is dropped for `sahaj_atlas_seo_slot()`.
  They are the same helper, written twice. #21's own /simplify pass removed
  the locale parameter on purpose — a caller free to name a locale writes a
  transient nothing reads — so the version without it wins, and the slot
  assertions drive the locale through `determine_locale` instead.
- `tests/seo.php` is one file again: #21's routing groups, then this
  branch's root, opt-out and trap-16 groups. The group asserting the root
  is *excluded* is now the group asserting it is described, which is the
  behaviour change this ticket is.
- A refused `?atlas=` now falls back to the root view rather than to
  nothing, since the page is the root view either way. The assertion that
  matters is the one that survives: the crafted value reaches neither the
  endpoint nor the canonical.
- `tests/fixtures/seo-answer.php` carries the root answer beside the region
  one, so both render blueprints seed from the one copy. It is seeded under
  `/search` as well as `/`, because the endpoint answers them alike but the
  cache is keyed on the route as asked.

`pnpm test:all` passes: 220 assertions, and 112 render assertions across
both theme kinds.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CyxoefN47eov1tQxCQ4Y7Z
Four cleanup agents and a security review read the whole branch. The
security review cleared the diff — the new sinks escape, the option rides
core's own `options.php` capability and nonce, and a crafted `?atlas=`
reaches neither the endpoint nor the canonical. It named one pre-existing
defect outside this diff, filed as #22 rather than fixed here.

Applied:

- The root is decided before the `content` guard in
  `sahaj_atlas_seo_children()`. Its heading is the top-level title, so it
  renders with no content at all — which is exactly what a locale nobody
  has written copy for answers. The shared guard would have dropped the one
  element a crawler reads on the page this ticket is about.
- `sahaj_atlas_seo_paragraphs()` replaces the same escaped loop in two
  renderers, so the escaping rule has one home.
- `sahaj_atlas_seo_host_describes_root()` is read once into `$their_seo`
  and consulted twice, so it reads as one decision rather than two rules.
- The pre-fetch gate's comment now states its real scope: the root spelled
  as `/` saves the round trip, a bare view route still asks because only
  the answer names which routes resolve to the root. The suite pins both
  halves instead of implying the saving covers all six.
- `sahaj_atlas_check_idle()` replaces the verbatim "the API key has to work
  first" row in two checks.
- The diagnostics docblock no longer claims the panel and the front end
  share a cache slot. They share one only when the admin's language matches
  the site's, because the slot is keyed per locale.
- `includes/routing.php` said a refused `?atlas=` falls back to the host's
  own metadata. After this branch it falls back to the root view. The
  comment was about to teach the next reader the opposite of what ships.
- One wording for the opt-out label, not two `.pot` entries for one
  sentence. Render assertions on the root page live in one block.

Skipped, with reasons: serving a stale answer while refreshing, and
aliasing a bare view route's cache slot onto the root's — both change
caching for every route, not just this ticket's, and belong in their own
ticket. The fixture's `rootRoute`/`rootCanonical` keys stay, matching the
`route`/`canonical` pair already beside them.

The new no-content assertion was watched failing against the shared guard.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CyxoefN47eov1tQxCQ4Y7Z
@sydevs-bot

sydevs-bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 20:49Z address-review · attempt 1 · session · done
  • 20:49Z address-review · attempt 1 · session
  • 20:40Z adversarial-review · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 12, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

The diff is the ticket's size: two behaviour files, one setting, the rest tests and docs. Deciding the root from type, not a local segment list, is right — SahajCloud's RESERVED_SEGMENTS also holds register and preview, which seo.php:80's comment omits. Both open questions: keep the <h1> early return, per the ticket; the second setting is justified. #22 now covers the Atlas page itself; its one-line esc_html may belong here.

Findings

  • blocker seo.php:91 — a root canonical this site does not own is emitted, after core's rel_canonical is removed. Trap 15's guard is not applied.
  • consider seo.php:69 — the pre-fetch gate may not pay rent.

Checked

  • #16 criterion by criterion against tests/seo.php. Its fixture's root half matches buildRootSeo field for field.
  • SahajCloud main: buildRootSeo, rootStrings, atlasRoute, rootCanonical, canonicalTargetFor. Plugin: the four touched files and sitemap.php, whole. Lanes not re-run; CI green.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread includes/seo.php Resolved
Comment thread includes/seo.php Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 12, 2026
The endpoint answers what the client owns, and an owned subtree is not
necessarily served from the domain asking: an unverified canonical target
is answered with the We Meditate surface, and a shared key or a mis-set
`canonical.domain` does the same. On the Atlas page that arrived as a
foreign `<link rel="canonical">`, printed after core's own `rel_canonical`
had been removed — the host's most-linked page handing its indexing away.

Trap 15's guard, reused rather than re-derived, and applied trap 16's way:
a root answer naming another host is treated as a failed fetch, so the page
keeps the metadata it had. Dropping only the tag would be worse, since
`rel_canonical` is gone by then. The rule is the root view's alone — a
region may consolidate onto another surface, and that is the endpoint's
decision to make.

The fifth diagnostics row reports the refusal, so the panel cannot say
"Sahaj Atlas describes it" about a page the takeover just declined.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FP7QibCu2wv5vEEHWGZjRw
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Two threads from the branch review, one push — 2a8d0bc.

Adopted — the root canonical. An answer naming another domain is now a failed fetch, refused before suppression, reusing the sitemap's own sahaj_atlas_is_local_url(). A region still canonicalises wherever the endpoint says. The fifth diagnostics row warns rather than claiming the page is ours. Thread resolved.

Rebutted — the pre-fetch opt-out gate. Kept, and left open for you. Without it an opted-out host waits on a five-second-timeout request, once per five minutes per locale, on the page their nav links to, for an answer the next gate discards.

Gate: pnpm test:all green — 230 behaviour assertions, 7 new, each watched failing first; 112 render assertions; contract file byte-identical.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 12, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review September 12, 2026 21:07
@sydevs-bot
sydevs-bot requested a review from Ardnived September 12, 2026 21:07
@Ardnived
Ardnived merged commit ec8c249 into main Sep 13, 2026
28 of 30 checks passed
@Ardnived
Ardnived deleted the claude/feat-16-root-seo branch September 13, 2026 16:41
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 13, 2026
@sydevs-bot sydevs-bot mentioned this pull request Sep 18, 2026
sydevs-bot added a commit that referenced this pull request Sep 18, 2026
#23 edited the shipped `= 0.1.0 =` changelog entry, adding "and which
side describes the Atlas page" to the status-panel bullet. That row did
not exist at v0.1.0 — `git show v0.1.0:readme.txt` has the panel covering
four things, not five.

Plugin Update Checker merges readme.txt's sections into the WordPress
update modal, so a volunteer on 0.1.0 deciding whether to update reads
the fifth row credited to the version they already run. The 0.2.0 entry
announcing that same row then reads as a repeat, and the release that
actually ships it loses the credit.

A shipped release's entry describes what that release shipped.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Jg5XawkJdwdSyhgVGdkvQu
Ardnived pushed a commit that referenced this pull request Sep 18, 2026
* chore(release): v0.2.0

Three merged changes ship in the plugin zip since v0.1.0, and a volunteer sees
none of them until a tag builds one: #21, #23 and #24. Everything else merged
since c1fec89 is CI, docs or tests, all of which `.distignore` keeps out of the
zip, and #10 and #13 touched shipping files in comments only.

Minor, not patch, and pre-1.0 either way: #23 adds a capability and a second
site setting, so the version has to move more than a fix would.

Four declarations, not two. `release.yml` compares the tag against the plugin
header alone, so it would have passed with `SAHAJ_ATLAS_VERSION` left at 0.1.0
— and that constant is the cache-buster on `atlas-page.css`, `atlas-page.js`
and the editor assets. Every updated site would have kept serving the 0.1.0
copies. `blocks/embed/block.json` declares the same version to the editor.
`package.json` declares none: it is dev tooling, and `.distignore` excludes it.

The changelog is written for the one non-technical volunteer who runs each
site, so it names what they will see rather than what changed in the code.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QNEAgEV5tDoLsB9nyLUv26

* fix(readme): the 0.1.0 entry claimed a 0.2.0 row

#23 edited the shipped `= 0.1.0 =` changelog entry, adding "and which
side describes the Atlas page" to the status-panel bullet. That row did
not exist at v0.1.0 — `git show v0.1.0:readme.txt` has the panel covering
four things, not five.

Plugin Update Checker merges readme.txt's sections into the WordPress
update modal, so a volunteer on 0.1.0 deciding whether to update reads
the fifth row credited to the version they already run. The 0.2.0 entry
announcing that same row then reads as a repeat, and the release that
actually ships it loses the credit.

A shipped release's entry describes what that release shipped.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Jg5XawkJdwdSyhgVGdkvQu

---------

Co-authored-by: Claude <[email protected]>
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.

feat(seo): supply the atlas root view's metadata by default, with an opt-out

3 participants