HarperFast / HarperFast/rocksdb-js
Deno CI silently skips every GC-dependent test: --v8-flags=--expose-gc never reaches Vitest's forked workers
- Dominant language
- C++
- Stars
- 21
- Forks
- 2
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 36
Description
## Summary
Every GC-dependent test in this repository silently skips on Deno, and has for as long as the Deno
job has existed. `pnpm test:deno` passes `--v8-flags=--expose-gc` to the `deno run` CLI, but
`vitest.config.ts` selects the **`forks`** pool for Deno and Bun, and a V8 flag on Deno's command
line applies only to the process it was passed to — the forked child processes that actually run the
tests get no `globalThis.gc`.
Probed directly (deno 2.7.5, `node:child_process.fork`):
```
--v8-flags=--expose-gc parent gc: function child gc: undefined
DENO_V8_FLAGS=--expose-gc parent gc: function child gc: function
```
Node is unaffected: its pool is `threads`, and worker threads inherit `execArgv`. Bun exposes
`Bun.gc()` instead of a flag.
## Impact
Tests guarded by `it.skipIf(!globalThis.gc)` never ran on Deno — they reported as skipped rather
than failed, so nothing surfaced. Affected today:
- `test/transaction-log.test.ts` (three cases, including the transaction-log instance GC cleanup)
- `test/user-shared-buffer-notify.test.ts`
- `test/transaction-orphan-gc.test.ts` (added in #768; skips on Deno as of this issue's companion
change)
`test/lib/util.ts`'s `dbRunner` also has a post-test `gc()` + settle delay that never ran on Deno.
## Fix
Set the flag through the environment, which forked children inherit:
```diff
-"test:deno": "cross-env CI=1 deno run --allow-all --sloppy-imports --v8-flags=--expose-gc ./node_modules/vitest/vitest.mjs",
+"test:deno": "cross-env CI=1 DENO_V8_FLAGS=--expose-gc deno run --allow-all --sloppy-imports ./node_modules/vitest/vitest.mjs",
```
Verified locally (deno 2.7.5): full suite goes from 739 passed / 9 skipped to **748 passed /
5 skipped**, with the four previously-dead GC tests running and passing.
## Why this is not simply applied
Doing so on deno 2.8.3 (the version CI pins) makes two previously-hidden failures appear, so the
one-line change cannot land on its own:
- `test/lock.test.ts` — the `withLock` stall and double free, filed as #771. This is the blocker.
- `test/verification-table.test.ts` on macOS only — `a version cached before close never leaks into a
later incarnation (non-resurrection)` fails with `expected 134217728 not to be 134217728`, i.e. a
stale VT slot still reports FRESH after close/reopen. Uninvestigated; may be a second latent bug or
a Deno-specific artifact.
Sequence: fix the `withLock` bug, triage the VT failure, then enable `DENO_V8_FLAGS` and take the
restored coverage.
---
Filed by KrAIs (Claude Opus 5) while fixing CI on #768.
Contributor guide
Research direction
Start with package.json's test:deno script and vitest.config.ts, then reproduce the skipped tests with the Deno version pinned by CI. Resolve the withLock blocker in #771 and investigate the macOS verification-table failure before changing the environment flag. Done means the Deno suite runs the GC-dependent tests and passes with the restored coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- ci-cd, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100