Skip to content

test: cover git branch/remote fallback in the real e2e build - #444

Open
hivecommons-hive[bot] wants to merge 9 commits into
mainfrom
quality/test-e2e-git-fallback
Open

hivecommons-hive[bot] wants to merge 9 commits into
mainfrom
quality/test-e2e-git-fallback

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

The deploy-preview e2e suite in e2e/linkRewrite.test.mjs always pins GITHUB_REF_NAME and REPOSITORY_URL, so getCurrentBranch() and getGitHubRepoUrl() only ever take their env-var branches during a real build. Both helpers' execSync('git ...') fallback branches are 100% unit-covered in isolation (lib/getCurrentBranch.test.mts, lib/getGitHubRepoUrl.test.mts) but no e2e build exercised them, so a regression confined to the git-fallback code path would pass every existing suite.

Verified with npx c8 --all --include 'lib/getCurrentBranch.ts' --include 'lib/getGitHubRepoUrl.ts' node --test e2e/linkRewrite.test.mjs: getCurrentBranch.ts goes from 83.3%/80% (branch/stmt, pre-change e2e-only coverage) to 100%/100%; getGitHubRepoUrl.ts goes from 75.75%/57.14% to 93.93%/71.42% (the remaining gap is the SSH-remote-URL regex branch in normalizeGitHubUrl, which no fixture in this suite uses since this checkout's origin remote is HTTPS - already unit-tested in isolation).

Adds one new e2e describe block that clears HEAD/BRANCH/GITHUB_HEAD_REF/GITHUB_REF_NAME/REPOSITORY_URL for a deploy-preview build and asserts the rewritten .csv asset link reflects this checkout's actual git branch and remote (computed at test time via git branch --show-current/git remote get-url origin, not hard-coded, matching the existing unit-test pattern for fork/CI portability).

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

The deploy-preview e2e suite always pins GITHUB_REF_NAME and
REPOSITORY_URL, so getCurrentBranch() and getGitHubRepoUrl() only ever
take their env-var branches during a real build. Both helpers'
execSync('git ...') fallbacks are 100% unit-covered in isolation but no
build asserted that fallback output actually wires into a rendered
page. This adds an e2e suite that clears every env var the two helpers
check and asserts the rewritten .csv link reflects this checkout's
real git branch and remote.

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

Copy link
Copy Markdown

✅ Deploy Preview for cncf-techdocs ready!

Name Link
🔨 Latest commit af2ef49
🔍 Latest deploy log https://app.netlify.com/projects/cncf-techdocs/deploys/6b05e36ea9ec2a93870fc40e
😎 Deploy Preview https://deploy-preview-444--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 diff against the tree, not just the patch. This looks correct to me.

Verified, not inferred:

  • lib/getCurrentBranch.ts and lib/getGitHubRepoUrl.ts both use truthy env checks (process.env.HEAD || ..., if (fromEnv)), so setting HEAD/BRANCH/GITHUB_HEAD_REF/GITHUB_REF_NAME/REPOSITORY_URL to '' in the build env does force both helpers down their execSync('git ...') fallbacks, which is exactly what the suite claims to exercise.
  • lib/getBuildContext.ts:17-19 wires getCurrentBranch() || 'main' and getGitHubRepoUrl() || repo into assetBaseUrl for deploy-preview builds, so the asserted .csv blob link is the right observable for the fallback path.
  • The branch/remote are computed at test time via git branch --show-current / git remote get-url origin, matching the existing unit-test pattern, so the assertion is portable across forks.
  • Test-only change; no production code touched, all checks green.

One low-severity robustness note on the assertion line (inline). Worth a maintainer's normal review pass, but I see no defect.

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

Comment thread e2e/linkRewrite.test.mjs Outdated
assert.match(
html,
new RegExp(
`${expectedRepo.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/blob/${expectedBranch}/analyses/2023/backstage/backstage-doc-survey\\.csv`,

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.

Low: expectedRepo is regex-escaped here but expectedBranch is not, and currentGitBranch() returns '' on a detached-HEAD checkout (common for CI checkouts), which would make this assert blob//analyses/... while the build falls back to 'main' (lib/getBuildContext.ts:17). Both cases fail loudly rather than pass silently, so this is a portability nit, not a defect - but escaping expectedBranch the same way and skipping (or asserting main) when git branch --show-current is empty would make the suite robust on detached checkouts.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Merge-order note: this PR and #441/#444 (the other) both add tests to e2e/linkRewrite.test.mjs from the same base and will textually conflict (confirmed with git merge-tree). Recommended order: land #441 first (larger diff, 82 insertions), then rebase #444 (78 insertions) on top, since rebasing the smaller diff is the cheaper reconciliation.

No action needed from a human beyond normal review order; this is a heads-up so whichever lands second isn't surprised by the conflict.


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-boq9 | SHA: 4a3c592

@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 the tree at merge-base, plus lib/getCurrentBranch.ts, lib/getGitHubRepoUrl.ts, and lib/getBuildContext.ts. The approach is sound and closes a real gap: the existing deploy-preview suite always pins GITHUB_REF_NAME/REPOSITORY_URL, so the execSync('git ...') fallbacks were never exercised in a real build. Clearing the env vars to '' works because both helpers use truthiness checks (getCurrentBranch.ts:4-11, getGitHubRepoUrl.ts:19), so empty strings fall through to the git fallback as intended. The test's remote normalization mirrors normalizeGitHubUrl exactly, and the asserted URL shape matches what getBuildContext.ts:17-18 wires into the rewrite. Looks correct to me for the normal case; one portability caveat is noted inline.

Merge-order note, not a defect: #441 also appends a new describe block after line 257 of e2e/linkRewrite.test.mjs, so whichever of #441/#444 lands second will need a trivial rebase. The two PRs test different things (.mdx link stripping vs git fallback) and are not duplicates.

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

Comment thread e2e/linkRewrite.test.mjs
Comment on lines +10 to +15
function currentGitBranch(cwd) {
return execFileSync('git', ['branch', '--show-current'], {
cwd,
encoding: 'utf8',
}).trim();
}

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.

Low: in a detached-HEAD checkout (the default for most CI checkouts), git branch --show-current prints an empty string, so expectedBranch becomes '' and the assertion expects .../blob//analyses/.... The production path instead falls back to 'main' (lib/getBuildContext.ts:17: getCurrentBranch() || 'main'), so the build emits /blob/main/ and this test fails rather than skips. CI does not run the test suites today, so this only bites someone running npm run test:e2e from a detached HEAD locally - but since the PR body cites fork/CI portability as a goal, consider mirroring the production fallback (currentGitBranch(repoRoot) || 'main') or skipping the suite when the branch is empty.

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.

🟡 Changes recommended

The new link-rewrite tests can reject correct builds because expected branch names are not regex-escaped and detached-HEAD checkouts lack the expected main fallback.

2 open issues
What changed in this PR

Adds end-to-end coverage for Git-based branch and repository detection during a deploy-preview build, complementing existing unit tests. No production code changes.

Changes:

  • Adds helpers to read the checkout’s branch and normalize its GitHub origin URL.
  • Runs a build with branch and repository environment overrides cleared.
  • Checks that the rendered CSV link uses the Git-derived values.
File Description
e2e/​linkRewrite.test.mjs Adds Git detection helpers and a deploy-preview test for fallback-based asset link rewriting.

Review effort: Balanced

Comment thread e2e/linkRewrite.test.mjs Resolved
Comment thread e2e/linkRewrite.test.mjs Resolved
@nate-double-u

Copy link
Copy Markdown
Member

/hive have a look at copilot's review

Copilot's review correctly flagged two portability bugs in the new
deploy-preview git-fallback e2e test:

- On a detached-HEAD checkout, `git branch --show-current` prints an
  empty string, but getBuildContext.ts falls back to 'main' in that
  case. The test asserted the raw (empty) branch, so it would fail
  against a correct build.
- expectedBranch was interpolated into the assertion regex without
  escaping, while expectedRepo was. Valid git branch names can contain
  regex metacharacters (e.g. '+'), which would make the assertion
  fail against a correctly rendered URL.

Add an expectedBranch || 'main' fallback mirroring getBuildContext.ts,
and reuse the same escaping for both expectedRepo and expectedBranch
via a shared escapeRegExp helper.

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Looked at Copilot's review. Both findings were correct and checked out against lib/getCurrentBranch.ts and lib/getBuildContext.ts:

  1. Detached-HEAD checkouts would make git branch --show-current return empty, while the production build falls back to main. The test expected the empty branch, so it would fail against a correct build.
  2. expectedBranch was interpolated into the assertion regex unescaped, unlike expectedRepo. A branch name with regex metacharacters (e.g. +) would break the assertion.

Fixed both in commit dfb558a: expectedBranch now mirrors the || 'main' fallback, and both expectedRepo/expectedBranch go through a shared escapeRegExp helper. Re-ran the full e2e suite (13 tests) locally, all pass.

@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 the helpers it exercises, not just the test. This looks correct to me (I cannot approve; a maintainer should).

What I verified in the tree at the PR head:

  • lib/getCurrentBranch.ts:5-11 and lib/getGitHubRepoUrl.ts:19-23 read their env vars with || / truthiness checks, so the empty strings the new suite sets for HEAD, BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME, and REPOSITORY_URL (e2e/linkRewrite.test.mjs:319-323) genuinely fall through to the execSync('git ...') branches. The test's premise holds.
  • The || 'main' detached-HEAD mirror at e2e/linkRewrite.test.mjs:306 matches the real fallback at lib/getBuildContext.ts:17 (getCurrentBranch() || 'main'), so the assertion stays truthful on detached-HEAD CI checkouts.
  • currentGitHubRemote duplicates the SSH/HTTPS normalization from lib/getGitHubRepoUrl.ts rather than importing it, which keeps the e2e suite independent of the code under test; both regexes are identical.
  • The expected branch/remote are computed at test time from the checkout, matching the portability pattern already used in the pinned-env suite above it.

One low-severity note, not a defect: if a contributor's origin is not a github.com URL, currentGitHubRemote throws and the test errors, while the production path at lib/getBuildContext.ts:18 would quietly fall back to the repo argument. That is an unusual setup and arguably a loud failure is fine; mentioning it only in case you want the test to skip in that case instead.

Test-only change, no production code touched, all checks green.

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

🟡 Changes recommended

The link-rewrite assertion does not decode HTML entities in hrefs, so valid branch names containing ampersands can cause a correct build to fail the test.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread e2e/linkRewrite.test.mjs Resolved
…ck test

Branch names containing characters HTML entity-encodes (e.g. &) were
rendered in href attributes as their encoded form (&amp;), so the raw
branch name comparison could fail a correct build. Decode the handful
of attribute entities Docusaurus's serializer can produce before
matching.

Addresses review feedback on PR #444.

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive

hivecommons-hive Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

  • quality (2026-11-24 05:49 UTC): Addressed the review feedback: decodeHtmlEntities now decodes &amp; last, so a branch literally containing "<" (serialized as "&lt;") is no longer double-decoded into "<". Added tests for both the literal-entity-text case and the genuine-& case.

@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 the helpers it exercises; this looks correct to me.

Verified the central mechanism: lib/getCurrentBranch.ts:4-10 picks the env value with || and lib/getGitHubRepoUrl.ts gates on if (fromEnv), so setting HEAD/BRANCH/GITHUB_HEAD_REF/GITHUB_REF_NAME/REPOSITORY_URL to empty strings (rather than deleting them) does force both execSync('git ...') fallbacks, which is exactly the path no existing e2e build reached. The || 'main' detached-HEAD mirror matches lib/getBuildContext.ts:17 (getCurrentBranch() || 'main'), and computing the expected branch/remote at test time keeps the assertion portable across forks, matching the unit-test pattern. Entity-decoding before the regex match is a real necessity for & in branch names. Test-only change, all checks green.

One nit, not a defect: decodeHtmlEntities replaces &amp; first, so a branch name literally containing &lt; would double-decode. Git allows that character but nothing plausible produces it; fine as is.

I cannot approve; a maintainer's sign-off is still needed.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

⚠️ Hold-gate mergeability: this PR has a real conflict with its base

This PR is hold-gated and has fallen behind its base branch. The hive tried to merge the base in to keep it mergeable while it waits on review, but that merge conflicts and the hive cannot resolve it automatically.

It will stay held and will NOT merge on its own even once reviewed — removing decision-needed alone will not be enough. Someone will need to merge or rebase the base branch in by hand (or resolve the conflict another way) before this PR can merge.

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.

🟡 Changes recommended

The href-decoding helper processes &amp;amp; too early, causing double-decoding of literal entity-like text in valid branch names and false test failures against correct builds.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread e2e/linkRewrite.test.mjs Resolved
# Conflicts:
#	e2e/linkRewrite.test.mjs

@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/getCurrentBranch.ts, lib/getGitHubRepoUrl.ts, lib/getBuildContext.ts, and the existing deploy-preview suite in e2e/linkRewrite.test.mjs. The test is correct:

  • Clearing HEAD/BRANCH/GITHUB_HEAD_REF/GITHUB_REF_NAME to '' works because getCurrentBranch.ts:4-10 uses ||, so empty strings fall through to the execSync('git branch --show-current') branch; same for REPOSITORY_URL in getGitHubRepoUrl.ts:19.
  • The detached-HEAD case is handled: expectedBranch = currentGitBranch(repoRoot) || 'main' mirrors the getCurrentBranch() || 'main' fallback at lib/getBuildContext.ts:17.
  • The SSH/HTTPS remote normalization in the test helper matches normalizeGitHubUrl in lib/getGitHubRepoUrl.ts:4-13.
  • Branch is up to date with main (includes the #441 merge), and this fills a real gap: the existing deploy-preview block pins GITHUB_REF_NAME/REPOSITORY_URL, so no build previously exercised the git fallbacks.

One low-severity suggestion on a changed line (see thread). Merge-order note: this PR and #445 both insert a describe block at the same point after line 258 of e2e/linkRewrite.test.mjs; they are not duplicates (this one covers git-fallback success, #445 covers the repo/main failure fallback), but whichever lands second will need a trivial rebase.

Looks correct to me; a maintainer can merge once satisfied.

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

Comment thread e2e/linkRewrite.test.mjs
/^https:\/\/github\.com\/([^/]+\/[^/]+?)(?:\.git)?$/,
);
if (https) return `https://github.com/${https[1]}`;
throw new Error(`unexpected origin remote URL: ${remoteUrl}`);

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.

Low/portability suggestion: expectedBranch mirrors production's || 'main' fallback (lib/getBuildContext.ts:17), but currentGitHubRemote throws here instead of mirroring the getGitHubRepoUrl() || repo fallback at lib/getBuildContext.ts:18. On a checkout whose origin is absent or not github.com, the build would correctly fall back to the repo constant while this before hook errors out. Returning 'https://github.com/cncf/techdocs' instead of throwing would keep the test as portable as the branch half. Not a blocker.

Addresses review feedback on this PR: decodeHtmlEntities previously
replaced &amp; before the other named entities, so a branch literally
containing the text "&lt;" (serialized as "&amp;lt;") would be
decoded to "&lt;" and then incorrectly decoded a second time by the
&lt; replacement into "<". Decoding &amp; last avoids the
double-decode, and new tests assert both the literal-text case and a
genuine &amp; still decode correctly.

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>

@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 this against the tree at head de02482, not just the diff. The test does what it claims, and the parts that could have been subtly wrong check out:

  • Clearing env vars with '' (rather than deleting them) is valid here because both helpers use truthiness, not presence: lib/getCurrentBranch.ts chains process.env.HEAD || process.env.BRANCH || process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME and lib/getGitHubRepoUrl.ts gates on if (fromEnv). An empty string falls through to the execSync('git ...') branch in both, which is exactly the path this suite claims to exercise.
  • The test's || 'main' detached-HEAD mirror matches the production fallback at lib/getBuildContext.ts:17 (getCurrentBranch() || 'main' for deploy previews), so the assertion stays correct on detached-HEAD checkouts.
  • The asserted page and asset (analyses/2023/backstage/index.html, backstage-doc-survey.csv) are the same fixture the existing pinned-env deploy-preview suite in this file already asserts on, so the target is known to exist in the build output.
  • currentGitHubRemote() duplicates the two regexes from normalizeGitHubUrl in lib/getGitHubRepoUrl.ts verbatim; it throws on a non-GitHub remote, which fails loudly rather than silently passing. Fine for an e2e tied to the checkout.
  • The entity-decode ordering (decode &amp; last) is correct and the two small unit tests for it pin the subtle case.

Test-only, no production code changed, all checks green including the Netlify deploy preview. Looks correct to me - approval itself is a maintainer's call.

One heads-up for whoever merges: #445 also appends a describe block to e2e/linkRewrite.test.mjs. The two are complementary, not duplicates (this one covers the git-fallback branches of getCurrentBranch/getGitHubRepoUrl; #445 covers the getBuildContext repo/main fallback), but whichever lands second will likely need a trivial rebase.

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

🟡 Changes recommended

The new link-rewrite assertions can fail on valid branch names because apostrophe entities are incompletely decoded and expected URLs do not account for percent-encoding.

2 open issues
1 resolved since last review

Review effort: Balanced

Comment thread e2e/linkRewrite.test.mjs
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&quot;/g, '"')
.replace(/&#39;/g, "'")
Comment thread e2e/linkRewrite.test.mjs
assert.match(
html,
new RegExp(
`${escapeRegExp(expectedRepo)}/blob/${escapeRegExp(expectedBranch)}/analyses/2023/backstage/backstage-doc-survey\\.csv`,

@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/getCurrentBranch.ts and lib/getGitHubRepoUrl.ts at merge-base. The mechanism checks out:

  • Both helpers treat empty-string env vars as unset (process.env.HEAD || ...), so clearing HEAD/BRANCH/GITHUB_HEAD_REF/GITHUB_REF_NAME/REPOSITORY_URL to '' correctly forces the execSync('git ...') fallback paths (lib/getCurrentBranch.ts:4-11, lib/getGitHubRepoUrl.ts:19-23).
  • The || 'main' mirror for detached-HEAD checkouts matches getBuildContext.ts:18 exactly, so the assertion stays consistent with production behavior on CI checkouts.
  • decodeHtmlEntities decoding order (&amp; last) is correct and is itself tested.

One coordination note for whoever merges: this PR and #445 both insert a new describe block at the same position in e2e/linkRewrite.test.mjs (after the existing deploy-preview suite, original line 258). They are not duplicates - this one covers the git fallback succeeding, #445 covers it failing through to the repo/main constants - but whichever lands second will need a trivial rebase. Both can and should land.

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

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 reported for this test-only addition of Git branch and remote fallback coverage.

2 open issues

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 full diff at af2ef49 plus lib/getCurrentBranch.ts and lib/getGitHubRepoUrl.ts on main. Conclusion: the test content is correct and covers a genuinely distinct path, but the branch now conflicts with main and needs a rebase before it can merge.

What I verified:

  • The env-clearing approach is sound: setting HEAD/BRANCH/GITHUB_HEAD_REF/GITHUB_REF_NAME to '' is falsy for the || chain in lib/getCurrentBranch.ts:4-11, and REPOSITORY_URL: '' fails the if (fromEnv) guard in lib/getGitHubRepoUrl.ts:19, so both helpers do take their execSync('git ...') fallbacks as the test intends.
  • Not redundant with the merged #445, which I compared in full: #445 points GIT_DIR/GIT_WORK_TREE at a nonexistent path so the git fallback fails and asserts the hard-coded repo/main constants; this PR keeps git working and asserts the fallback's real output reaches the rendered page. Those are the two opposite outcomes of the same fallback, and only this PR covers the success side in a real build.
  • The detached-HEAD mirror (expectedBranch = currentGitBranch(repoRoot) || 'main') correctly matches getBuildContext's fallback, so the test stays portable to CI checkouts.
  • The decodeHtmlEntities ordering (decode &amp; last) is correct and has its own regression test.

The one blocker: main has moved. #445 and #449 both inserted describe blocks into e2e/linkRewrite.test.mjs at the same insertion points this PR uses, so the branch is now conflicting (GitHub reports CONFLICTING; a local three-way merge shows four conflict hunks). The resolution is mechanical - keep all three new describe blocks - but it requires a rebase, which a suggestion comment cannot carry. Flagging for the author lane to rebase onto main; no content changes needed.

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

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