Repository navigation
fix(seo): robots.txt and title paths fail on part of the fleet - #49
Conversation
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
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 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:linepointers 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(), andsahaj_atlas_robots_txt()honoursblog_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
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
|
Addressed the critic's three findings. Pushed Adopted
Rebutted, left open
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
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
|
Merged Kept both traps. Main's The merge then drifted two pointers #51 had just re-aimed, because this branch adds lines above them. Trap 14
Lean gate on the merge commit: ✓ 🤖 Written by the sydevs autonomous loop — see what this is |
#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
|
Merged Both are kept. #47's header-offset trap stays at 22, this branch's Lean gate on 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
<title>is now the endpoint's on a site running Yoast. It was Yoast's, whileog:titleand the canonical were ours.<title>element at all — worse than the ticket describes. Reproduced in the render lane.robots.txtSitemap:line cannot exist, and the line to paste instead.Phases
<title>ownership — the filter priority, and a<title>printer to put it inChanges
includes/seo.php— filter atPHP_INT_MAX; newsahaj_atlas_seo_restore_title_tag()includes/diagnostics.php— check 6,sahaj_atlas_check_sitemap_discovery()includes/sitemap.php— comment only: a ⚠ pointer fromsahaj_atlas_robots_txt()to the new checktests/fixtures/fake-yoast.php— the vendor hook shape, every line behind a request flagAGENTS.md— three trap pointers re-aimed at the lines this diff movedContract impact
None.
tests/atlas-url-contract.jsonis unchanged and still byte-identical to SahajCloud's copy (contract step run, in sync).Test results
7383af1: ✓ green —Lint & testandURL contract in syncboth pass.0819ce4: ✓pnpm test:all— the syntax check, the PHP suite and the render lane, 0 failures.mesmerize: under the theme's headerfailure reported against7383af1did not reproduce in this session's sandbox.Each new assertion was watched failing against the real defect first: the filter at 10 (title becomes the vendor's), the repair unregistered (
<title>reportsnoneend-to-end), eachcheck_sitemap_discoveryguard neutered in turn, and the printer guard'sfalse !==and Gutenberg arms.Manual verification
wordpress-seo— installing it would make every run fetch a zip from wordpress.org, the outbound requesttests/no-network.phpexists to refuse. Worth one check on a site with Yoast active that an atlas route's<title>,og:titleand canonical now agree./test/. The panel's new row should namehttps://shrimataji.org/robots.txtand the exactSitemap:line.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_MAXis 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.<title>ourselves._wp_render_title_tag()carries thetitle-tagtheme-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.pre_get_document_titleat 15 insrc/integrations/front-end-integration.php:259, andfilter_title()at :282 takes no parameter. Read from the 28.6 tree.$seo['title']is empty we pass the incoming value through, so a vendor's value reaches the re-added raw printer. Yoastesc_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.mesmerizesecond opinion is settled. That assertion failed in the previous session's sandbox on this branch and on unmodifiedmain; it passes on0819ce4in a fresh one. Nothing in either revision commit touches that cell.tests/seo.php's vendor priority from a constant intests/fixtures/fake-yoast.php. The PHP suite never loads that fixture — onlytests/render-classic.jsondoes, as an mu-plugin — and the15there is an assertion input, not configuration: behind a shared constant an edit would silently change what the assertion tests. Thread left open./index.php/%postname%/) passes check 6's gate but serves norobots.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.scheme://host[:port]decomposition againstsahaj_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.Detail
What the second half of the title bug actually is. Yoast removes
_wp_render_title_tag,_block_template_render_title_tagandgutenberg_render_title_tagfromwp_headin its ownregister_hooks()(oninit, viasrc/loader.php:135), and prints<title>from awpseo_headpresenter instead.sahaj_atlas_seo_suppress_others()emptieswpseo_head. On a classic theme that leaves neither printer, so nothing ever callswp_get_document_title()and the page ships no<title>. A block theme escapes it only by accident: core registers_block_template_render_title_tagwhile resolving the template, after Yoast has run. That asymmetry is why the repair decides atwp_headpriority 0 rather than attemplate_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 whenpermalink_structureis empty, and gates therobots.txtrule on an emptyhome_url()path —wp-includes/class-wp-rewrite.php:1279-1285in 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.phpassumes Yoast's front end registers, oninit:pre_get_document_titleat 15 with a zero-argument callback,wp_headat 1 callingdo_action('wpseo_head'),wpseo_headat -9999, andremove_action()for core's three title printers. Each half was verified againstsrc/integrations/front-end-integration.phpandsrc/presenters/title-presenter.phpin 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.phpmid-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:linepointers and nothing checks them. This diff added 46 lines toincludes/seo.phpand 5 totests/seo.phpabove three of them. Ten more pointers already miss their ⚠ line onb0ee950, which is not this branch's to fix —mainhas since re-aimed four of them in #51.Not carried here:
tests/render-blueprint.jsonandtests/render-classic.jsonstill hold near-identical copies of the seedingrunPHPstep. A sharedtests/fixtures/seed.phpwould 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