Skip to content

[codex] Fix test env webmcp and site chrome#189

Merged
eviltester merged 5 commits into
masterfrom
185-webmcp-test-env
Jun 12, 2026
Merged

[codex] Fix test env webmcp and site chrome#189
eviltester merged 5 commits into
masterfrom
185-webmcp-test-env

Conversation

@eviltester

@eviltester eviltester commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • hide the top header on the top-level test environment webmcp.html page so it behaves like the standalone app and generator test pages
  • keep the /site/app.html and /site/generator.html navbar intact while still injecting the test environment indicator styles
  • add integration coverage for the testenv header-hiding helper behavior

Why

The test environment publish flow was stripping headers from nested /site/* pages that should retain the normal site navbar, while the standalone webmcp.html page was not getting the same no-navigation treatment as the other top-level test pages.

Validation

  • Skipped rerunning verification in this publish step per request
  • Earlier in the working session, pnpm run verify:local passed

Summary by CodeRabbit

  • Chores

    • Enhanced SEO metadata handling with canonical URLs now included for webmcp.html in generated site references.
    • Refactored header-hiding transformations for consistency across published pages.
  • Tests

    • Expanded test coverage for SEO directive application and header-hiding behavior.
    • Added tests verifying canonical URL inclusion and style rule deduplication.

Copilot AI review requested due to automatic review settings June 12, 2026 10:17
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@eviltester, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 27 minutes and 29 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 193f28e3-16cf-4f8a-b7ff-24732f819956

📥 Commits

Reviewing files that changed from the base of the PR and between 4a2f63b and e2a455b.

📒 Files selected for processing (1)
  • scripts/create-testenv.mjs
📝 Walkthrough

Walkthrough

The PR extends canonical URL support to webmcp.html, refactors the header-hiding HTML transformation to use upsertHeadStyle for cleaner style injection, ensures pages are always persisted after transformation, and applies SEO directives to top-level app pages. The header-hiding function is now exported and tested comprehensively.

Changes

webmcp.html Canonical and Header-Hiding Support

Layer / File(s) Summary
Canonical URL Configuration
scripts/create-testenv.mjs
ROOT_PAGE_CANONICALS is extended with a webmcp.html mapping, and createLlmsTxt() now includes the webmcp.html canonical URL in the "Primary production URLs" list.
Header-Hiding Mechanism Refactor
scripts/create-testenv.mjs
hideTopHeaderInBuiltHtml switches from conditional </head> string replacement to using upsertHeadStyle to insert/update a data-testenv-hide-header style block; applyTopHeaderHideToHtml directly delegates to it; hideTopHeaderInBuiltPage removes early-return behavior and always persists the transformed HTML.
Apply Transformations to Pages
scripts/create-testenv.mjs
main() now processes webmcp.html with hideTopHeaderInBuiltPage and explicitly applies SEO directives with canonical URLs to fullSiteDir's app.html, generator.html, and combinatorial.html.
Public Export and Test Coverage
scripts/create-testenv.mjs, tests/integration/create-testenv-seo.test.js
Module exports applyTopHeaderHideToHtml; test suite imports it, updates createLlmsTxt() expectations to include /webmcp.html, and adds tests verifying header-hiding injection for top-level pages, SEO directive behavior for webmcp.html, and style block update without duplication.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • eviltester/grid-table-editor#186: Both PRs modify scripts/create-testenv.mjs and tests/integration/create-testenv-seo.test.js to extend webmcp.html support with canonical URLs and refactor header-hiding behavior.

Poem

🐰 A webmcp emerges, all styled so neat,
Hiding headers with grace, the refactor complete,
Canonicals declared from start to the end,
Tests bloom like carrots, our work they defend! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[codex] Fix test env webmcp and site chrome' directly addresses the main changes: fixing webmcp test environment handling and site chrome (header/navbar) behavior as described in PR objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 185-webmcp-test-env

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the test-environment publishing script so the top-level webmcp.html behaves like the other standalone test pages (no site chrome), while ensuring nested /site/*.html pages retain the normal site navbar and still receive the test-environment SEO/indicator directives. Adds integration coverage for the new header-hiding helper.

Changes:

  • Extracts applyTopHeaderHideToHtml and uses it to hide the top header on webmcp.html (in addition to other top-level test pages).
  • Stops stripping headers from /site/app.html, /site/generator.html, and /site/combinatorial.html; instead applies SEO directives (including testenv indicator + canonical URLs).
  • Adds Jest integration tests validating header-hide injection and non-duplication behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scripts/create-testenv.mjs Adds an HTML-level helper for header hiding, applies it to webmcp.html, and adjusts /site/* handling to preserve navbar while still injecting SEO/indicator directives.
tests/integration/create-testenv-seo.test.js Adds integration tests covering applyTopHeaderHideToHtml injection and idempotency.

Comment thread scripts/create-testenv.mjs Outdated
@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown

Greptile Summary

This PR extends the test-environment publish script to include webmcp.html consistently alongside the three other root pages (app.html, generator.html, combinatorial.html) — both hiding the top navigation header at outputDir and injecting SEO directives (noindex, canonical, testenv indicator badge) at fullSiteDir/site/. A thin re-export wrapper (applyTopHeaderHideToHtml) is added to enable white-box testing without exposing the internal hideTopHeaderInBuiltHtml name directly.

  • webmcp.html is added to ROOT_PAGE_CANONICALS so the existing for-loop at line 622 naturally covers the outputDir SEO pass, and a new explicit applySeoDirectivesToFile call covers its fullSiteDir copy.
  • The refactored hideTopHeaderInBuiltHtml now delegates to upsertHeadStyle, which replaces an existing data-testenv-hide-header block instead of appending a second one — resolving the prior idempotency gap.
  • New tests verify header-hiding via the new wrapper, the webmcp.html canonical/SEO rewrite, and the no-duplication guarantee for the hide-header style.

Confidence Score: 5/5

Safe to merge — the changes are additive and symmetric, giving webmcp.html the same build-script treatment already applied to the three other root pages.

All four root pages are now handled consistently in both the header-hiding pass (outputDir) and the SEO-directives pass (fullSiteDir). The idempotency concern from the previous review thread is resolved by delegating to upsertHeadStyle. New tests cover the header-hiding wrapper, the webmcp.html canonical rewrite, and the no-duplication guarantee. No logic regressions identified.

No files require special attention.

Important Files Changed

Filename Overview
scripts/create-testenv.mjs Adds webmcp.html to ROOT_PAGE_CANONICALS, header-hiding pass, and fullSiteDir SEO calls; introduces applyTopHeaderHideToHtml wrapper; all four root pages now handled symmetrically
tests/integration/create-testenv-seo.test.js Adds three new tests: header-hiding via the new wrapper, webmcp.html canonical SEO rewrite, and no-duplication guarantee for the hide-header style block

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Web Build] --> B[copyWebBuild to outputDir]
    B --> C[hideTopHeaderInBuiltPage app.html / generator.html / combinatorial.html / webmcp.html]
    C --> D[Storybook build]
    D --> E[Docusaurus build to fullSiteDir]
    E --> F[copyWebBuild to fullSiteDir]
    F --> G[applySeoDirectivesToFile fullSiteDir pages]
    G --> H[rm tempWebDir]
    H --> I[for ROOT_PAGE_CANONICALS applySeoDirectivesToFile outputDir]
    I --> J[applySeoDirectivesToDirectory storybookDir]
Loading

Reviews (3): Last reviewed commit: "apply site seo directives to webmcp" | Re-trigger Greptile

Comment thread scripts/create-testenv.mjs
Comment thread scripts/create-testenv.mjs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/create-testenv.mjs`:
- Around line 598-606: The build copies apps/web/webmcp.html into fullSiteDir
but the script only calls applySeoDirectivesToFile for app.html, generator.html,
and combinatorial.html so webmcp.html lacks SEO directives; update the
fullSiteDir processing to also call
applySeoDirectivesToFile(path.join(fullSiteDir, 'webmcp.html'), { canonicalUrl:
ROOT_PAGE_CANONICALS['webmcp.html'] }) or alternatively iterate
ROOT_PAGE_CANONICALS for the fullSiteDir so that applySeoDirectivesToFile is
invoked for 'webmcp.html' (references: applySeoDirectivesToFile, fullSiteDir,
ROOT_PAGE_CANONICALS, 'webmcp.html').
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 18c39974-c045-4eb1-a639-3004749f238a

📥 Commits

Reviewing files that changed from the base of the PR and between 88489fb and 4a2f63b.

📒 Files selected for processing (2)
  • scripts/create-testenv.mjs
  • tests/integration/create-testenv-seo.test.js

Comment thread scripts/create-testenv.mjs
@eviltester eviltester merged commit 09538e5 into master Jun 12, 2026
14 checks passed
@eviltester eviltester deleted the 185-webmcp-test-env branch June 12, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants