Skip to content

test: cover SSH-style REPOSITORY_URL branch in the real e2e build - #455

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-ssh-repository-url-e2e
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-ssh-repository-url-e2e

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

getGitHubRepoUrl.ts's normalizeGitHubUrl() 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 sets 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. Verified with npx 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_URL is 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 populated REPOSITORY_URL with 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 remarkRewriteLinks assetBaseUrl finding and the getBuildContext BUILD_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

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>
@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 1d6b56c
🔍 Latest deploy log https://app.netlify.com/projects/cncf-techdocs/deploys/6b0621ca3a72bfad5ce353ac
😎 Deploy Preview https://deploy-preview-455--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 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 pinned git@github.com:example-org/example-repo.git and yields https://github.com/example-org/example-repo, which is exactly what the new assertion expects.
  • lib/getCurrentBranch.ts:5-11 - HEAD, BRANCH, and GITHUB_HEAD_REF are read with ||, so the empty-string overrides in the new before() correctly fall through to GITHUB_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.html target, same cleanup), so it follows the file's established idiom rather than inventing a new harness.
  • The PR body's claim that REPOSITORY_URL is a directly-read input (no git-state faking needed) is accurate: getGitHubRepoUrl.ts:17-21 checks 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

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 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Merge-order note: this PR and #444/#454/#455/#456 (the others in this set) all add tests to e2e/linkRewrite.test.mjs from the same base. Confirmed with git merge-tree:

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: quality | Instance: hosted-available-lke648397-260827-boq9 | SHA: 3c1e2b5

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.

1 participant