Repository navigation
fix(page): the Atlas page breaks when another template renders it, unnoticed - #52
Conversation
…e wins The plugin owns the Atlas page's template, but anything can take it: a page builder's canvas template, a theme-builder layout, a maintenance-mode plugin, or a volunteer switching the template in Page Attributes or the Site Editor. The theme then renders header, empty content and footer, and the only print left was the `wp_footer` fallback — which lands after the footer, where `assets/atlas-page.js` measures the element's top at the document's full height and the map computes to zero. `the_content` is now the second print, so the element lands in the page's content area with the theme's footer below it, sized exactly as before. The footer fallback stays as the last resort, for a template that runs neither path. Two callers run `the_content` without rendering the page body, and either would spend the single print on a string nobody shows: `wp_trim_excerpt()`, and an SEO plugin asking for a description while `<head>` is built. Both are refused, and the suite pins both — asserting on the print flag, not only the string, because the string assertion passes while the flag is already spent. `data-sahaj-atlas-render` names which print ran. Nothing else in the page can answer that: a theme's footer markup varies too much to locate, and the plugin knows the answer only while it renders. The diagnostics loopback check reads it. `tests/fixture-template.php` takes the page over the way each theme kind really loses it — a later `template_include` filter on a classic theme, a cleared `_wp_page_template` on a block theme — and both render runs assert the element sits above the theme's footer. Verified by reintroducing the defect: without the filter the element lands below the footer in both runs. Refs #39 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012fWGENvNLWJsmWFAfXQ5ey
Check 2 reads the template meta, so it called a page healthy while a page builder's template rendered it and the element landed after the footer. Nothing server-side can tell the difference: the meta still names this plugin's template. Two new rows read the live page instead, from one fetch. "Map placement" names which of the three prints rendered the element, and is red only for the footer fallback or no element at all. "Map script" reads the loader's own tag, and is red when it lost `type="module"`, gained `async`, or its address lost the key — the detection SahajAtlasWeb#239 handed to the plugin, because a module cannot report on a tag that never ran. A page with no element gets two different diagnoses, on the body class: the Atlas page rendered without its map, or something else answered the address entirely. The second sends the volunteer to their caching and maintenance-mode plugins rather than to us. Neither row turns red on anything a volunteer cannot act on. A server that cannot reach itself is a warning, and `sslverify` is off as core's own Site Health loopback test has it, because a host whose certificate its own server rejects is common here. The probe stores a flag for the loader, not the tag: the tag carries the key in its `src` and this array goes into a transient. `tests/probe.php` covers each render path, a tag stripped of `type="module"`, `async`, a key-less address, no tag, an unreachable page and an unset key. Verified by reintroducing four defects, the naive `\basync\b` match among them — it reads an optimiser's own `data-async-ignore` marker as `async` and reports a working page broken. Refs #39 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012fWGENvNLWJsmWFAfXQ5ey
An `elementor-full-width` cell sets the Atlas page to Elementor's own `elementor_header_footer` template, so the builder renders the page and the element must come from the content area with the theme's footer below it. Every cell now asserts which print rendered the element, read from the served HTML before a browser runs any of it, so a cell that silently fell back to the footer is no longer indistinguishable from one that did not. Two cells also read the status panel as the volunteer sees it. `elementor-full-width` expects both loopback rows green and the content-area path named. `strip-module` expects the script row red — that cell's page is still broken, and the panel saying so is the whole fix, so its `known` mark now points at #39 rather than the closed SahajAtlasWeb#239. A panel where both rows warn means this server could not fetch its own page, which is a harness condition and reports as info rather than a red the code did not earn. `tests/no-network.php` lets a request to the instance's own host through. That is not a way out of the instance, and refusing it would make the loopback check report "could not reach the page" in every lane — the one answer that says nothing. Calls to SahajCloud and to third parties stay refused. Not run here: the browser lane needs the network and `SAHAJ_ATLAS_TEST_KEY`. Refs #39 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012fWGENvNLWJsmWFAfXQ5ey
Four findings from `/code-review high` on this branch: The two new `panel` cells load the settings screen, which fetches `clients/me` from PHP. That request is unstubbed in the browser lane, so `no-network.php` recorded it and every cell's SahajCloud invariant went red — an `ok` failure, which counts even for a `known` cell. The cells now seed the record through `sahaj_atlas_client_slot()`, a named slot builder beside `sahaj_atlas_seo_slot()` so no lane copies the key rule. A transport failure is deliberately not cached, so two checks each calling `sahaj_atlas_page_probe()` spent two ten-second timeouts on the host that produced it — the case `tests/probe.php` claimed to prevent while only covering the cached HTTP-code path. `sahaj_atlas_checks()` now asks once and hands the answer to both rows, the way it already hands the client record to three. `\bsahaj-atlas-page\b` also matched core's `page-template-sahaj-atlas-page`, so the body-class flag no longer proved this plugin's own filter ran — and on every page whose template meta still names our template, which is every page this fix is about, the two diagnoses collapsed into the wrong one. Exact membership now. A volunteer who did what the row asked — change the page's template — still saw the red row for five minutes. `save_post` on the Atlas page now drops the cached probe. Not fixed, with reasons: a theme-builder hero can still push the content-area element's top past the viewport and clamp its height to zero, and the placement row stays green. That is #37's defect reached by a new path, and red there would contradict this ticket's own criterion that the row is red only for the footer fallback or no element. Refs #39 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012fWGENvNLWJsmWFAfXQ5ey
Refs #39 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012fWGENvNLWJsmWFAfXQ5ey
|
🤖 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 #39: four approach items, four sets of changes, nothing smuggled in, and 600 of its 1016 added lines are tests. the_content at 99 is the platform's own hook for this, and the three prints stay one function with a parameter. The body's data-sahaj-atlas-render question is answerable from SahajAtlasWeb — no collision, evidence on embed.php:360. All three findings sit in sahaj_atlas_read_page(), the one place this PR parses output it did not print. mergeable_state is dirty, so CI has not run this against its base.
Findings
- should-fix —
diagnostics.php:691: check 7 missesdefer, which breaks the loader asasyncdoes - consider —
diagnostics.php:672: quoted attributes are assumed; a minifier turns check 6 red on a working page. - consider —
diagnostics.php:566:sahaj_atlas_probe_excuse()invents a word for a row.
What was checked
#39, the PR body, the diff at beb37ac, and whole: embed.php, diagnostics.php, probe.php. Plus SahajAtlasWeb loader/index.ts, embedding.md
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Every reader in `sahaj_atlas_read_page()` required double-quoted attributes. An HTML minifier drops optional quotes from any value with no spaces in it, which is the whole set this probe reads: the render marker, the loader's type and address, and a body carrying one class. The marker then read as absent and check 6 told the volunteer their working page had no map, and to send us the address — the false red the `data-async` guard beside it already refuses. One reader for all four, handling both quotings and none. Its four assertions each failed first, against the quote-only pattern. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016qsV5T5e7fJsFwNSBfzztt
Check 7 reads `async` and not `defer`, deliberately. `defer` is a no-op on a module script — the HTML spec defers module scripts already — and `document.currentScript` is null for one whatever the attributes say, so SahajAtlasWeb's loader reaches its own tag through `script[src*="auto.js"]` either way. Matching `defer` would turn the row red on a working page. Nothing said so, so the next reader of the contract's "No async or defer" line would add it. The assertion fails against `/\s(?:async|defer)[\s=>]/`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016qsV5T5e7fJsFwNSBfzztt
`sahaj_atlas_probe_excuse()` invented a second word for what this file already calls a row, and `$excuse = …; if ( null !== $excuse )` read as an apology rather than a value. `sahaj_atlas_check_idle()` returns the same shape under the same conditions. The new name says what comes back. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016qsV5T5e7fJsFwNSBfzztt
|
Three findings answered, pushed as
Lean gate: Still blocking CI: the branch is 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Both sides added diagnostics checks in one region. Main's sitemap discovery check stays 6, this branch's placement and loader rows become 7 and 8, and the five comments that named the placement check "check 6" follow it. Main's two new mu-plugin steps and this branch's fixture template are independent blueprint steps, so the classic render run writes both. AGENTS.md line anchors are re-derived against the merged files rather than taken from either side: trap 5 and trap 14 both pointed into files the other side had moved. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01R7cqATzg3piQsusNhm9SB7
|
Merged Three conflicts, each two independent additions in one region:
Manual-verification note 1 is now done. The body's "292 assertions" predates the merge. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Only AGENTS.md conflicted, and only on a line-number breadcrumb. Both sides shifted includes/diagnostics.php, so trap 14's anchors were stale on both and neither side's numbers were right for the merged file. Recomputed from the merged file instead of taking a side, and trap 24's breadcrumb — this branch's own, untouched by main and so unconflicted — moved by the same amount. #52 added checks 7 and 8 while this branch changed check 6, which git merged cleanly; verified both survive. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W59UqW1sLWMePpX8ZYaxy2
Summary
wp_footerstays as the last resort, and diagnostics turns red on it instead of reporting the page healthy.Phases
the_contentprint, the render marker, the readme, and both render runs/code-review highfindingsChanges
includes/embed.php—sahaj_atlas_content_element()onthe_contentat priority 99;sahaj_atlas_render_element_fallback()splits thewp_footerprint from the template print;data-sahaj-atlas-rendernames which ran;is_feed()added to the resolver's early returnincludes/diagnostics.php—sahaj_atlas_page_probe()/sahaj_atlas_read_page()and checks for placement and the loader;sahaj_atlas_client_slot()so a lane can seed the client record;sahaj_atlas_tag_attr()reads one attribute quoted, single-quoted or bare;sahaj_atlas_probe_unavailable()is the row both loopback checks fall back totests/fixture-template.php— takes the Atlas page over the way each theme kind really loses ittests/probe.php— the loopback checks, with stubbed answersTest results
pnpm test:all— syntax lint, 292 PHP assertions, both render runs, 0 failures (againstf02df15, this branch's base)tests/atlas-url-contract.jsonbyte-identical to SahajCloud's copyincludes/matchedsecurityReview.triggerPattern) — no findings/code-review highpluscomment-lint.mjs(no banned comment). The adversarial review's three findings are answered — two adopted, one rebutted with the module-script spec./simplifydid not run — the lease ran out; worth a pass on the next session.SAHAJ_ATLAS_TEST_KEYManual verification
origin/mainmerged in before CI can run.mainmoved to0540aa8while this was building (fix(page): a fixed header covers the map on the Atlas page #47 and fix(seo): robots.txt and title paths fail on part of the fleet #49 landed), and the merge conflicts inincludes/diagnostics.php,AGENTS.mdandtests/render-classic.json. Every conflict is two independent additions in one region — main's new check 6 (sitemap discovery) beside this branch's two rows, which become 7 and 8 — plusAGENTS.mdline anchors that both sides moved. A partial resolution was written and then discarded rather than pushed unvalidated.pnpm test:browser --only elementor-full-width,strip-module,astra— the three cells this PR touches.elementor-full-widthis new and has never run.Notes for reviewer
data-sahaj-atlas-renderon<sahaj-atlas>collides with nothing: the widget's only element-level attribute isdata-sy-atlas-loaded(src/loader/index.ts:152),data-sahaj-atlas-readygoes on<html>, anddocs/embedding.mdretired all nine element attributes. What is missing is a line in that doc reservingdata-sahaj-atlas-*on the element for the host — a SahajAtlasWeb change this session could not write. Worth carrying over./code-review high: a theme-builder hero can still push the content-area element's top past the viewport and clamp its height to zero, and the placement row stays green. That is chore(page): check the fleet's other themes for a header hero #37's defect reached by a new path, and turning the row red there would contradict this ticket's own criterion — red only for the footer fallback or no element.Detail
Why
the_contentand not an earlier hook. The Atlas page's content is empty, so a theme's or builder's page template that runsthe_contentis exactly the place the element belongs. Priority 99 is load-bearing: at the default prioritywpautop()wraps the element in a<p>, whose margins push the contained map's bottom edge — where the mobile drag handle sits — below the fold. Pinned by an assertion in bothtests/run.phpandtests/render.mjs; verified by moving the filter to priority 5 and watching both fail.Two callers run
the_contentwithout rendering the page body, and either would spend the single print on a string nobody shows, leaving the page with no element and the footer fallback no-opping behind it.wp_trim_excerpt()is one —get_the_excerpt()on a page with no excerpt runs the content through this filter to build one. An SEO plugin asking for a description inside<head>is the other. Both are refused, and the suite asserts on the print flag rather than only the returned string, because the string assertion passes while the flag is already spent.Fixture pre-mortem.
tests/fixture-template.phpassumes two things, both read from the real mechanism rather than from the plugin: a classic theme loses the page to a latertemplate_includefilter (priority 99, past the plugin's 10), and a block theme loses it when_wp_page_templatestops naming the plugin's template, which is what the Site Editor leaves behind. Never both at once —get_page_template()on a block theme falls through toindex.php.tests/probe.phpassumes the loader tag core prints forwp_enqueue_script_module():type,src,id="<handle>-js-module", fromWP_Script_Modules::print_enqueued_script_modules()viawp_print_script_tag(); verified against those, and the render lane asserts the real thing too.Four
/code-review highfindings fixed ind3b3364: the newpanelcells made an unstubbedclients/mecall that failed every cell's SahajCloud invariant; a transport failure is deliberately uncached, so two checks each calling the probe spent two ten-second timeouts (now one probe, handed to both rows, the way the client record already is);\bsahaj-atlas-page\balso matched core'spage-template-sahaj-atlas-page, collapsing the two no-element diagnoses into the wrong one on every page whose meta still names our template; and a volunteer who changed the page's template still saw the red row for five minutes (save_postnow drops the probe).Three adversarial-review findings, answered. Every reader in
sahaj_atlas_read_page()required double-quoted attributes, and an HTML minifier drops optional quotes from any value with no spaces — which is the whole set this probe reads. The marker then read as absent and check 6 told the volunteer their working page had no map. One reader,sahaj_atlas_tag_attr(), now handles",'and none (c444eba).sahaj_atlas_probe_excuse()becamesahaj_atlas_probe_unavailable()(cc4dcaa). The third — matchdeferbesideasync— is rebutted:deferis a no-op on a module script, since the HTML spec defers module scripts already anddocument.currentScriptis null for a module either way, so SahajAtlasWeb's loader reaches its tag throughscript[src*="auto.js"]regardless (src/loader/index.ts:346).asyncis honoured on a module and does break it, so it stays alone.embedding.md:87's "Noasyncordefer" is the rule for a host's classic snippet, not for the module tag core prints here.81406e2pins the distinction.sslverifyis off on the loopback, as core's own Site Health loopback test has it. A server that cannot verify its own host's certificate is common on this fleet, and a red row a volunteer cannot act on is the shape that sends them to us about a working site. The probe stores a flag for the loader, not the tag — the tag carries the key in itssrc, and the array goes into a transient.tests/no-network.phpnow lets a request to the instance's own host through. That is not a way out of the instance, and refusing it would make the loopback check report "could not reach the page" in every lane — the one answer that tells a lane nothing. Calls to SahajCloud and to third parties stay refused, and the per-cell invariant still proves it.Every assertion here failed once first. Without the
the_contentfilter, both render runs put the element below the footer. Without each guard, the excerpt and<head>cases spend the print. With the naive\basync\bmatch, an optimiser'sdata-async-ignoremarker reports a working page broken. With\bon the body class, core's own template class reads as ours. With the quote-only attribute pattern, a minified page reads as a page with no map. Withdeferfolded into theasyncmatch, a working page reads as broken.Closes #39
🤖 Generated with Claude Code
https://claude.ai/code/session_016qsV5T5e7fJsFwNSBfzztt