Skip to content

test: enumerate tests/tools/ in --require-source-files - #1154

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-require-source-files-harness
Oct 7, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-require-source-files-harness

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

--require-source-files is the file-set floor: a ratio gate cannot see a module nobody imports, because its lines are absent from the numerator and denominator alike. The guard walked SOURCE_ROOTS = ['scripts', 'src'] only — and tests/tools/ is the harness the whole suite runs on (the overlay engine, the loaders, both coverage reporters, the fake DOM, the Playwright fixtures). A module there that nothing imports was exactly as invisible, with the failure landing on the measuring apparatus itself. tests/tools/e2e-data-fixture-loader.cjs reached main that way (#1129) and was found by eye, not by a check.

tests/tools/coverage-report.mjs

  • SOURCE_ROOTS now enumerates join('tests', 'tools'), with a comment stating why this tree qualifies where root-level configuration does not: it is a tree, and every module in it is expected to be exercised.
  • isSourceFile() is deliberately unchanged — everything under tests/ is still non-source, so a harness module counts toward the file-set floor without entering the src files ratios.
  • The flag's header prose and both --require-source-files messages name the third root (they interpolate SOURCE_ROOTS, so the "Never measured" notice and the failure line follow automatically).

tests/coverage-report-source-files.test.mjs

  • enumerateSourceFiles fixture now pins tests/tools/five.mjs and tests/tools/nested/six.cjs as enumerated while tests/five.test.mjs stays out.
  • New CLI case --require-source-files names an unimported module under tests/tools/: a narrow run over tests/validate-utils.test.mjs exits 1, names tests/tools/e2e-data-fixture-loader.cjs, and still omits the one measured module and every test file outside the harness.
  • The "Never measured" notice parsing (header count vs. listed paths) is lifted into a shared namedInNotice helper used by both CLI cases.

Verification

  • npm run test:unit:coverage:check — exit 0 on this branch at bcfca86 (node v26.10.0, TZ=UTC): no "Never measured" block, src files | 100.00 | 99.92 | 8849/8849 lines | 2506/2508 regions, all files | 99.44 | 95.20. The new root is green on main because test: cover the e2e data-fixture webpack loader #1130 landed the first test importing the loader.
  • node --test tests/coverage-report-source-files.test.mjs — 5 passed.
  • prettier --check and eslint clean on both files.

No workflow file is touched: .github/workflows/ci.yml already invokes test:unit:coverage:check with --require-source-files, so the gate picks the third root up with no workflow edit.

Related Issue

Closes #1131


Human review required.

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

The file-set floor walked scripts/ and src/ only, so a harness module that
nothing imports was recorded nowhere and no gate moved -- exactly the blind
spot --require-source-files exists to close, applied to the measuring
apparatus itself. tests/tools/e2e-data-fixture-loader.cjs reached main that
way and was found by eye.

tests/tools/ meets the same bar scripts/ and src/ do: it is a tree, not a
scattering of root-level configuration, and every module in it is part of
the harness the suite runs on. isSourceFile() is unchanged, so a harness
module counts toward the file-set floor without entering the src files
ratios.

Closes #1131

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive hivecommons-hive Bot added the hold label Oct 7, 2026
@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. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

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.

@mrbobbytables
mrbobbytables added this pull request to the merge queue Oct 7, 2026
Merged via the queue into main with commit 8af2fd0 Oct 7, 2026
7 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-require-source-files-harness branch October 7, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] --require-source-files does not enumerate tests/tools, so an unimported harness module trips no gate

1 participant