Skip to content

test(node): run portable API loader coverage - #3989

Merged
kwakayama merged 3 commits into
mainfrom
fix/issue-730-node-loader-coverage
Aug 22, 2026
Merged

kwakayama merged 3 commits into
mainfrom
fix/issue-730-node-loader-coverage

Conversation

@kojiwakayama

@kojiwakayama kojiwakayama commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add explicit first-line metadata for test files whose Deno references are individually runtime-guarded
  • share the source classifier between the Node and Bun test runners
  • run portable API module-loader behavior on Node while keeping timestamp, symlink, real-path, worker, and Deno npm cases covered only on Deno
  • normalize the portable lockfile failure assertion across Deno and Node error wording

Red and green

The regression test initially failed because loader.test.ts was classified as Deno-only. The first real Node run then surfaced four runtime-specific cases, which are now explicitly guarded instead of excluding the whole file.

The targeted Node run visibly executes 63 loader tests: 52 pass, 11 explicit Deno-only skips, 0 failures. The preparation test exercises route source hashing, so an unsupported primitive in that path fails the Node job.

Verification

  • deno task test:node (all shards, zero failures)
  • targeted Node loader run (52 pass, 11 skip)
  • focused Deno loader and filter run (68 steps, all Deno-only cases active)
  • bun test tests/test-file-utils.test.mjs (39 pass)
  • deno task build:npm
  • bash scripts/test/npm-install-smoke.sh
  • deno task lint
  • deno task typecheck

Refs veryfront/veryfront-issue-inbox#730

Review follow-up

  • The header check accepted only an LF line ending. There is no .gitattributes in this repo, so a Windows clone with core.autocrlf=true read the header as absent and dropped the whole file from the Node and Bun suites, which is the exact exclusion this change exists to remove. The check moved into a shared hasRuntimeGuardedDenoHeader that strips a trailing carriage return, and tests/runtime-test-filters.test.ts now calls the same helper instead of repeating the comparison.
  • Merged origin/main. The one conflict was the lockfile-failure case: main moved it onto withMockFetch while this branch changed the same assertion to match both the Deno and the Node wording. Kept both.
  • The gate is not decorative. Reintroducing a Uint8Array.prototype.toHex() call in the module-loader hashing path (toHex in src/utils/hash-utils.ts, the [BUG] Every API route fails to load on stock Node — module loader calls Deno-native Uint8Array.prototype.toHex() #3968 defect) makes the targeted Node run fail with TypeError: (intermediate value).toHex is not a function, exit 1. The same mutation against origin/main's runner filters exits 0 and prints nothing, because the file was excluded.
  • Post-merge: Deno 63 steps all active and passing, Node 52 pass, 11 explicit Deno-only skips, 0 failures. The two numbers reconcile exactly, so every case skipped on Node still runs on Deno.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kwakayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 538717ba-0eef-4b07-b95d-0f8f4e5ff6eb

📥 Commits

Reviewing files that changed from the base of the PR and between 988edca and ad2c5e2.

📒 Files selected for processing (6)
  • src/routing/api/module-loader/loader.test.ts
  • tests/bun/run-tests.mjs
  • tests/node/run-tests.mjs
  • tests/runtime-test-filters.test.ts
  • tests/test-file-utils.mjs
  • tests/test-file-utils.test.mjs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

📦 Client bundle boundary

Entrypoint Modules Source size Server leaks
src/index.client.ts 327 1961 KiB ✅ 0

A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in scripts/lint/client-bundle-baseline.json to burn down.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e54342252

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/test-file-utils.mjs Outdated
A Windows checkout with core.autocrlf=true ends the first line in CRLF, so
an exact LF comparison read the header as absent. The heuristic then saw the
guarded Deno references in loader.test.ts and dropped the whole file from the
Node and Bun suites, removing the portable coverage this change adds.

Move the check into hasRuntimeGuardedDenoHeader, which compares the first
line with its trailing carriage return stripped, and use it from both the
runner filter and the repository contract test.
main moved the lockfile-failure case onto withMockFetch while this branch
changed the same assertion to match both the Deno and the Node wording.
Kept both: the mock fetch wrapper from main, the captured error and the
portable assertMatch from this branch.
@kwakayama
kwakayama added this pull request to the merge queue Aug 22, 2026
Merged via the queue into main with commit 1f470fa Aug 22, 2026
38 checks passed
@kwakayama
kwakayama deleted the fix/issue-730-node-loader-coverage branch August 22, 2026 22:55
kwakayama added a commit that referenced this pull request Aug 22, 2026
#3989 moved the Deno-dependence predicate into `tests/test-file-utils.mjs`
as `isDenoDependentTestSource` and gave it an opt-out: a file whose first
line is `// @veryfront-test runtime-guarded-deno` stays eligible for the
Node and Bun suites. `src/routing/api/module-loader/loader.test.ts` uses
it.

This branch had already lifted the old inline predicate into the planner,
so a plain merge kept the pre-#3989 copy and the Node suite dropped that
file again: 1267 files on main, 1266 after the merge, with no runner
reporting anything but a pass. The planner now calls the shared predicate
instead of carrying its own.

The parity test could not catch it, because its legacy helper carried a
third copy of the same rule and agreed with the stale planner. It calls
the shared predicate now too, and a new case asserts the Node plan
contains the module-loader file, which fails without this change.
`tests/runtime-test-filters.test.ts` keeps guarding the predicate itself.

Verified: every suite selects the same files as the command it replaced,
measured on this tree. unit:parallel 1941, unit:cwd 7, unit:cwd-exclusion
2 (1941+7+2 = 1950 = coverage:unit), integration:legacy-tests-root 180,
integration:cli 24, runtime:node 1267, runtime:bun 1394. Node and Bun
match origin/main file for file.

Conflicts resolved: `tests/node/run-tests.mjs` and `tests/bun/run-tests.mjs`
keep the planner bridges (main's dead local predicates are gone with the
selection code that used them); `tests/runtime-test-filters.test.ts` keeps
both import sides.
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.

2 participants