From 656cd55fc7732ee96b9b86e8c4513afa54eb7856 Mon Sep 17 00:00:00 2001 From: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 20 Nov 2026 02:15:49 -0500 Subject: [PATCH 1/2] test: cover cross-plugin image href handling in e2e link-rewrite suite 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> --- e2e/linkRewrite.test.mjs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/e2e/linkRewrite.test.mjs b/e2e/linkRewrite.test.mjs index 9a346225..cdf1aad9 100644 --- a/e2e/linkRewrite.test.mjs +++ b/e2e/linkRewrite.test.mjs @@ -51,6 +51,29 @@ describe('production build applies the link-rewrite plugins end-to-end', () => { assert.match(html, /href="\/docs\/analysis\/criteria\/"/); }); + // `lib/remarkRewriteLinks/index.test.mts` unit-tests the `image` visitor + // branch in isolation ("leaves cross-plugin image assets untouched"): + // rewriteHref() returns a cross-plugin `.png` image href unchanged because + // only `.md`/`.mdx`/extensionless cross-plugin paths get rewritten, leaving + // non-Markdown assets to Docusaurus's own asset resolver. No suite had + // asserted that this real analyses/2021/kubernetes-gateway-api/analysis.md + // image actually resolves in a real build: the remark plugin's `link` and + // `definition` node handling is already e2e-asserted elsewhere in this + // file, but the `image` node the visitor also walks was not. A regression + // that made the plugin rewrite (and thereby break) cross-plugin image + // hrefs would pass every unit test while still producing a broken `` + // src in the real site. + it('leaves a cross-plugin image href untouched so Docusaurus resolves it to a hashed asset URL', async () => { + const html = await readFile( + path.join( + outDir, + 'analyses/2021/kubernetes-gateway-api/analysis/index.html', + ), + 'utf-8', + ); + assert.match(html, /src="\/assets\/images\/gapi_info_arch-[0-9a-f]+\.png"/); + }); + it('rewrites an unbundled .csv asset link to its GitHub blob URL', async () => { const html = await readFile( path.join(outDir, 'analyses/2023/backstage/index.html'), From 985338c05546b1471fe1c717673d3c9260779feb Mon Sep 17 00:00:00 2001 From: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 20 Nov 2026 11:39:34 -0500 Subject: [PATCH 2/2] docs: correct e2e test comment on unit-test coverage claim 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> --- e2e/linkRewrite.test.mjs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/e2e/linkRewrite.test.mjs b/e2e/linkRewrite.test.mjs index ce7cddfa..b85530eb 100644 --- a/e2e/linkRewrite.test.mjs +++ b/e2e/linkRewrite.test.mjs @@ -51,18 +51,20 @@ describe('production build applies the link-rewrite plugins end-to-end', () => { assert.match(html, /href="\/docs\/analysis\/criteria\/"/); }); - // `lib/remarkRewriteLinks/index.test.mts` unit-tests the `image` visitor - // branch in isolation ("leaves cross-plugin image assets untouched"): - // rewriteHref() returns a cross-plugin `.png` image href unchanged because - // only `.md`/`.mdx`/extensionless cross-plugin paths get rewritten, leaving - // non-Markdown assets to Docusaurus's own asset resolver. No suite had - // asserted that this real analyses/2021/kubernetes-gateway-api/analysis.md - // image actually resolves in a real build: the remark plugin's `link` and - // `definition` node handling is already e2e-asserted elsewhere in this - // file, but the `image` node the visitor also walks was not. A regression - // that made the plugin rewrite (and thereby break) cross-plugin image - // hrefs would pass every unit test while still producing a broken `` - // src in the real site. + // `lib/remarkRewriteLinks/index.test.mts` already unit-tests the `image` + // visitor branch in isolation ("leaves cross-plugin image assets + // untouched", asserted both directly against rewriteHref() and through the + // full remark pipeline): rewriteHref() returns a cross-plugin `.png` image + // href unchanged because only `.md`/`.mdx`/extensionless cross-plugin + // paths get rewritten, leaving non-Markdown assets to Docusaurus's own + // asset resolver. A regression in that rewrite logic would already be + // caught by those unit tests. What no suite had asserted is that this real + // analyses/2021/kubernetes-gateway-api/analysis.md image actually resolves + // in a real build: the remark plugin's `link` and `definition` node + // handling is already e2e-asserted elsewhere in this file, but the `image` + // node the visitor also walks was not. This test verifies the Docusaurus + // integration and hashed-asset resolution end-to-end, not a rewrite + // regression the unit tests would miss. it('leaves a cross-plugin image href untouched so Docusaurus resolves it to a hashed asset URL', async () => { const html = await readFile( path.join(