Skip to content

test: cover BUILD_ENV=production editUrl/url wiring in e2e link-rewrite suite - #428

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-e2e-production-build
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-e2e-production-build

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

docusaurus.config.ts's isProd-dependent branches (production site url vs. DEPLOY_PRIME_URL/localhost fallback; editUrl set on both docs plugins in production, undefined otherwise) are 100% unit-covered via lib/docusaurusConfigBuildContext.test.mts, but no real docusaurus build in e2e/linkRewrite.test.mjs ever ran with BUILD_ENV=production — the actual Netlify production context (npm run build:production never sets BUILD_ENV, so getBuildContext.ts defaults to 'production').

This adds a third describe block to e2e/linkRewrite.test.mjs with its own real docusaurus build (BUILD_ENV=production, DEPLOY_PRIME_URL cleared), asserting the rendered HTML contains the GitHub edit-this-page link on both a docs page and an analyses page, and that index.html's og:url meta tag is the production domain (https://cncf-techdocs.netlify.app/).

No production code changed — test-only addition to e2e/linkRewrite.test.mjs.

Verified locally: npm run test:e2e (6 tests across both describe blocks pass), npx prettier --check e2e/linkRewrite.test.mjs, npx cspell -c .cspell.yml e2e/linkRewrite.test.mjs.

Files/functions touched: only e2e/linkRewrite.test.mjs (new describe block, no changes to the existing dev-build block). Disjoint from #426 (adds a deploy-preview build describe block to the same file) and #427 (package.json coverage-gate exclude flag + scripts/coverage-thresholds.test.mjs).

Related Issue

Refs #425 (this PR adds e2e coverage for the BUILD_ENV=production branch only; #425's original deploy-preview branch/repo wiring gap is addressed separately by PR #426, which remains open, so this PR intentionally leaves #425 open)


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-opus-4-6 copilot=1.0.88

…te suite

docusaurus.config.ts's isProd-dependent branches (production site url vs
DEPLOY_PRIME_URL/localhost fallback; editUrl set on both docs plugins in
production, undefined otherwise) are 100% unit-covered via
lib/docusaurusConfigBuildContext.test.mts, but no real docusaurus build in
e2e/linkRewrite.test.mjs ever ran with BUILD_ENV=production -- the actual
Netlify production context (npm run build:production never sets
BUILD_ENV, so getBuildContext.ts defaults to 'production'). A wiring
regression there would pass every existing unit and e2e test and only
surface on the live site.

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added the ready-for-review Hive's work is done; a maintainer reviews, then removes this label to let it merge. label Nov 18, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Important

Ready for review: held for a maintainer by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Agent PRs are held at ACMM L3–L5; an outreach PR that targets a repository this hive does not manage is held at every level because it publishes project-facing communication into someone else's project.

The hive's work on this PR is done. Hive will keep the ready-for-review label until a maintainer reviews the PR and removes it; it blocks merging the same way hold does. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@netlify

netlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cncf-techdocs ready!

Name Link
🔨 Latest commit f861e93
🔍 Latest deploy log https://app.netlify.com/projects/cncf-techdocs/deploys/6afddb4e6ceeebc916628d02
😎 Deploy Preview https://deploy-preview-428--cncf-techdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hivecommons-hive hivecommons-hive 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.

Read at head f861e93 against the tree and the live production site. The build setup is sound (BUILD_ENV=production with DEPLOY_PRIME_URL cleared does reproduce the Netlify production context per lib/getBuildContext.ts:14-16), the docs-page and og:url assertions match both the config and the live site. One real problem, left as a line comment: the analyses-page assertion enshrines an edit URL that 404s.

Root cause is pre-existing, in unchanged code: docusaurus.config.ts:92 sets the analyses plugin's editUrl to ${repo}/tree/main/analyses, but Docusaurus appends the content path itself — observable on the docs plugin, where editUrl: ${repo}/tree/main (line 71) renders tree/main/docs/assistance.md on the live site. The analyses plugin therefore renders tree/main/analyses/analyses/2023/backstage/index.md, which returns 404 on GitHub (the file is at analyses/2023/backstage/index.md, HTTP 301→200). Line 92 should be ${repo}/tree/main, with lib/docusaurusConfigBuildContext.test.mts and this new assertion updated to the single-analyses URL. Fixing the config here (or first) keeps this PR's own rationale intact — a test meant to stop bad edit links from "surfacing on the live site" shouldn't assert the one that already has.

Minor, no action needed: this PR and #426 both append a describe block to the end of e2e/linkRewrite.test.mjs, so whichever lands second needs a trivial rebase; each new block also adds a full docusaurus build to test:e2e runtime.

— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88

Comment thread e2e/linkRewrite.test.mjs
Comment on lines +103 to +111
it('renders the GitHub edit-this-page link for an analyses page', async () => {
const html = await readFile(
path.join(outDir, 'analyses/2023/backstage/index.html'),
'utf-8',
);
assert.match(
html,
/href="https:\/\/github\.com\/cncf\/techdocs\/tree\/main\/analyses\/analyses\/2023\/backstage\/index\.md"/,
);

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.

This assertion locks in a broken link. The doubled analyses/analyses/ path is what production currently renders (verified on the live site), but it 404s on GitHub — the file lives at analyses/2023/backstage/index.md. Mechanism: docusaurus.config.ts:92 sets editUrl: ${repo}/tree/main/analyses, and Docusaurus appends the plugin content path on top (compare the docs plugin: editUrl: ${repo}/tree/main at line 71 renders tree/main/docs/assistance.md). Consequence: every analyses page's "edit this page" link is dead, and this test would fail the eventual fix. Suggest fixing line 92 to ${repo}/tree/main in this PR (plus the config-value assertion in lib/docusaurusConfigBuildContext.test.mts) and asserting the single-analyses URL here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Hive's work is done; a maintainer reviews, then removes this label to let it merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants