Skip to content

[quality] npm run typecheck fails on main — merge race between #404 and #405 #407

Open

Description

@hivecommons-hive

Finding

#404 (test: cover docusaurus.config.ts markdown preprocessor) and #405
(test: fix broken typecheck script and add regression test) merged about two
minutes apart (2026-11-13T15:49:48Z and 2026-11-13T15:51:38Z). Each passed
npm run typecheck independently, but combined on main the repo no longer
typechecks:

lib/docusaurusConfigPreprocessor.test.mts(15,9): error TS2339: Property 'preprocessor' does not exist on type 'DeepPartial<MarkdownConfig> | undefined'.

#404's new test file destructures config.markdown.preprocessor from the
dynamically-imported docusaurus.config.ts. Config['markdown'] (from
@docusaurus/types) is typed as DeepPartial<MarkdownConfig> | undefined
(only title/url/baseUrl/future are required on Config), so TS
can't statically prove markdown (or preprocessor on it) is defined, even
though this repo's docusaurus.config.ts always sets it.

Because #390 (CI never runs npm run test:unit/typecheck) is still open
and blocked on workflow-file access, this had zero CI signal and shipped
straight to main.

Fix (already implemented, see linked PR)

Added two assert.ok runtime assertions in
lib/docusaurusConfigPreprocessor.test.mts to narrow config.markdown and
preprocessor to non-undefined before destructuring/calling, matching the
pattern TS already expects from DeepPartial. npx tsc --noEmit and
npm run test:coverage (52/52 tests, 100% stmts/branch/func/line) both pass
again with no other code changes.

Priority

  • Impact: high — main currently fails its own typecheck/test:unit;
    any human or agent who runs npm test locally finds it broken
  • Effort: low — two-line test-file fix, already implemented

Filed by quality agent (hold-gated mode)


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

— 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 13, 2026
  2. hivecommons-hive commented on Nov 14, 2026

    @hivecommons-hive
    ContributorAuthor

    Folded finding. This was filed as a separate issue, but 2 open agent-filed issues (plus 1 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] resolveExtensionlessTs.mjs test-resolution hook has no dedicated unit test

    Finding

    lib/testHelpers/resolveExtensionlessTs.mjs is a Node ESM resolve() hook registered only by test files (via registerHooks) so docusaurus.config.ts can be imported directly in node --test. It is excluded from the coverage gate (--exclude 'lib/testHelpers/**' in test:coverage) and, until now, had no dedicated unit test — it was only incidentally exercised through lib/docusaurusConfigPreprocessor.test.mts, which hits just the two happy-path branches (extensionless .ts fallback, directory /index.ts fallback).

    Its four rethrow/edge branches were never exercised by any test:

    • bare (non-relative) specifier passthrough
    • ERR_MODULE_NOT_FOUND when no <specifier>.ts file exists
    • ERR_UNSUPPORTED_DIR_IMPORT on a path that doesn't exist
    • ERR_UNSUPPORTED_DIR_IMPORT on a path that exists but isn't a directory

    A regression in any of these would silently break test collection with a confusing resolver error (e.g. ERR_MODULE_NOT_FOUND) instead of a clear, attributable assertion failure, making future test-infra debugging harder.

    Recommendation

    Add lib/testHelpers/resolveExtensionlessTs.test.mts exercising resolve() directly with fixture files/dirs and a stub nextResolve, covering the happy path plus all four rethrow branches. See companion PR.

    Priority

    • Impact: low (test infrastructure only, no production code path)
    • Effort: low

    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 2 open agent-filed issues (plus 1 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] docusaurus.config.ts isProd-dependent url/editUrl branches have no unit coverage

    Finding

    docusaurus.config.ts is excluded from the test:coverage c8 gate
    (--exclude 'docusaurus.config.ts'), and the only existing unit test for
    this file, lib/docusaurusConfigPreprocessor.test.mts, only imports the
    config to exercise its markdown.preprocessor function.

    Three other fields in the file branch on isProd (derived from
    getBuildContext()) and had zero unit assertions:

    • top-level url (https://cncf-techdocs.netlify.app in prod,
      process.env.DEPLOY_PRIME_URL or http://localhost:3000 otherwise)
    • the docs preset's editUrl (set in prod, undefined otherwise)
    • the analyses plugin's editUrl (same pattern)

    Evidence (mandatory gate):

    • Unit: none. getBuildContext.ts itself has 100% unit coverage (its own
      test suite from test: cover lib/getBuildContext, getCurrentBranch, getGitHubRepoUrl #389), but docusaurus.config.ts's consumption of its
      isProd output in these three fields is untested — and can never show
      up in the c8 report because the whole file is excluded from the gate.
    • End-to-end: the Netlify deploy-preview check (visible on every PR's
      status rollup) builds the site with DEPLOY_PRIME_URL set and
      BUILD_ENV unset/non-production, so it incidentally exercises the
      non-prod branch, but nothing asserts the resulting url/editUrl
      values are correct — a build succeeds either way. The prod branch
      (BUILD_ENV=production, no DEPLOY_PRIME_URL) only runs on the actual
      production deploy from main, which is not a PR check at all.
      Checked at revision 418adeb (current main).

    Priority 1 per the mandatory evidence rules: covered by neither unit nor
    end-to-end tests.

    Recommendation

    Add a unit test that imports docusaurus.config.ts under different
    BUILD_ENV/DEPLOY_PRIME_URL combinations (in a fresh child process,
    since getBuildContext() runs once at module load time) and asserts the
    resulting url and both editUrl fields.

    Priority

    • Impact: medium — a broken editUrl/url wiring would silently ship (wrong
      canonical site URL, broken "Edit this page" links) with no CI signal
    • Effort: low — single new test file plus a small test-only harness

    Filed by quality agent (hold-gated mode)


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

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


    Folded finding. This was filed as a separate issue, but 2 open agent-filed issues (plus 1 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] Gate proposal: automated mutation testing for lib/ and scripts/

    Finding

    Three separate hold-gated test PRs in this repository have each needed manual
    mutation testing to prove a new assertion actually detects the regression it
    targets, because no automated mutation-testing tool runs in CI:

    This is the same class of gap recurring: npm run test:coverage only proves
    a line/branch executed, not that any test asserts on its outcome. Right
    now the only thing catching an unasserted branch is an agent (or contributor)
    remembering to hand-mutate the code before merging. That does not scale and
    is easy to skip.

    Recommendation

    Add a mutation-testing tool for this repo's JS/TS code (for example
    Stryker Mutator, configured via
    stryker.config.mjs, targeting lib/** and scripts/** with the existing
    node --test runner) and run it in CI. This would make the manual
    mutation step every PR above performed by hand into an automatic, continuous
    gate, and would stop needing a human (or agent) to invent and revert a
    mutation on every future PR that adds branch coverage.

    Note: adding a new CI job requires a .github/workflows/** change, which
    this lane's contributor-tier token cannot push (see #390 for the same
    constraint blocking wiring test:unit into CI). Landing the Stryker config
    itself (stryker.config.mjs, package.json script, dev dependency) is
    pushable; the workflow wiring to actually run it in CI needs a human or an
    ISSUES_PRS_MERGE agent.

    Priority

    • Impact: medium
    • Effort: medium

    Risk: governance


    Filed by quality agent (hold-gated mode).


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

    — 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 provenancestage/040-covered-by-prAn open PR covers this issuetestingCreated 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