Skip to content

[quality] e2e suite never exercises the deploy-preview branch/repo wiring #425

Open

Description

@hivecommons-hive

Finding

lib/getBuildContext.ts, lib/getCurrentBranch.ts, and lib/getGitHubRepoUrl.ts are each 100% unit-covered in isolation (npm run test:coverage, HEAD). docusaurus.config.ts wires their combined output (assetBaseUrl) into the beforeDefaultRemarkPlugins rewrite plugin that produces the .csv-asset GitHub blob URLs.

The only end-to-end suite, e2e/linkRewrite.test.mjs, runs a single real docusaurus build with BUILD_ENV=dev and DEPLOY_PRIME_URL='' — i.e. always the non-deploy-preview branch of getBuildContext(). The deploy-preview branch (where getCurrentBranch()/getGitHubRepoUrl() actually run and their return values get wired into the rewritten link) was never exercised by any build, so a regression there (e.g. assetBaseUrl silently falling back to main/the canonical repo during an actual Netlify deploy preview) would pass both the unit suite and the existing e2e suite.

Unit evidence: 100% stmt/branch/func/line coverage for all three helpers (c8, npm run test:coverage, HEAD).
End-to-end evidence (before this fix): zero — e2e/linkRewrite.test.mjs's single build never set DEPLOY_PRIME_URL to a truthy value, so isDeployPreview was always false and getCurrentBranch()/getGitHubRepoUrl() were never invoked by any build in the repo.

Priority 2 (unit-covered, not end-to-end covered) per the quality-agent coverage-evidence policy.

Recommendation

Add a second docusaurus build in e2e/linkRewrite.test.mjs with BUILD_ENV=deploy-preview, a truthy DEPLOY_PRIME_URL, and deterministic GITHUB_REF_NAME/REPOSITORY_URL env vars (the same env vars getCurrentBranch()/getGitHubRepoUrl() already read for Netlify/GitHub Actions deploy previews), then assert the rendered .csv blob URL reflects the preview branch/repo instead of main.

Priority

  • Impact: medium (a real deploy-preview regression in asset-link wiring would not be caught by any existing check)
  • Effort: low (new e2e describe block reusing the existing build-and-read-html pattern, no production code changes)

Filed by quality agent (hold-gated mode)


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-boq9 | SHA: 8ee3ae3

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

Activity

  1. added
    testingCreated by Hive for agent-filed issue provenance
    agent/qualityCreated by Hive for agent-filed issue provenance
    on Nov 18, 2026
  2. hivecommons-hive commented on Nov 18, 2026

    @hivecommons-hive
    ContributorAuthor

    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 4 closed as completed in the last 14 days) already cite docusaurus.config.ts, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] test:coverage --exclude flag leaves docusaurus.config.ts ungated despite being fully unit-tested

    Finding

    package.json's test:coverage script passes --exclude 'docusaurus.config.ts' to c8:

    c8 --reporter=text --reporter=lcov --exclude 'docusaurus.config.ts' --exclude 'lib/testHelpers/**' --check-coverage --lines 100 --statements 100 --branches 100 --functions 100 npm run test:unit
    

    This exclude predates lib/docusaurusConfigPreprocessor.test.mts and
    lib/docusaurusConfigBuildContext.test.mts (added in #404/#419), which both
    import the real docusaurus.config.ts directly via
    testHelpers/resolveExtensionlessTs.mjs and already exercise it at 100%
    stmt/branch/func/line. The exclude flag is now a stale blind spot: it was
    needed back when the file had no direct-import tests (see the since-closed
    #398), but today it just means a future regression or new untested branch
    added to docusaurus.config.ts would pass npm run test:coverage silently
    instead of failing the gate, because c8 never instruments that file.

    Verified locally: removing the --exclude 'docusaurus.config.ts' flag and
    re-running npm run test:coverage still reports 100% stmts/branch/func/line
    for docusaurus.config.ts — no new tests are needed, this is purely a stale
    gate-configuration gap.

    Recommendation

    Remove --exclude 'docusaurus.config.ts' from the test:coverage script in
    package.json, and add a regression test (alongside the existing
    scripts/coverage-thresholds.test.mjs threshold check) asserting the script
    no longer excludes that file, so the exclude can't quietly return.

    Priority

    • Impact: medium (coverage gate currently has a real, exploitable blind spot on a file with non-trivial branch logic)
    • Effort: low (one-line package.json change + one test assertion)

    Filed by quality agent (hold-gated mode)


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

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


    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 4 closed as completed in the last 14 days) already cite docusaurus.config.ts, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] e2e build suite never exercises BUILD_ENV=production, leaving docusaurus.config.ts's editUrl/url wiring unit-covered but not end-to-end covered

    Finding

    docusaurus.config.ts's isProd-dependent branches (the site url:
    production domain vs. DEPLOY_PRIME_URL/localhost fallback; editUrl:
    set on both docs plugins in production, undefined otherwise) are fully
    unit-tested via lib/docusaurusConfigBuildContext.test.mts (the
    BUILD_ENV=production case is explicitly asserted:
    'uses the production site URL and GitHub editUrl/asset links when
    BUILD_ENV=production'). npm run test:coverage reports 100%
    stmts/branch/func/line on docusaurus.config.ts (once #427 lands
    removing the stale exclude flag).

    However, e2e/linkRewrite.test.mjs's real docusaurus build only ever
    runs with BUILD_ENV=dev (#426 adds a second build with
    BUILD_ENV=deploy-preview). The actual Netlify production context
    (npm run build:production -> npm run _build, which never sets
    BUILD_ENV, so getBuildContext.ts defaults buildEnv to
    'production') is never exercised by a real build anywhere in the test
    suite.

    Verified locally with two real docusaurus build runs against this repo
    (revision ff6cca7): BUILD_ENV=production renders an 'Edit this page'
    link (href=.../tree/main/...) and og:url=https://cncf-techdocs.netlify.app/,
    while BUILD_ENV=dev renders no edit link and
    og:url=http://localhost:3000/. So a wiring regression in the
    production-only branch (e.g. editUrl silently omitted, or url
    pointing at the wrong domain) would pass every existing unit and e2e test
    and only surface on the live site.

    Recommendation

    Add a third docusaurus build scenario to e2e/linkRewrite.test.mjs
    with BUILD_ENV=production (and DEPLOY_PRIME_URL cleared, matching
    the real Netlify production context), asserting the rendered HTML for a
    docs page contains the GitHub edit-this-page link
    (href="https://github.com/cncf/techdocs/tree/main/...") and that
    index.html's og:url meta tag is the production domain
    (https://cncf-techdocs.netlify.app/).

    Priority


    Filed by quality agent (hold-gated mode)


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

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

  3. hivecommons-hive commented on Nov 18, 2026

    @hivecommons-hive
    ContributorAuthor

    Note: this issue's number was reused by the hive's consolidation (component:docusaurus.config.ts) for a distinct finding — the test:coverage script's stale --exclude 'docusaurus.config.ts' c8 flag, which leaves that file ungated despite being fully unit-tested by lib/docusaurusConfigPreprocessor.test.mts and lib/docusaurusConfigBuildContext.test.mts. That fix is unrelated to the deploy-preview e2e gap described above (tracked separately by PR #426) and ships in a follow-up PR referencing this issue with Refs #425, since the deploy-preview e2e work above remains open.


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

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

  4. hivecommons-hive commented on Nov 18, 2026

    @hivecommons-hive
    ContributorAuthor

    Additional finding: BUILD_ENV=production is also never e2e-exercised

    Distinct from the deploy-preview gap above (addressed by PR #426): e2e/linkRewrite.test.mjs runs real docusaurus builds with BUILD_ENV=dev (existing) and BUILD_ENV=deploy-preview (added by #426), but never with BUILD_ENV=production — the actual Netlify production context (npm run build:production -> npm run _build, which never sets BUILD_ENV, so getBuildContext.ts defaults buildEnv to 'production').

    docusaurus.config.ts's isProd-dependent branches (site url: production domain vs. DEPLOY_PRIME_URL/localhost fallback; editUrl: set on both docs plugins in production, undefined otherwise) are 100% unit-covered via lib/docusaurusConfigBuildContext.test.mts ('uses the production site URL and GitHub editUrl/asset links when BUILD_ENV=production'), but no real build ever exercises that branch end-to-end.

    Verified locally with two real docusaurus build runs (revision ff6cca7): BUILD_ENV=production renders an 'Edit this page' link (href=.../tree/main/...) and og:url=https://cncf-techdocs.netlify.app/; BUILD_ENV=dev renders no edit link and og:url=http://localhost:3000/. A regression in the production-only branch (e.g. editUrl silently omitted, or url pointing at the wrong domain) would pass every existing unit and e2e test and only surface on the live site.

    Priority 2 (unit-covered, not end-to-end covered) per the quality-agent coverage-evidence policy — opening a PR to add this third build scenario, Refs #425 since this ships independently of the deploy-preview work.


    Filed by quality agent (hold-gated mode)


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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualityCreated by Hive for agent-filed issue provenancetestingCreated by Hive for agent-filed issue provenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions