Skip to content

test: cover BUILD_ENV default fallback in the real e2e build - #454

Closed
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-build-env-default
Closed

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-build-env-default

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds an e2e describe block that builds with BUILD_ENV deleted from the
child process env (rather than set to 'production') and asserts the
same production assertions (edit-this-page link, og:url) as the
existing explicit-BUILD_ENV=production suite.

getBuildContext.ts's process.env.BUILD_ENV || 'production' default is
the code path a real Netlify production deploy actually takes
(netlify.toml's build:production script never sets BUILD_ENV), but
every existing e2e build explicitly set BUILD_ENV: 'production', so the
|| default itself was only unit-covered
(lib/getBuildContext.test.mts), never end-to-end exercised. A regression
confined to that default literal would have passed every existing unit
and e2e test while breaking the real production build.

Related Issue

Part of #451 (that issue folds several e2e/linkRewrite.test.mjs coverage
findings into one tracker; this PR closes the BUILD_ENV default-fallback
variant specifically. The issue's original isAsset/assetBaseUrl
short-circuit finding remains open by design - no e2e test is proposed for
it since the branch isn't reachable through this repo's own Docusaurus
wiring without fabricating a config the site doesn't use)


Filed by quality agent (hold-gated mode). Human review required.

-- hive: agent=quality backend=copilot model=claude-opus-4-6 copilot=1.0.88

…real e2e build

getBuildContext.ts's 'process.env.BUILD_ENV || production' default is the
code path the real Netlify production deploy takes (netlify.toml's
build:production script never sets BUILD_ENV), but every existing e2e
build explicitly sets BUILD_ENV: 'production' rather than leaving it
unset, so the default branch itself was only unit-covered, never
end-to-end exercised.

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 5e9c2d8
🔍 Latest deploy log https://app.netlify.com/projects/cncf-techdocs/deploys/6b060188f17e48975808a3c6
😎 Deploy Preview https://deploy-preview-454--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 tree at head 5e9c2d8, not just the diff. The premise checks out end to end:

  • netlify.toml:6 runs npm run build:production -> _build -> docus:build with no BUILD_ENV anywhere in that chain, so the real production deploy does take the process.env.BUILD_ENV || 'production' default at lib/getBuildContext.ts:14.
  • Every other e2e build in e2e/linkRewrite.test.mjs sets BUILD_ENV explicitly (production at line 167, dev elsewhere), so before this PR the default literal was only unit-covered (lib/getBuildContext.test.mts:29).
  • The new suite correctly deletes BUILD_ENV rather than setting it, and clearing DEPLOY_PRIME_URL is the right call: if the fallback literal regressed, isProd would go false and a CI-set DEPLOY_PRIME_URL would otherwise shunt the build into deploy-preview mode, muddying the failure.

Looks correct to me. One non-blocking note for a maintainer: per #390, no CI workflow runs npm test, so this e2e suite (like the existing ones) only guards local/manual runs until a test workflow lands. That is pre-existing and not a defect of this PR.

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

There are no active review issues for the added default-environment production build coverage.

No open issues 🎉

What changed in this PR

Adds end-to-end coverage for the production build when BUILD_ENV is unset, exercising the default used by real Netlify production deployments.

Changes:

  • Builds the site with BUILD_ENV removed from the child process environment.
  • Verifies the production edit-this-page link and og:url, complementing the existing explicit-production suite.
File Description
e2e/​linkRewrite.test.mjs Adds a default-environment production build suite with output assertions and temporary-directory 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

@nate-double-u

Copy link
Copy Markdown
Member

closing to save spend.

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