HarperFast / HarperFast/harper

typestrip dev runtime is broken on main (unattributed JSON import) and no CI job runs test:unit:typestrip

Open
#2,623 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
89
Forks
10
Avg merge
2d 6h
Merged PRs (30d)
200

Description

## Summary

The documented typestrip dev runtime (`--conditions=typestrip`, AGENTS.md) is broken on `main`: any test or module whose import graph reaches `security/user.ts` fails before user code runs, because `import systemSchema from '../json/systemSchema.json'` carries no `with { type: 'json' }` attribute and Node throws `ERR_IMPORT_ATTRIBUTE_MISSING` under native source execution. `unitTests/mocha.init.js` requires `#src/utility/environment/environmentManager`, whose graph includes that import — so `npm run test:unit:typestrip` fails at init for every suite.

Nothing noticed because **no CI workflow runs `test:unit:typestrip`** — the script is referenced in AI-review prompt text but is not a step in any workflow, so the gate rotted silently. (Found while working #2607/#2609: the same class of defect — a `.js` specifier pointing at a deleted `.ts` file — passed every dist-based gate and was only caught by cross-model review, precisely because the typestrip suite that would have caught it can't run.)

## Reproduction

- `NODE_OPTIONS="--conditions=typestrip" npx mocha unitTests/utility/functions/geo.test.js` (an untouched file) — fails with `ERR_IMPORT_ATTRIBUTE_MISSING` from `unitTests/mocha.init.js` before the test loads.
- `node -e "require('./utility/environment/environmentManager.ts')" --conditions=typestrip` reproduces with zero test involvement.
- Verified on the `.nvmrc`-pinned Node (24.19.0) and on 24.18; verbatim-identical on `origin/main`.

## Suggested fix

1. Add `with { type: 'json' }` to the JSON imports reachable from module-graph roots (erasable-syntax-compatible; `security/user.ts` is the known instance, sweep for others: `grep -rn "from '.*\.json'" --include='*.ts'`).
2. Add a CI job (or a step in the unit-test workflow) that runs `test:unit:typestrip` — or at minimum a smoke that imports the main entry under `--conditions=typestrip` — so the documented runtime can't silently rot again.

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

Open the contributing guide

Research direction

Start by running the documented reproduction with --conditions=typestrip and read unitTests/mocha.init.js, then inspect security/user.ts and other JSON imports reachable from the module graph. Done means the typestrip suite starts successfully with the required JSON attributes and a CI workflow runs test:unit:typestrip or an equivalent smoke check.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, node.js, typescript
Domain
backend, ci-cd, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.