Skip to content

test: assert the src/ and scripts/ module-resolution contract (tests/module-imports.test.mjs) - #328

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-module-imports
Open

kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-module-imports

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/module-imports.test.mjs — the only file this PR touches.

Nothing in the suite previously opened a source file to read an import
statement. This test reads every specifier in src/**/*.js and
scripts/**/*.mjs (22 files, 26 distinct specifiers at 00b44df) and
asserts each one resolves to something real.

Assertions

test rule
the import scan finds source files and specifiers non-vacuity guard — a regex regression cannot silently empty the five below
every node: specifier names a real Node builtin module.isBuiltin
every relative import in src/ resolves to a file webpack rules: optional extension, /index entry
every relative import in scripts/ resolves exactly, extension included plain Node ESM — ./lib/github throws ERR_MODULE_NOT_FOUND even though webpack accepts it
every @site/ alias resolves from the repository root Docusaurus project-root alias
every bare import is declared in package.json dependencies/devDependencies; @docusaurus/* subpath aliases are satisfied by @docusaurus/core

Verification

  • Green on main: node --test61 tests pass (55 before, 6 added),
    node v26.8.2 at parent rev 00b44df. No production change; the contract
    already holds.
  • Mutation-validated: each of the five substantive assertions was proven to
    fail, with a precise message, against a deliberately broken tree —
    node:fsnode:fsx, ../hooks/useFocusTrap...Trapp,
    ./lib/validate-utils.mjs./lib/validate-utils,
    @site/data/projects-born.json...projects-gone.json, reactreakt.
    All mutations reverted; the diff is the one new test file.
  • npx prettier --check clean. No new dependencies.

Scope and disjointness

This PR claims exactly one cluster: module specifier resolution in
src/**/*.js and scripts/**/*.mjs
, file tests/module-imports.test.mjs.

Related Issue

Closes #326 — merging this lands every box in that issue's recommendation, so
nothing is left for it to track.


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

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

Adds tests/module-imports.test.mjs, which reads every import specifier in
src/**/*.js and scripts/**/*.mjs and asserts it resolves to something real.
No test previously opened a source file to read an import statement.

Five assertions, each mutation-validated:

  - node: specifiers name real builtins
  - relative imports in src/ resolve under webpack's optional-extension
    and /index rules
  - relative imports in scripts/ resolve exactly, extension included,
    matching plain Node ESM (./lib/github would throw ERR_MODULE_NOT_FOUND)
  - @site/ aliases resolve from the repository root
  - bare specifiers are declared in package.json, with @docusaurus/*
    subpath aliases satisfied by @docusaurus/core

A sixth guard asserts the scan found files and specifiers, so a regex
regression cannot silently empty the other five.

Scope is src/ and scripts/ only; MDX imports and named-export identity are
deliberately not read. Test-only, no new dependencies, green on main.

Closes #326

Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
@kubestellar-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 automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@kubestellar-hive kubestellar-hive Bot added quality Approved by a Hive merger/owner for auto-merge on green CI testing Approved by a Hive merger/owner for auto-merge on green CI agent/quality Approved by a Hive merger/owner for auto-merge on green CI hive/hosted-available-lke648397-260827-5n31 Approved by a Hive merger/owner for auto-merge on green CI labels Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/quality Approved by a Hive merger/owner for auto-merge on green CI hive/hosted-available-lke648397-260827-5n31 Approved by a Hive merger/owner for auto-merge on green CI hold quality Approved by a Hive merger/owner for auto-merge on green CI testing Approved by a Hive merger/owner for auto-merge on green CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] src/ and scripts/ module-resolution contract is untested; no gate reads import specifiers

0 participants