Repository navigation
test: cover cross-plugin image href handling in e2e link-rewrite suite - #437
Conversation
rewriteHref()'s image-node branch (cross-plugin .png href left untouched for Docusaurus's native asset resolver) is unit-tested in isolation but had no end-to-end assertion against a real build, unlike every other branch in this file. Add a case using the existing analyses/2021/kubernetes-gateway-api/analysis.md image so a regression that rewrote (and thereby broke) the cross-plugin image href would fail here even if the unit test still passed. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
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 The hive's work on this PR is done. Hive will keep the |
✅ Deploy Preview for cncf-techdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Reviewed by Reviewer notesVerified correct - this looks good to me (comment only; approval is a human's call). What I checked, against the tree at head 9bc8876:
The test fills a genuine gap: |
There was a problem hiding this comment.
🟡 Changes recommended
The E2E test’s coverage description incorrectly claims existing unit tests cannot catch the image-href rewrite regression and should instead emphasize Docusaurus integration and hashed asset resolution.
1 open issue
What changed in this PR
This test-only PR extends the link-rewrite end-to-end suite to cover cross-plugin image resolution in a production Docusaurus build.
Changes:
- Checks that the Kubernetes Gateway API analysis page references the expected hashed image asset.
- Adds comments explaining why non-Markdown image paths are left to Docusaurus’s asset resolver.
| File | Description |
|---|---|
e2e/linkRewrite.test.mjs |
Adds a real-build assertion for the cross-plugin image’s hashed URL. |
Review effort: Balanced
|
/hive have a look at the copilot findings |
|
There was a problem hiding this comment.
Read the diff against the tree at main. The claims check out:
analyses/2021/kubernetes-gateway-api/analysis.md:109really contains../../../docs/images/gapi_info_arch.png, anddocs/images/gapi_info_arch.pngexists.lib/remarkRewriteLinks/index.tsvisitsimagenodes andrewriteHrefintentionally leaves non-Markdown cross-plugin assets untouched (documented in the module header); the unit test "leaves cross-plugin image assets untouched" covers it in isolation, and no e2e assertion exercised theimagevisitor branch against a real build before this. The hashed-asset regex matches how Docusaurus emits bundled images under a productionbaseUrlof/.
One mechanical item: the branch now conflicts with main because #434 merged a test into the same hunk of e2e/linkRewrite.test.mjs (after the criteria assertion at line 51). The conflict is textual only - the two tests are disjoint - so a rebase that keeps both it() blocks resolves it.
Test-only change. Content looks correct to me; needs a rebase before it can merge.
-- hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
Copilot review correctly pointed out that the claim 'a regression would pass every unit test' was false: lib/remarkRewriteLinks/index.test.mts already asserts (both directly and through the pipeline) that this cross-plugin .png href stays unchanged, so a rewrite regression would already fail those unit tests. Verified by locally removing the isCrossPage extension guard: 2 existing unit tests failed. Reworded the comment to describe this e2e test as verifying Docusaurus integration and hashed-asset resolution instead. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Looked at the Copilot finding. It was correct: the PR text claimed a regression here would "pass every unit test," but Fixed in commit 985338c: reworded the e2e test's explanatory comment to describe it as verifying Docusaurus integration and hashed-asset resolution, which is what it actually adds, rather than catching a rewrite regression unit tests would miss. Also updated the PR description, which repeated the same claim. Full reply with the verification details is in the review thread. |
There was a problem hiding this comment.
Read the test against the repository at main. The content is correct; the only blocker is a mechanical merge conflict.
Verified, not inferred:
analyses/2021/kubernetes-gateway-api/analysis.md:109really carries the cross-plugin../../../docs/images/gapi_info_arch.pngimage, anddocs/images/gapi_info_arch.pngexists, so the asserted hashed/assets/images/gapi_info_arch-<hash>.pngURL is what a correct build emits.- The output path pattern (
analyses/2021/kubernetes-gateway-api/analysis/index.html) matches how the existing keda assertion addresses built pages in this suite. - The claim in the comment block is accurate:
lib/remarkRewriteLinks/index.test.mtscovers theimagevisitor branch in isolation, and no e2e assertion covered animagenode before this; the suite's existing assertions coverlinkanddefinitiononly.
The one thing that keeps this from merging: the PR is in conflict with main (mergeable: CONFLICTING). main moved under it when #434 landed its reference-style test at the same insertion point in e2e/linkRewrite.test.mjs. A rebase onto current main resolving that one hunk is all that is needed; no content change required. Leaving this to the author since the head was pushed recently.
-- hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
|
/hive resolve PR conflicts. |
Keeps both the cross-plugin image href test from this branch and the reference-style link test added on main; neither change touched the other's assertions. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Verified: the PR had a real merge conflict with main in e2e/linkRewrite.test.mjs (both branches added adjacent, non-overlapping tests - the cross-plugin image href test here and the reference-style link test merged into main). Resolved by keeping both tests in commit e9a6a5b, pushed to this branch. Ran the full e2e suite locally afterward; all 11 tests pass. PR mergeability is now MERGEABLE (GitHub still shows BLOCKED, which is the review/hold gate, not a conflict). |
There was a problem hiding this comment.
Verified against the tree at e9a6a5b, not just the diff:
- The target content exists:
analyses/2021/kubernetes-gateway-api/analysis.md:109references../../../docs/images/gapi_info_arch.png, anddocs/images/gapi_info_arch.pngis in the repo. - The new test follows the suite's existing pattern (shared
beforebuild,readFilefromoutDir, regex assertion) and asserts the hashed-asset form/assets/images/gapi_info_arch-<hash>.png, which is Docusaurus's standard output for an href the remark plugin leaves untouched. - Ran the full e2e suite locally at this head: 11/11 pass, including the new test.
One note, not a defect: no CI workflow runs the test suites (CI is format/link/spell only), so this test only guards regressions when someone runs npm test locally. That is a pre-existing gap, not something this PR introduces.
Looks correct to me. Approval and merge are a maintainer's call.
-- hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88

Test Improvement
lib/remarkRewriteLinks/index.ts's remark plugin visits
link,image,and
definitionmdast nodes. e2e/linkRewrite.test.mjs's real-build suitealready asserts the
linkanddefinitionbranches against real content,but had no assertion for the
imagebranch, even though real content(analyses/2021/kubernetes-gateway-api/analysis.md) exercises it: a
cross-plugin
../../../docs/images/gapi_info_arch.pnghref that must stayuntouched so Docusaurus's native asset resolver can cross the plugin
boundary.
This adds one e2e test asserting the built page's
<img>src resolves tothe correct hashed
/assets/images/...URL. This closes a real-buildcoverage gap:
lib/remarkRewriteLinks/index.test.mtsalready unit-teststhat
rewriteHref()leaves this exact cross-plugin.pnghref unchanged(both directly and through the full remark pipeline), so a regression in
that rewrite logic would already be caught by the unit tests. What was
missing is end-to-end verification that the untouched href actually
resolves through Docusaurus's asset pipeline to the correct hashed URL in
a real build. Confirmed the gap by locally removing the
isCrossPageextension guard: the real build then emitted a broken
<img>src, andtwo existing unit tests (
leaves cross-plugin image assets untouchedandrewrites inline, reference, image and angle-bracketed destinations)correctly failed too.
Related Issue
No tracking issue filed - this is a single, self-contained Priority 2
(unit-covered, not end-to-end) finding per the coverage-evidence policy, not
part of a larger deliverable.
Filed by quality agent (hold-gated mode). Human review required.
-- hive: agent=quality backend=copilot model=claude-opus-4-6 copilot=1.0.88