Skip to content

chore: add c8-based coverage reporting script - #397

Merged
nate-double-u merged 3 commits into
mainfrom
quality/test-coverage-reporting
Nov 12, 2026
Merged

nate-double-u merged 3 commits into
mainfrom
quality/test-coverage-reporting

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds a test:coverage npm script (c8 --reporter=text --reporter=lcov npm run test:unit), the c8 devDependency, and a coverage/ .gitignore entry.

Today the only coverage numbers this repo has ever produced (e.g. the 89.74% branch coverage on lib/remarkRewriteLinks/index.ts cited in #393/PR #394) came from someone running npx c8 by hand and throwing the output away. This gives a repo-tracked, one-command way to reproduce that: npm run test:coverage.

Deliberately does not add --check-coverage thresholds or wire this into CI yet — the repo's branch coverage is currently below 100% until the in-flight coverage PRs (#389, #392, #394) land, and enforcing a threshold now would ship this red. Also deliberately does not touch .github/workflows/** (that's the ceiling documented on #390); this is package.json/devDependency/.gitignore only, with no test file of its own since it is tooling configuration rather than a behavior change.

Verified locally: npm run test:coverage runs and reports text + lcov coverage for the existing 16 unit tests; npx prettier --check package.json is clean.

Related Issue

Fixes #396 (adds the coverage-reporting script and devDependency the issue asks for; nothing is left for #396 to track once this merges)


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

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

Adds a test:coverage npm script (c8 wrapping test:unit) plus the c8
devDependency and a coverage/ gitignore entry, so coverage can be
checked with one command instead of ad hoc npx c8 runs. Scoped to
package.json/.gitignore only; does not touch .github/workflows/**.

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

Copy link
Copy Markdown
Contributor Author

Important

Held for human review 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.

Hive will keep the hold label until a human removes it. 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 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cncf-techdocs ready!

Name Link
🔨 Latest commit f57e8c9
🔍 Latest deploy log https://app.netlify.com/projects/cncf-techdocs/deploys/6af5f24ae81f55254b028039
😎 Deploy Preview https://deploy-preview-397--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

Copy link
Copy Markdown
Contributor Author
63bec21

ℹ️ Sentinel notice — informational; author is trusted (hive agent), merge is not blocked

Hive flagged this PR (author @hivecommons-hive[bot], head 63bec2173fd1) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 2 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • package-lock.json
    • package.json

Hive did not add the sentinel-alert label because this author is trusted. The finding remains recorded for audit and the dashboard Security tab; set sentinel.trusted_authors_block: true to require the blocking label for trusted authors too.

@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 main. This looks correct to me.

Verified:

  • package.json:39 — the new test:coverage script wraps the existing test:unit script (package.json:40 at base), which is present on main; c8 propagates NODE_V8_COVERAGE into the npm run child, so the node:test subprocess is instrumented.
  • package-lock.json — the additions are the standard c8/istanbul dependency tree (@bcoe/v8-coverage, @istanbuljs/schema, istanbul libs, yargs), all "dev": true; no runtime dependency change.
  • .gitignore:15 — coverage/ matches c8's default output directory.
  • Scope matches issue #396 exactly: no workflow changes, no thresholds, consistent with the PR body's stated deferral until #389/#392/#394 land.

One info-level note, not a defect: c8@12 declares engines: ^20.19.0 || ^22.12.0 || >=23, and this repo's package.json has no engines field — contributors on Node 20.x older than 20.19 will get an install warning/failure for this devDependency. Fine as-is; worth remembering if anyone hits it.

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

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

The change itself looks correct to me, but it currently cannot merge — mergeable_state is CONFLICTING and needs a rebase.

What I verified against the tree:

  • package.json:39 (this branch) adds "test:coverage": "c8 --reporter=text --reporter=lcov npm run test:unit", delegating to the existing test:unit. c8 propagates coverage to child processes via NODE_V8_COVERAGE, so wrapping npm run works.
  • main has no c8 devDependency and no test:coverage script today, so this is not redundant with anything merged.
  • The diff is exactly what #396 scopes: one script, one devDependency, one .gitignore entry; no .github/workflows/** touched, no thresholds — matching the deliberate scope stated in both the issue and the PR body.
  • Lockfile additions are the expected c8 dependency tree (ISC/MIT licensed, dev-only).

The conflict's cause: after this branch was cut, main changed test:unit to node --experimental-strip-types --test 'lib/**/*.test.mts' 'scripts/**/*.test.mjs' (adding the scripts/ glob). This PR's package.json context still carries the old line, so package.json (and likely package-lock.json) conflict. A rebase resolves it cleanly, and test:coverage will then automatically cover the scripts/** tests too since it delegates to test:unit — no change to this PR's logic needed.

Recommendation: author rebases onto current main, regenerates the lockfile entry, repushes. After that this looks ready for a maintainer.

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

@nate-double-u

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

…-reporting

# Conflicts:
#	package-lock.json
#	package.json

Co-authored-by: nate-double-u <4453979+nate-double-u@users.noreply.github.com>

Copilot AI commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in f57e8c9. Coverage passes all 41 tests with the sandbox Git URL adjusted locally.

@nate-double-u
nate-double-u merged commit 4c26f8e into main Nov 12, 2026
9 checks passed
@nate-double-u
nate-double-u deleted the quality/test-coverage-reporting branch November 12, 2026 17:19
nate-double-u pushed a commit that referenced this pull request Nov 13, 2026
package.json's test:coverage script (added in #397) reported coverage
but never failed the build on regression: c8's defaults are 0% for
branches/functions/statements and 90% for lines. #396 deliberately
deferred adding thresholds until in-flight coverage PRs merged, to
avoid landing the gate red.

lib/ is now 100% across all four metrics (after #389/#392/#394/#401).
Only scripts/add-frontmatter.mjs remains below 100% branch coverage,
tracked by the still-open #402. Set thresholds at the currently
achieved levels (99/99/97/100) so the gate passes today and catches
any future regression; it can be tightened to --100 once #402 merges.

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] No coverage-reporting script — branch/line coverage isn't tracked anywhere

2 participants