Skip to content

fix(seo): robots.txt and title paths fail on part of the fleet - #49

Merged
Ardnived merged 10 commits into
mainfrom
claude/fix-43-seo-robots-title
Oct 1, 2026
Merged

Ardnived merged 10 commits into
mainfrom
claude/fix-43-seo-robots-title

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • An atlas route's <title> is now the endpoint's on a site running Yoast. It was Yoast's, while og:title and the canonical were ours.
  • On a classic theme the route had no <title> element at all — worse than the ticket describes. Reproduced in the render lane.
  • A sixth panel row names a site whose robots.txt Sitemap: line cannot exist, and the line to paste instead.

Phases

  • <title> ownership — the filter priority, and a <title> printer to put it in
  • Sitemap discovery — the diagnostics row and the readme FAQ

Changes

  • includes/seo.php — filter at PHP_INT_MAX; new sahaj_atlas_seo_restore_title_tag()
  • includes/diagnostics.php — check 6, sahaj_atlas_check_sitemap_discovery()
  • includes/sitemap.php — comment only: a ⚠ pointer from sahaj_atlas_robots_txt() to the new check
  • tests/fixtures/fake-yoast.php — the vendor hook shape, every line behind a request flag
  • AGENTS.md — three trap pointers re-aimed at the lines this diff moved

Contract impact

None. tests/atlas-url-contract.json is unchanged and still byte-identical to SahajCloud's copy (contract step run, in sync).

Test results

  • CI on 7383af1: ✓ green — Lint & test and URL contract in sync both pass.
  • Lean gate on 0819ce4: ✓ pnpm test:all — the syntax check, the PHP suite and the render lane, 0 failures.
  • Render: ✓ the mesmerize: under the theme's header failure reported against 7383af1 did not reproduce in this session's sandbox.
  • Build: N/A

Each new assertion was watched failing against the real defect first: the filter at 10 (title becomes the vendor's), the repair unregistered (<title> reports none end-to-end), each check_sitemap_discovery guard neutered in turn, and the printer guard's false !== and Gutenberg arms.

Manual verification

  1. The real Yoast. The lane uses a confirmed-shape stand-in, not wordpress-seo — installing it would make every run fetch a zip from wordpress.org, the outbound request tests/no-network.php exists to refuse. Worth one check on a site with Yoast active that an atlas route's <title>, og:title and canonical now agree.
  2. A subdirectory install. shrimataji.org runs in /test/. The panel's new row should name https://shrimataji.org/robots.txt and the exact Sitemap: line.
  3. A network sub-site. The multisite branch has no automated coverage — is_multisite() is a constant the lane cannot toggle, and booting multisite is a bigger lane change than this ticket needs.

Notes for reviewer

  • PHP_INT_MAX is the judgement call. Yoast's callback takes no argument, so it discards whatever ran before it; any priority below the highest vendor's loses, and no number is above all of them for good. On an atlas route this plugin is the designated override, so the end of the chain is the only position that holds. The alternative root-cause move — remove_all_filters('pre_get_document_title') — would also delete a host's own legitimate title snippet.
  • Why re-add core's printer rather than print <title> ourselves. _wp_render_title_tag() carries the title-tag theme-support gate, which is the one fact we cannot know about an arbitrary theme: printing directly would ship two <title> elements on any classic theme that prints its own and gives us no hook to suppress. It also keeps trap 20's escaping contract pointed at a single sink.
  • Yoast's priority is confirmed in its source, as the ticket asked: pre_get_document_title at 15 in src/integrations/front-end-integration.php:259, and filter_title() at :282 takes no parameter. Read from the 28.6 tree.
  • Where our $seo['title'] is empty we pass the incoming value through, so a vendor's value reaches the re-added raw printer. Yoast esc_html()s its own return (front-end-integration.php:293), so this is sound for Yoast; for an arbitrary filter it is core's own trap-20 contract, unchanged by this PR.
  • The mesmerize second opinion is settled. That assertion failed in the previous session's sandbox on this branch and on unmodified main; it passes on 0819ce4 in a fresh one. Nothing in either revision commit touches that cell.
  • Dismissed: sourcing tests/seo.php's vendor priority from a constant in tests/fixtures/fake-yoast.php. The PHP suite never loads that fixture — only tests/render-classic.json does, as an mu-plugin — and the 15 there is an assertion input, not configuration: behind a shared constant an edit would silently change what the assertion tests. Thread left open.
  • Dismissed: an "almost pretty" permalink structure (/index.php/%postname%/) passes check 6's gate but serves no robots.txt. sahaj_atlas_check_path_routing() has the identical blind spot today, so fixing it in one row only would make two rows disagree about the same site. Filed as fix(sitemap): the plugin publishes a sitemap URL it cannot serve #50, together with the related defect that a plain-permalink site still publishes its unservable sitemap URL to an SEO plugin's index.
  • Dismissed: the duplicated scheme://host[:port] decomposition against sahaj_atlas_mount_key(). That one parses the page permalink, lowercases the host and drops the scheme — a shared helper would need three parameters to serve both callers.
  • No changelog entry: 0.2.x entries are written in the release PR, per the repo's convention.
Detail

What the second half of the title bug actually is. Yoast removes _wp_render_title_tag, _block_template_render_title_tag and gutenberg_render_title_tag from wp_head in its own register_hooks() (on init, via src/loader.php:135), and prints <title> from a wpseo_head presenter instead. sahaj_atlas_seo_suppress_others() empties wpseo_head. On a classic theme that leaves neither printer, so nothing ever calls wp_get_document_title() and the page ships no <title>. A block theme escapes it only by accident: core registers _block_template_render_title_tag while resolving the template, after Yoast has run. That asymmetry is why the repair decides at wp_head priority 0 rather than at template_redirect — a check made earlier sees no printer on a block theme that has one, and adds a second <title>.

Core's robots.txt gating, read rather than recalled. WP_Rewrite::rewrite_rules() returns an empty rule set when permalink_structure is empty, and gates the robots.txt rule on an empty home_url() path — wp-includes/class-wp-rewrite.php:1279-1285 in the WordPress 6.7.9 the lane boots, printed from the running instance by reflection rather than quoted from memory.

Fixture pre-mortem. tests/fixtures/fake-yoast.php assumes Yoast's front end registers, on init: pre_get_document_title at 15 with a zero-argument callback, wp_head at 1 calling do_action('wpseo_head'), wpseo_head at -9999, and remove_action() for core's three title printers. Each half was verified against src/integrations/front-end-integration.php and src/presenters/title-presenter.php in Yoast SEO 28.6, named in the fixture's docblock.

The render lane got cheaper, not dearer. The SEO-plugin cell started as a third booted instance with its own blueprint. #35 landed tests/fixture-theme.php mid-review, establishing the pattern of serving a second fixture to a flagged request on the existing classic server; the cell was reworked to match, which removed the extra boot and a third copy of the seed blueprint.

Why the trap pointers drifted. AGENTS.md carries 31 file:line pointers and nothing checks them. This diff added 46 lines to includes/seo.php and 5 to tests/seo.php above three of them. Ten more pointers already miss their ⚠ line on b0ee950, which is not this branch's to fix — main has since re-aimed four of them in #51.

Not carried here: tests/render-blueprint.json and tests/render-classic.json still hold near-identical copies of the seeding runPHP step. A shared tests/fixtures/seed.php would hold one, but it changes two lanes that are green today and predates this ticket.

Closes #43

🤖 Generated with Claude Code

https://claude.ai/code/session_01151AQvMRt2GMCaAnjUAcum

claude added 6 commits October 1, 2026 17:16
Yoast registers `pre_get_document_title` at 15, and its callback takes no
argument at all, so it cannot pass an earlier value through
(`src/integrations/front-end-integration.php` `register_hooks()` and
`filter_title()`, confirmed in 28.6). This plugin registered the same
filter at 10, so on every site running Yoast the atlas route's `<title>`
was Yoast's idea of the Atlas page while `og:title` and the canonical were
the endpoint's. The filter now runs last.

Priority alone is half the fix. Yoast also removes core's three title
printers and emits `<title>` from a `wpseo_head` presenter, so emptying
`wpseo_head` leaves a classic theme with no `<title>` element at all —
reproduced in the new render cell, which reports `none` without the
repair. `sahaj_atlas_seo_restore_title_tag()` puts core's printer back,
and only when nothing else will print one. It decides at `wp_head`, not
at `template_redirect`: core registers
`_block_template_render_title_tag` while it resolves the block template,
so an earlier check sees no printer on a block theme that has one and
adds a second `<title>`.

`tests/fixtures/fake-yoast.php` carries the vendor hook shape, copied
from the Yoast source named in its docblock, rather than the plugin
itself — installing `wordpress-seo` would make the lane fetch a zip from
wordpress.org, the outbound request `tests/no-network.php` exists to
refuse.

Refs #43

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0114RTHA6AfD5gE2nrw1jHpr
The `Sitemap:` line in robots.txt is the atlas's whole discovery path —
nothing on a host's site links into the routes — and on part of the fleet
WordPress cannot write it. `WP_Rewrite::rewrite_rules()` returns no rules
at all for a plain permalink structure, and gates the robots.txt rule
itself on an empty `home_url()` path
(`wp-includes/class-wp-rewrite.php:1279-1285`, 6.7.9). shrimataji.org runs
in `/test/`. A real robots.txt file on disk never reaches WordPress
either. Each case is silent: the filter is registered, it never runs, and
the atlas is simply never crawled.

A sixth panel row now reports it. A subfolder install and a physical file
get the address of the robots.txt a crawler actually reads and the exact
line to paste into it, since a volunteer can derive neither. Plain
permalinks are the one failure rather than a warning: the sitemap path
404s too, so there is no line that would help. A site that asked not to be
indexed is reported as the owner's own answer, matching what
`sahaj_atlas_robots_txt()` already does with that switch.

Refs #43

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0114RTHA6AfD5gE2nrw1jHpr
- The printer guard now checks all three core title printers by name,
  including the Gutenberg plugin's, and compares with `false !==`. A
  printer registered at priority 0 read as absent under bare truthiness
  and earned the page a second `<title>`.
- The subfolder row's origin is built inside the branch that uses it; the
  scheme/host fallback it carried could not fire, since `home_url()`
  always has both.
- `tests/sitemap.php` passed a third argument to `sahaj_ok()`, which takes
  two, so the row text it meant to print on failure was discarded.
- The no-network assertion pair in `tests/render.mjs` is one helper. It is
  the guard that stopped this suite calling production (#28), and a second
  copy is free to rot.
- The Yoast pre-mortem lived in two files; `tests/seo.php` now points at
  the fixture that records it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0114RTHA6AfD5gE2nrw1jHpr
A subdirectory network takes the subfolder branch on every site but the
main one, and the remedy that branch names does not exist there. The
robots.txt at the top of the domain is WordPress's own, generated for the
main site, and the filter that writes it runs with the main site's
options — so it can only ever publish the main site's sitemap. The row now
tells a network sub-site to submit its address to Search Console and Bing
instead of looking for a file nobody can edit.

Also records the guard arms the suppression repair had no failing
assertion for: the Gutenberg plugin's printer, and a printer registered at
priority 0, which `has_action()` reports as falsy.

Refs #43

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

#35 landed `tests/fixture-theme.php`, which serves a second theme to a
request carrying a flag, so one classic server covers two themes. The
suppressed-SEO-plugin cell was a third booted instance with its own
blueprint; it is now the same shape as the hero-theme cell, gated on
`?sahaj_fixture_seo_plugin=yoast`.

That removes a third copy of the seed blueprint and a whole WordPress
boot from `pnpm test:render`. `WPSEO_VERSION` is defined behind the flag
with everything else: defined unconditionally it would send every request
on that server down the Yoast suppression branch, and the lane's existing
assertions would quietly stop testing a site with no SEO plugin.

Refs #43

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

sydevs-bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 21:03Z resolve-conflicts · attempt 1 · session · done
  • 21:03Z resolve-conflicts · attempt 1 · session
  • 20:51Z resolve-conflicts · attempt 1 · session · done
  • 20:51Z resolve-conflicts · attempt 1 · session
  • 19:27Z address-review · attempt 1 · session · done

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

@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 size of the ticket, and both halves land where #43 pointed. Re-adding core's printer beats printing <title> here — it leaves the title-tag gate and trap 20's escaping in core — and the timing holds: seo_boot is template_redirect 11, so wp_head 0 is still ahead. Check 6 adds no layer and no helper for one caller, and no cross-repo contract is touched.

Findings

  • should-fix — AGENTS.md keeps three ⚠ pointers this diff moves. AGENTS.md:140
  • consider — the fixture's gate comment claims more than the file does. tests/fixtures/fake-yoast.php:41
  • consider — the vendor hook shape is copied into the PHP suite. tests/seo.php:596

What was checked

  • Resolved all 31 file:line pointers in AGENTS.md on both refs. On main each lands on a ⚠ line or the named function; on the branch three do not.
  • Check 6's gate matches sahaj_atlas_register_sitemap(), and sahaj_atlas_robots_txt() honours blog_public.
  • Read the three includes/ files and four test files whole.

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


Generated by Claude Code

Comment thread AGENTS.md Resolved
Comment thread tests/fixtures/fake-yoast.php Resolved
Comment thread tests/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 Oct 1, 2026
claude added 2 commits October 1, 2026 19:34
This branch added 46 lines to `includes/seo.php` and 5 to `tests/seo.php`
above three of AGENTS.md's `file:line` pointers, so trap 15 landed
mid-docblock, trap 20 on an unrelated `remove_action()`, and trap 19 on the
opening `/*` of its own block rather than the `⚠` line.

Trap 20 is the one that matters: it is the escaping contract the new
`<title>` path depends on.

Refs #43

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01151AQvMRt2GMCaAnjUAcum
`tests/fixtures/fake-yoast.php` claims every line below its header is behind
the `?sahaj_fixture_seo_plugin=yoast` flag. Two `define()` calls were not,
and ran on every request to the classic server.

Neither has an effect on its own, so nothing was leaking. But that sentence
is the only thing standing between this fixture and the leak it describes,
and the next line added here would land under a claim that was no longer
true. Both constants are read only by the callbacks the flag registers.

Refs #43

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

Copy link
Copy Markdown
Contributor Author

Addressed the critic's three findings. Pushed 0819ce4.

Adopted

Rebutted, left open

pnpm test:all is green on 0819ce4: syntax check, PHP suite and render lane, 0 failures. The mesmerize render assertion flagged as a local-only failure on 7383af1 passed here.

🤖 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 Oct 1, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review October 1, 2026 19:39
@sydevs-bot
sydevs-bot requested a review from Ardnived October 1, 2026 19:39
@sydevs-bot
sydevs-bot enabled auto-merge October 1, 2026 19:39
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Oct 1, 2026
Both sides added a trap 21 to AGENTS.md and both re-aimed trap 20's
pointer. Keep both traps: main's `atlas-page.js` footer rule stays 21,
this branch's `<title>` ownership rule becomes 22. Trap 20 takes this
branch's `seo.php:229`, since the 46 lines added to `includes/seo.php`
here are what moved it and main left that file untouched.

The merge also drifted two pointers #51 had just re-aimed, because this
branch adds lines above them: trap 14's `diagnostics.php:283,495` and
trap 5's `render.mjs:321`. Both re-aimed at the ⚠ lines they name in the
merged tree.

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

sydevs-bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Merged main (f02df15). One conflicted file, AGENTS.md: both sides added a trap 21, and both re-aimed trap 20's pointer.

Kept both traps. Main's atlas-page.js footer rule stays 21, so nothing citing it moves; this branch's <title> ownership rule becomes 22. Trap 20 takes this branch's seo.php:229 — the 46 lines added to includes/seo.php here are what moved that ⚠, and main never touched the file.

The merge then drifted two pointers #51 had just re-aimed, because this branch adds lines above them. Trap 14 diagnostics.php:283,495 → 284,613, trap 5 render.mjs:321 → 364. Both verified against the ⚠ lines they name in the merged tree. The ten pointers already stale on b0ee950 are untouched, as before.

includes/diagnostics.php and tests/render.mjs auto-merged, and both still read coherently — six checks registered, six documented.

Lean gate on the merge commit: ✓ pnpm test:all — syntax 0 errors, PHP suite 259 assertions, render lane, 0 failures.

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

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 1, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 1, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 1, 2026
#47 added a trap 22 of its own to AGENTS.md and re-aimed trap 21's
`atlas-page.js` pointer at the line its rewrite moved. This branch had
added a different trap 22. Both traps are kept: #47's header-offset entry
stays at 22, and this branch's `<title>` ownership entry becomes 23.
Trap 21's pointer is #47's, since it owns the file it names.

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

Copy link
Copy Markdown
Contributor Author

Merged main in. One conflict, in AGENTS.md: #47 added a trap 22 of its own, and this branch had added a different one.

Both are kept. #47's header-offset trap stays at 22, this branch's <title> ownership trap becomes 23. Trap 21's atlas-page.js pointer is #47's, since #47 rewrote that file.

Lean gate on 5ae0619: ✓ pnpm test:all, 0 failures across all four lanes.

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


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 1, 2026
@Ardnived
Ardnived added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit 0540aa8 Oct 1, 2026
12 checks passed
@Ardnived
Ardnived deleted the claude/fix-43-seo-robots-title branch October 1, 2026 21:15
@Ardnived Ardnived mentioned this pull request Oct 2, 2026
3 tasks done
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.

fix(seo): robots.txt and title paths fail on part of the fleet

3 participants