Skip to content

fix(page): three small defects from the integration audit - #51

Merged
Ardnived merged 3 commits into
mainfrom
fix/42-audit-small-defects
Oct 1, 2026
Merged

Ardnived merged 3 commits into
mainfrom
fix/42-audit-small-defects

Conversation

@Ardnived

@Ardnived Ardnived commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • A classic theme with no header.php now gets the Atlas template's own minimal document, not core's 2010 compat header.
  • The diagnostics file header no longer claims an empty allowedDomains refuses the embed report. Check 4 stays green for an empty list. That breaks from the issue on purpose; see the notes.
  • The body-class docblock now points at fix(page): the Atlas page breaks when another template renders it, unnoticed #39 instead of a loopback probe that does not exist.

Test results

  • pnpm test:all: ✓. Lint covers 12 files, 0 syntax errors. Behaviour suite: 241 assertions, 0 failures. Render lane: 0 failures.
  • New render-lane checks (headerless: …, classic run): 4 pass. Two of them failed against the old locate_template() detection. The served page was core's compat header (<link rel="profile" …>, no viewport tag).
  • pnpm test:browser --only astra,twentytwentyfive: 0 failure(s), 0 known, 6 widget finding(s). All six are "the widget's typeface survives the theme" and belong to SahajAtlasWeb. This change does not touch them.
  • Check 4 with an empty list is already covered: tests/domains.php:58, under a ⚠. I made check 4 return warn for an empty list, the change the issue asked for, and that assertion failed (expected: 'ok', actual: 'warn'). Then I restored it.

Manual verification

None required. The render lane serves the headerless page. To see it by hand: activate a classic theme that has no header.php and open the Atlas page. The source should have <meta name="viewport"> and no id="headerimg".

Notes for reviewer

Item 2 is not built as the issue asked, because the server does the opposite. An empty allowedDomains does not refuse the embed report on SahajCloud main:

  • assertClientOriginAllowed() (src/plugins/usage/hooks.ts:341) returns early for an empty list.
  • POST /api/clients/report checks the reported host only when patterns.length > 0 (src/collections/Clients/endpoints/report.ts:156). That guard has been there since the endpoint landed in SahajCloud#635.
  • SahajCloud's own test "answers a repeated identical report without writing" (tests/int/client-canonical.int.spec.ts) stores a report from a client with no list.

So the defect was the file header, which contradicted check 4's docblock, AGENTS.md trap 14 and tests/domains.php. Making check 4 warn would bring back the confident wrong row that those ⚠ comments record. The ticket's acceptance box "Check 4 is not green for an empty allowedDomains" is left unmet on purpose. If you want that behaviour anyway, the server has to change first.

Cross-repo follow-up, not done here: SahajAtlasWeb repeats the same wrong claim, in docs/embedding.md:306 ("an empty list refuses here") and in the comment at src/lib/embed-announce.ts:95. Both landed in SahajAtlasWeb#159, one day before the server endpoint. That repo needs a fix or a ticket.

Detail
  • Detection. file_exists() under get_stylesheet_directory() and get_template_directory(). These are the same two directories locate_template() searches, without its theme-compat fallthrough (6.7.9 template.php:794-798). The header variant is not consulted. Core falls back to header.php when a variant is missing, so header.php is the deciding file.
  • Fixture. tests/fixtures/headerless/ is style.css plus index.php. tests/fixture-theme.php now swaps in either mesmerize or headerless, from a strict allowlist. The check asserts both "not id=\"headerimg\"" and "has name=\"viewport\"". Neither the compat header nor the plain sahaj-classic header prints a viewport tag, so the second assertion also shows the swap took effect.
  • Merging with fix(seo): robots.txt and title paths fail on part of the fleet #49. The headerless block sits above the mesmerize block. fix(seo): robots.txt and title paths fail on part of the fleet #49 inserts its Yoast block directly below it, and placing both there would conflict. git merge-tree of this branch with claude/fix-43-seo-robots-title is clean. The diagnostics change is one header bullet. It renumbers no check and leaves the check list alone.
  • AGENTS.md pointers. The inserted lines shift render.mjs:105→106 and 298→314. Trap 14's diagnostics.php:262,398 had already drifted. It now points at check 4's ⚠ (283) and the suffix-injection ⚠ (495), the lines it named when it was written (f6e7bd7).

Closes #42

🤖 Generated with Claude Code

Ardnived and others added 3 commits October 1, 2026 11:51
… document

The template asked `locate_template()` whether the theme has a
`header.php`. Core's `locate_template()` falls through to
`wp-includes/theme-compat/header.php` (WordPress 6.7.9 template.php:798),
so the answer was always yes, the minimal-document branch never ran, and
such a theme got core's deprecated 2010 compat header: its own banner,
no viewport tag.

Test `file_exists()` under the stylesheet and template directories
instead. A render-lane check serves a `headerless` fixture theme and
asserts the template's own document, not the compat one; it failed
against the old detection.

AGENTS.md's render.mjs line pointers move with the inserted lines.

Refs #42

Co-Authored-By: Claude Opus 5.5 <[email protected]>
It said the class was there "for the diagnostics loopback probe to
recognise". No such probe exists; #39 proposes one. Point at the ticket
instead.

Refs #42

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s the embed report

It does not. On SahajCloud main, `assertClientOriginAllowed()` returns
early for an empty list, and `POST /api/clients/report` checks the
reported host only when the list is non-empty — its own integration
suite stores a report from a client with no list. So check 4's green row
for an empty list is right, as its own docblock and AGENTS.md trap 14
already say, and `tests/domains.php` pins it under a ⚠: turning that row
into a warning fails "so the panel reports it as fine, not as broken".

The defect was the file header contradicting all three. It now names the
failure check 4 does catch — a non-empty list without this site's domain
— and says an empty one refuses nothing, the report included.

AGENTS.md trap 14's pointers had drifted; they point at check 4's ⚠ and
the suffix-injection ⚠ again.

Refs #42

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived
Ardnived merged commit b22dc25 into main Oct 1, 2026
7 checks passed
@Ardnived
Ardnived deleted the fix/42-audit-small-defects branch October 1, 2026 18:56
sydevs-bot pushed a commit that referenced this pull request Oct 1, 2026
Both sides added to the same two places.

tests/render.mjs: #51's headerless-theme block and this branch's script
ordering assertion landed at the same line. Both kept, the ordering one
first, since it reads `elementAt` from the assertion above it.

AGENTS.md: both sides repointed trap 5's render.mjs reference, so neither
number survives the merge. Re-derived against the merged file: 321, on the
⚠ line #51's side had moved it to.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01C4H64tVputWUuN3kZXmKMb
Ardnived added a commit to sydevs/SahajAtlasWeb that referenced this pull request Oct 1, 2026
#241)

The guide's troubleshooting table and the embed-report comment said an
empty `allowedDomains` refuses `clients/report`. SahajCloud allows every
origin for an empty list there as on the read endpoints
(`src/collections/Clients/endpoints/report.ts:156`,
`src/plugins/usage/hooks.ts:341` on main). The WordPress plugin repeated
the claim and corrected it in sydevs/SahajAtlasWordpress#51.

Co-authored-by: Claude Opus 5.5 <[email protected]>
sydevs-bot pushed a commit that referenced this pull request 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
@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(page): three small defects from the integration audit

1 participant