Repository navigation
test: cover SSH-style REPOSITORY_URL branch in the real e2e build - #455
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
getGitHubRepoUrl.ts's normalizeGitHubUrl() has a 100%-unit-covered SSH regex branch (git@github.com:owner/repo(.git)?) that no e2e build exercised: the deploy-preview suite in e2e/linkRewrite.test.mjs only ever set REPOSITORY_URL to an HTTPS-style value. Adds one e2e describe block that sets REPOSITORY_URL to an SSH-style string during a deploy-preview build and asserts the rewritten .csv asset link uses the normalized HTTPS form, closing the gap without faking the checkout's actual git state (REPOSITORY_URL is an overridable input the production code reads directly). No production code changed - test-only. 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. |
There was a problem hiding this comment.
Read the production path, not just the diff. This looks correct to me (COMMENT only; approval is a maintainer's call).
What I verified against the tree at 1d6b56c:
lib/getGitHubRepoUrl.ts:4- the SSH branch/^git@github\.com:([^/]+\/[^/]+?)(?:\.git)?$/matches the pinnedgit@github.com:example-org/example-repo.gitand yieldshttps://github.com/example-org/example-repo, which is exactly what the new assertion expects.lib/getCurrentBranch.ts:5-11-HEAD,BRANCH, andGITHUB_HEAD_REFare read with||, so the empty-string overrides in the newbefore()correctly fall through toGITHUB_REF_NAME: 'e2e-preview-ssh-branch'. This matches the clearing pattern the existing deploy-preview suite in this same file already uses.- The new block is a faithful mirror of the HTTPS-style suite directly above it (same build invocation, same
analyses/2023/backstage/index.htmltarget, same cleanup), so it follows the file's established idiom rather than inventing a new harness. - The PR body's claim that
REPOSITORY_URLis a directly-read input (no git-state faking needed) is accurate:getGitHubRepoUrl.ts:17-21checks the env var before ever shelling out to git.
One cost worth a maintainer's awareness, not a defect: each describe in this file runs a full docusaurus build, so this adds roughly one more build to the e2e wall time. That is consistent with how #454 and the existing suites in this file are structured, so it is the accepted trade-off here.
All CI checks are green and DCO passes. Test-only change, Refs #451 linkage explains what remains open in the tracker.
-- hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the added end-to-end coverage for SSH repository URL normalization.
No open issues 🎉
What changed in this PR
Adds end-to-end coverage for SSH-style REPOSITORY_URL normalization through the real deploy-preview build, addressing the SSH variant tracked in #451. No production code changes.
Changes:
- Builds the site with an SSH-style repository URL and a controlled preview branch.
- Verifies the generated CSV link uses the normalized HTTPS URL and that no SSH-style GitHub URL remains in the page.
| File | Description |
|---|---|
e2e/linkRewrite.test.mjs |
Adds a deploy-preview build suite covering SSH repository URL normalization and temporary-output cleanup. |
Review effort: Balanced
|
Merge-order note: this PR and #444/#454/#455/#456 (the others in this set) all add tests to
Recommended order: land #444 first, then rebase #454, #455, and #456 on top individually - rebasing the three small diffs once each onto the restructured file is cheaper than rebasing the large restructuring diff three times. No action needed from a human beyond normal review order; this is a heads-up so whichever lands later isn't surprised by the conflict. 🐝 Hive Agent: |
Test Improvement
getGitHubRepoUrl.ts'snormalizeGitHubUrl()has an SSH-style regex branch (git@github.com:owner/repo(.git)?) that is 100% unit-covered (lib/getGitHubRepoUrl.test.mts: 'normalizes an SSH REPOSITORY_URL') but was never reached by a real build:e2e/linkRewrite.test.mjs's deploy-preview suite only ever setsREPOSITORY_URLto an HTTPS-style value.Adds one e2e
describeblock that setsREPOSITORY_URLto an SSH-style string during a deploy-preview build and asserts the rewritten.csvasset link uses the normalized HTTPS form. Verified withnpx c8 --all --include lib/getGitHubRepoUrl.ts node --test e2e/linkRewrite.test.mjs: the SSH-match line was uncovered before this change and covered after.Unlike the git-remote/branch fallback gaps elsewhere in this file, this branch doesn't require faking the checkout's actual git state -
REPOSITORY_URLis an overridable input the production code reads directly, so this is the exact same code path a real Netlify deploy-preview build would take if it ever populatedREPOSITORY_URLwith an SSH remote.No production code changed - test-only.
Related Issue
Refs #451 (tracker for e2e coverage gaps on
e2e/linkRewrite.test.mjs-adjacent lib files; this PR closes the SSH-branch variant folded into it, the original remarkRewriteLinksassetBaseUrlfinding and thegetBuildContextBUILD_ENV finding - covered by PR #454 - remain open in that issue)Filed by quality agent (hold-gated mode). Human review required.
-- hive: agent=quality backend=copilot model=claude-opus-4-6 copilot=1.0.88