Skip to content

test: cover bare query-string href branch in the real e2e build - #449

Merged
nate-double-u merged 4 commits into
mainfrom
quality/test-bare-query-href-e2e
Nov 24, 2026
Merged

nate-double-u merged 4 commits into
mainfrom
quality/test-bare-query-href-e2e

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

rewriteHref()'s empty-path early return (if (!original) return href;) for a bare query/fragment destination like ?view=raw was already 100% unit-covered in isolation (lib/remarkRewriteLinks/index.test.mts: 'leaves a bare query/fragment href (empty path) untouched'), but no e2e build exercised it through the real remark pipeline wired into a Docusaurus build. Every other link asserted in e2e/linkRewrite.test.mjs has a non-empty path, so a regression confined to this early return (for example, one that started stripping the query string instead of leaving the href untouched) would pass every existing unit and e2e assertion.

Adds a describe block that writes a temporary fixture (analyses/2024/keda/e2e-bare-query-fixture.md) containing a bare query-string link into the real content tree, runs a docusaurus build, and asserts the rewritten anchor still carries the untouched query string, removing the fixture afterward so no content change survives the test run.

Verified locally: node --test e2e/linkRewrite.test.mjs passes (15/15, up from 14), npm run test:coverage still reports 100/100/100/100, npm run check:format passes, and git status is clean after the run. e2e-only coverage on lib/remarkRewriteLinks/index.ts (npx c8 --all --include lib/remarkRewriteLinks/index.ts node --test e2e/linkRewrite.test.mjs) now exercises this branch, which the text reporter previously flagged as uncovered.

No production code changed - test-only.


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

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

rewriteHref()'s empty-path early return (if (!original) return href;)
for a bare query/fragment destination like '?view=raw' was 100%
unit-covered in isolation (lib/remarkRewriteLinks/index.test.mts: 'leaves
a bare query/fragment href (empty path) untouched') but no e2e build
exercised it through the real remark pipeline wired into a Docusaurus
build. Every other e2e link in e2e/linkRewrite.test.mjs has a non-empty
path, so a regression confined to this early return (e.g. one that
started stripping the query string instead of leaving the href
untouched) would pass every existing unit and e2e assertion.

Adds a describe block that writes a temporary fixture containing such a
link into the real content tree, runs a docusaurus build, and asserts
the rewritten anchor still carries the untouched query string, removing
the fixture afterward so no content change survives the test run.

No production code changed - test-only.

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 24, 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 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cncf-techdocs ready!

Name Link
🔨 Latest commit 449ae14
🔍 Latest deploy log https://app.netlify.com/projects/cncf-techdocs/deploys/6b05e41bb8edea868656eb54
😎 Deploy Preview https://deploy-preview-449--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.

Verified end-to-end, looks correct to me.

  • The targeted branch is real: lib/remarkRewriteLinks/index.ts:87 (if (!original) return href;) is reached only when splitHref() yields an empty path, which a bare ?view=raw destination does, and no pre-existing e2e link exercised it.
  • The new suite mirrors the established fixture pattern already in this file (the .mdx fixture suite at e2e/linkRewrite.test.mjs:273-344): temp fixture in the real content tree, dedicated build, unlink().catch() + rm cleanup in after(). All imports (writeFile, unlink, mkdtemp, tmpdir, execFileSync) were already present at the top of the file.
  • Since this repo's CI runs no test workflow, I ran it locally at head 776504d: node --test e2e/linkRewrite.test.mjs passes 15/15 including the new assertion (the build renders href="/?view=raw" as asserted), and git status is clean afterward, so the fixture does not leak into the tree.

Test-only, no production code changed. Approval is a maintainer's call, but I found nothing to flag.

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

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.

🟢 Approval recommended

No active review issues are recorded for the added end-to-end coverage of bare query-string links.

No open issues 🎉

What changed in this PR

Adds end-to-end coverage for bare query-string links through the real Docusaurus remark pipeline, complementing existing unit coverage without changing production code.

Changes:

  • Creates a temporary Markdown fixture containing a ?view=raw link and runs a production build.
  • Checks that the rendered anchor retains the query string.
  • Removes the fixture and temporary build output afterward.
File Description
e2e/​linkRewrite.test.mjs Adds the bare query-string build test, fixture setup, and cleanup.

Review effort: Balanced

@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 the diff against lib/remarkRewriteLinks at merge-base. The target branch is real: rewriteHref's empty-path early return is only reachable via a bare query/fragment href, and no existing e2e fixture has one, so the claimed gap exists. The fixture-write/build/assert/unlink flow is self-contained and the after hook removes the fixture (unlink(...).catch(() => {})), so a normal run leaves the checkout clean.

Two non-blocking observations:

  • If the test process dies between before and after (e.g. SIGKILL mid-build), the fixture file is left behind in the real content tree as an untracked file. Acceptable for a local/e2e suite, just worth knowing when a dirty analyses/2024/keda/ shows up.
  • The assertion matches the exact serialized anchor (<a class="" href="/?view=raw">), which couples the test to Docusaurus's current attribute serialization; a Docusaurus upgrade could break the test without a real regression. A looser match on href="/?view=raw" would be more durable. Suggestion only, not a defect.

Test-only change, all checks green. Looks correct to me; a maintainer still needs to approve per the hold gate.

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

@nate-double-u
nate-double-u enabled auto-merge (squash) November 24, 2026 19:22
@nate-double-u
nate-double-u merged commit 3c1e2b5 into main Nov 24, 2026
9 checks passed
@nate-double-u
nate-double-u deleted the quality/test-bare-query-href-e2e branch November 24, 2026 19:23
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.

2 participants