Repository navigation
Description
Problem
Sequant declares engines.node >= 22.12.0 (raised deliberately in #677/#679 to drop EOL Node 20), but nothing enforces it at runtime. engines is advisory — npm/npx only emits an EBADENGINE warning and proceeds (unless the user has the rare engine-strict=true). So a user on Node 20/21:
- Sees an easily-missed install-time warning, then
- Runs
sequantanyway, and if Sequant or a dependency (commander, the agent SDK) trips a Node-22-only API, gets an opaque stack trace instead of "upgrade your Node."
CI only runs Node 22.x (.github/workflows/ci.yml), so Node-20 runtime behavior is untested — green CI does not imply it works. The /setup skill has a soft Node warning, but it's one-time and only fires if a user runs setup; it does not cover sequant run / sequant serve invocations or post-setup Node changes.
This was hit in practice during local dev: npx sequant run on Node 20.17.0 produced the EBADENGINE noise and was easy to blow past.
Proposed fix
A small runtime Node-version preflight guard: at CLI startup, if the running Node is below the declared floor, print a clear, actionable message (current vs required + upgrade paths) and exit non-zero — before any command logic runs. This converts "ignorable warning → later opaque crash" into one friendly, immediate message.
Design (already critiqued for overcomplexity)
Reuse what exists — this is ~10–15 lines, zero new dependencies:
- Home:
src/lib/version-check.ts(alongside the existing install-location guardsisHomeStrayInstall/buildHomeStrayWarning), invoked frombin/cli.tsnear the existing guard block (~bin/cli.ts:132, beforeprogram.parse()). - Comparison: reuse the existing
compareVersions(a, b)inversion-check.ts(:281). Do not addsemver. - Floor source: derive from
engines.nodeinpackage.json— single source of truth, reusing the same package.json walk-up read thatgetVersion()already does inbin/cli.ts. Do not hardcode a separate"22.12.0"literal that can drift. - Pure/side-effect split: a pure
getNodeVersionError(current, floor): string | null(unit-testable), wrapped by a thinassertNodeVersion()that prints +process.exit(1). - Self-safe: guard uses only built-in globals / widely-supported syntax so it executes (not crashes) on the old Node it rejects; runs as early as practical after imports.
- Behavior: hard fail-fast with non-zero exit and a message naming current vs required Node + 2–3 upgrade paths (fnm / nvm / nodejs.org).
Explicitly out of scope (rejected as overcomplexity)
- No
semver(or any new) dependency — reusecompareVersions. - No
SEQUANT_SKIP_NODE_CHECKbypass env var — YAGNI; npmengine-strictalready exists. - No auto-install / auto-upgrade of Node, no version-manager detection.
- No checking npm/git/gh versions — that remains
/setup's job. - No per-command guards or warn-vs-fail config knob — one guard at entry, hard fail.
Acceptance Criteria
- AC-1 On Node below the
engines.nodefloor, running anysequantcommand (includingsequant serve) prints a clear message stating current vs required Node version and at least one upgrade path, and exits non-zero — before command logic runs. - AC-2 On Node at/above the floor, there is zero behavior change: no added output, exit 0.
- AC-3 The floor is derived from
engines.nodeinpackage.json(single source of truth), not a separately hardcoded version literal. - AC-4 The check reuses the existing
compareVersionsinsrc/lib/version-check.ts; nosemveror other new runtime dependency is added. - AC-5 A pure, side-effect-free function (message-or-null) is unit-tested across boundary versions:
20.x→ fail,22.11.x→ fail,22.12.0→ pass,22.12.1→ pass,24.x→ pass. - AC-6 The guard lives in
src/lib/version-check.tsand is invoked frombin/cli.tsnear the existing home-stray guard, using only built-in globals so it runs (does not crash) on the old Node it rejects.
Files affected
src/lib/version-check.ts— addgetNodeVersionError(pure) +assertNodeVersion(exit shell), reusecompareVersionsbin/cli.ts— readengines.nodefloor (same walk-up read asgetVersion()), callassertNodeVersion()near:132src/lib/version-check.test.ts(or sibling) — boundary-version unit tests
References
- Engine floor rationale: chore: raise Node engine floor to >=22.12 (drop EOL Node 20), unblock commander 15 #677 / chore(#677): raise Node engine floor to >=22.12 (drop EOL Node 20) #679 (drop EOL Node 20)
- Related noise this complements: fix(run): pre-flight guard misses in_progress issues already merged on GitHub (gap in #305/#423) #592 (fallback noise),
feedback_dep_bump_engine_floor.md(green CI ≠ runtime/engine compat; CI is Node-22-only) - Not an upstream concern: the git-drift / stale-SDK / npx dual-prefix issues observed alongside this are local-dev-checkout artifacts and do not reach npm consumers.
Activity
admarble commentedon Jun 21, 2026
Complexity: Standard (6 ACs, 2 directories)
AC Quality Check
All 6 ACs are measurable with explicit boundaries (AC-5 even enumerates the version table). No vague/unmeasurable/open-ended patterns. No title/body tension. ✅ Clean.
Scope Assessment
Non-Goals: ✅ Present and unusually thorough — issue's "Explicitly out of scope" rejects
semver, bypass env var, auto-upgrade, npm/git/gh checks, per-command guards.bin/,src/lib/)Verdict:⚠️ SCOPE_WARNING (AC count hits the 6 boundary) — but this is an artifact of AC-3/4/5/6 being constraints on one ~15-line function, not 6 independent features. Real surface is one pure fn + one shell wrapper + one call site. Treat as effectively SCOPE_OK; quality-loop value is marginal here.
Acceptance Criteria
AC-1: Sub-floor Node prints current-vs-required + upgrade path, exits non-zero before command logic
Verification: Integration Test — message assertions via the pure fn (AC-5); exit behavior via
assertNodeVersion()withprocess.exitmocked. (True in-process Node-20 downgrade can't be simulated; injectcurrent/floorinstead.)Scenario: Given Node 20.17.0 → When
sequant <any cmd>(incl.serve) → Then stderr shows "current 20.17.0 / required >=22.12.0" + ≥1 upgrade path, exit code ≠ 0, no command runs.AC-2: At/above floor → zero behavior change, exit 0
Verification: Unit Test —
getNodeVersionError(currentAtOrAbove, floor)returnsnull.Scenario: Given Node ≥22.12.0 → When any command → Then no added output, normal exit.
AC-3: Floor derived from
engines.node, not a hardcoded literalVerification: Integration Test — assert the floor passed to the guard equals
package.jsonengines.node(strip range operator); grep confirms no"22.12.0"literal in the guard.Scenario: Given
engines.nodechanges → When CLI starts → Then floor tracks it automatically.AC-4: Reuses
compareVersions; no new runtime dependencyVerification: Manual/Static — code review confirms
compareVersionsreuse;git diff package.jsonshows no added dep; noimport "semver".AC-5: Pure side-effect-free fn unit-tested across boundaries
Verification: Unit Test —
20.x→fail,22.11.x→fail,22.12.0→pass,22.12.1→pass,24.x→pass (message-or-null).Scenario: Table-driven test in
src/lib/version-check.test.ts.AC-6: Guard lives in
version-check.ts, invoked frombin/cli.tsnear home-stray guard, built-in globals onlyVerification: Manual/Static — location check; review confirms only
process.version/console/process.exit(no transpiled-down Node-22 syntax, no heavy imports inside the guard path).Implementation Plan
Phase 1: Pure core + tests (
src/lib/version-check.ts,.test.ts)getNodeVersionError(current: string, floor: string): string | nullnearcompareVersions(:281). ReturnsnullwhencompareVersions(current, floor) >= 0; else a multi-line message naming current vs required + 2–3 upgrade paths (fnm / nvm / nodejs.org).engines.nodeis">=22.12.0";compareVersions(">=22.12.0","20.17.0")returns -1 (wrong — would pass Node 20) becauseparseInt(">=22")→NaN→0. Normalize with e.g.floor.replace(/^[^\d]*/, "")before the compare (do this insidegetNodeVersionErrororassertNodeVersion).src/lib/version-check.test.ts.Phase 2: Shell wrapper + wiring (
src/lib/version-check.ts,bin/cli.ts)assertNodeVersion(floor: string): computeprocess.version, callgetNodeVersionError; if non-null →console.error(...)+process.exit(1).bin/cli.ts, readengines.nodeduring the existinggetVersion()walk-up (return the pkg'sengines?.nodealongside/like the version — single read), then callassertNodeVersion(floor)before the home-stray block (:130) so it fires ahead of any command logic.Design Review
src/lib/version-check.ts— co-located withisHomeStrayInstall/buildHomeStrayWarning, the established pure-predicate + builder pattern. ✅ Matches issue.getNodeVersionError(string|null) + thin exitingassertNodeVersion. Reject: a class, a config knob, env bypass — all in issue Non-Goals.isHomeStrayInstall(pure) /buildHomeStrayWarning(message) /cli.tsemission split already in the file.:130. If a dependency throws at import time on Node 20, the guard never fires. See Open Question 1.>=prefix?" — yes (Phase 1 step 2); this is the load-bearing detail.Feature Quality Planning
Standard checks pass. Notable items:
getNodeVersionError("20.17.0", ">=22.12.0")is non-null).chalk/commanderimport cleanly on Node 20 (they're runtime-incompatible, not import-incompatible — low risk).getVersion()refactor — returningengines.nodefrom the same walk-up avoids a secondpackage.jsonread; keep the"0.0.0"-style fallback semantics (e.g. floornull→ skip guard rather than crash).Open Questions
bin/cli.ts:~130per the issue ("as early as practical after imports") — heavy deps here are runtime-incompatible, not import-incompatible, so they won't throw before the guard. Impact if wrong: an import crashes on Node 20 before the friendly message, reverting to an opaque trace for that one dependency. Cheap mitigation if observed: moveassertNodeVersioninto a tiny zero-dep module imported first.engines.nodeabsent or non-semver). Recommendation: treat as "skip guard" (return early), never crash the CLI on a metadata problem. Impact: guard silently disabled — acceptable, matches advisory nature.Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: disabled (small, well-bounded diff; SCOPE_WARNING is a boundary artifact)
Reasoning: AC-2/AC-5 are Unit-Test ACs → testgen stubs the boundary table before exec. No UI → no
testphase. Not security-sensitive. Tight ~15-line scope doesn't warrant the quality loop.Label Review
Current:
enhancement,cliRecommended: keep
enhancement,cli(optionallysimple-fix— diff is ~15 lines across 3 files)Reason: CLI behavior addition, no schema/UI/breaking surface.
Quality Loop: Won't auto-enable (recommending disabled; SCOPE_WARNING is at-boundary only).
→ no label change required.
admarble commentedon Jun 21, 2026
/exec — Implementation Complete
PR: #736 — #736
AC Coverage
engines.node(single source of truth)compareVersions; nosemver/new runtime depversion-check.ts, invoked frombin/cli.ts, built-in globals onlyAll 6 ACs satisfied.
Files Changed
src/lib/version-check.ts—getNodeVersionError(pure, message-or-null, strips>=prefix) +assertNodeVersion(print +process.exit(1))bin/cli.ts—getVersion→getPackageMeta(reads version +engines.nodein one walk-up);assertNodeVersion(engineFloor)near home-stray guardsrc/lib/version-check.test.ts— boundary table + range-strip + exit-behavior testsCHANGELOG.md—[Unreleased] / AddedentryChecks
npm run buildnpm run lintnpx vitest run src/lib/version-check.test.tsassertNodeVersion('>=999.0.0'))Range-prefix handling (spec's highest-risk gap)
getNodeVersionErrorstrips the leading range operator before comparing, with a direct regression test:getNodeVersionError("20.17.0", ">=22.12.0")is non-null. A missing/unparseable floor returnsnull(guard skipped — never crashes the CLI on a metadata problem).Known gaps
None. A true in-process Node-20 downgrade can't be simulated, so AC-1/AC-5 are verified by injecting
current/floorinto the pure fn and mockingprocess.exitfor the shell wrapper — exactly as the /spec verification plan prescribed.admarble commentedon Jun 21, 2026
Test Stubs — Already Implemented (no stubs generated)
/testgenran after/execfor this issue, so the verification criteria from/specare already covered by real, passing tests insrc/lib/version-check.test.ts(66 passed). Emittingthrow new Error(...)stubs now would overwrite passing tests or leave failing duplicates, so none were generated. Mapping below.assertNodeVersion(process.exitmocked)getNodeVersionError"fails on Node 20.x" (asserts current + required strings);assertNodeVersion"prints message and exits non-zero when below the floor" (process.exit/console.errormocked)getNodeVersionError(atOrAbove, floor)returnsnullengines.node, no hardcoded literalgetPackageMetareturnspkg.engines?.node; grep confirmed no22.12.0logic literalcompareVersions, nosemver/new depsemverimport/dep in diffgetNodeVersionErrordescribe block — 5 boundary tests +>=range-strip regression testassertNodeVersioninversion-check.ts, called inbin/cli.tsnear home-stray guard; uses onlyprocess.version/console/process.exitCoverage summary
getNodeVersionError+assertNodeVersiondescribe blocks, including the load-bearing>=-prefix-strip regression and the missing/unparseable-floor skip path./execand re-confirmed here.process.exit(1), range-operator misparse, and missing-floor (guard-skip) are all exercised.Test run:
npx vitest run src/lib/version-check.test.ts→ 66 passed.Next step:
/qa 734— implementation + tests are in PR #736.Generated with Claude Code
admarble commentedon Jun 21, 2026
QA Review for Issue #734
AC Coverage
serve)assertNodeVersion(engineFloor)atbin/cli.ts:132runs at module-eval, beforeprogram.parse()→ fires for every command incl.serve. Message names current + required + 3 paths (fnm/nvm/nodejs.org). E2E verified: realprocess.exit(1)+ messagegetNodeVersionErrorreturnsnull≥ floor;node dist/bin/cli.js --version/--help→ no added output, exit 0engines.node, not hardcodedgetPackageMetareturnspkg.engines?.node ?? null; no22.12.0logic literal (only in a doc-comment example)compareVersions; nosemver/new depgetNodeVersionErrorcallscompareVersions;grep semver package.json→ 0>=-strip regression + missing/unparseable-floor skip (12 tests)version-check.ts, invoked frombin/cli.tsnear home-stray guard, built-in globals onlyassertNodeVersioninversion-check.ts, called atcli.ts:132immediately before home-stray block; uses onlyprocess.version/console/process.exitCoverage: 6/6 AC items fully met (no derived ACs)
CI Status
typecheckbuild (22.x)validate-skillsvalidate-pluginCI Summary: 4 passed, 0 pending, 0 failed.
mergeable: MERGEABLE,mergeStateStatus: CLEAN.Quality Metrics
any/as any)Local:
npm run build✅ ·npm run lint✅ (0 warnings) ·vitest run version-check.test.ts✅ 66 passed.Test Coverage Analysis
src/lib/version-check.tssrc/lib/version-check.test.ts(12 new tests)bin/cli.tscli.test.tsexists in repo; logic extracted to testedversion-check.ts;getPackageMetaexercised via build + e2e runCoverage: 1/1 testable source unit covered. The
bin/cli.tsglue (getPackageMeta+ single call site) is integration-only by nature and consistent with the repo (no existing bin test).Test Quality Review
console.error/process.exitcalls — behavior, not internals>=-strip + missing/unparseable floor + both exit branchesprocess.exit/console.error(required to test the exit shell)assertNodeVersiontests vary the floor (runner Node is fixed) with an explanatory commentCode Review
Strengths:
isHomeStrayInstall/buildHomeStrayWarningpattern.>=-prefix strip is implemented and has a dedicated regression test — the spec's feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1 risk.getVersion→getPackageMetarefactor reads version + floor in one walk-up (no secondpackage.jsonread); preserves the"0.0.0"/nullfallback semantics.Issues: None blocking.
Suggestions: None — scope is exactly the spec's ~15-line core.
Call-Site Review
New exported functions: 2
getNodeVersionErrorversion-check.ts:346(insideassertNodeVersion) + testsassertNodeVersionbin/cli.ts:132program.parse()No dead exports. Verified the
getVersion→getPackageMetarename was local tobin/cli.ts— the sharedgetVersioninsrc/lib/version.ts(used bydoctor.ts/serve.ts) is untouched, so no breakage (build confirms).Execution Evidence
assertNodeVersion('>=999.0.0')via compiled modulenode dist/bin/cli.js --version/--helpEvidence status: Complete
Product Review
User-facing change: Node-version startup guard (no new flag).
EBADENGINE+ later opaque crashengines.node→ guard silently skipped (graceful, matches advisory nature)Gaps found: None.
CHANGELOG Verification
feat(cli):commit[Unreleased]entryResult: CHANGELOG requirements met
Risk Assessment
bin/cli.ts(commander/chalk/command modules) throws at import time on Node 20 — before the guard at:132runs — reverting to an opaque trace for that one dependency. The spec explicitly evaluated this (Open Question 1) and accepted it: these deps are runtime-incompatible, not import-incompatible. Documented, accepted design; cheap mitigation (tiny zero-dep first-import module) deferred unless observed.current/floorinto the pure fn and mockingprocess.exit— exactly the /spec verification plan.serve/MCP and every other command route through the singlebin/cli.tsentry, so one guard covers them all; there is no second binary needing the same check.getPackageMeta's walk-up resemblessrc/lib/version.ts:getVersionbut is a distinct function with a different purpose, correctly left untouched.Adversarial Re-Read
Findings: No gaps found because: (1) the issue body's verbatim motivating scenario ("
npx sequant runon Node 20.17.0") is a literal test fixture —getNodeVersionError("20.17.0", ">=22.12.0")asserts non-null; (2) the e2e "evidence" is a post-fix validation (real exit 1 + message), not a pre-fix bug repro; (3) process state inspected — only an unrelated pre-existingpackage-lock.jsonplatform churn is uncommitted (correctly excluded), branch in sync, mergeable CLEAN; (4) sibling sites cited above (cross-file: none — single entry; intra-file: none — single call site); (5) all issue Non-Goals held — nosemver, noSEQUANT_SKIP_NODE_CHECKbypass, no auto-install, no npm/git/gh checks, no per-command guard or config knob.Status: Clean
Verdict: READY_FOR_MERGE
All 6 ACs MET, CI green and mergeable, zero type/security/scope issues, the spec's highest-risk detail (
>=strip) is implemented and regression-tested, and scope held exactly to the spec's core. A+ implementation.Documentation
[Unreleased], feat(cli): runtime Node-version preflight guard (clear message instead of opaque crash below engines floor) #734)/setup's soft Node warning unchanged)Next Steps
/docs 734(likely N/A — internal guard, no admin-facing surface).admarble commentedon Jun 21, 2026
QA Review for Issue #734
Runtime Node-version preflight guard — fail-fast with a clear message when running Node is below the
engines.nodefloor. Reviewed PR #736 (commitcf3b1d0).AC Coverage
serve)engines.nodeto>=999.0.0, rancli.js status→ printed message,exit: 1. Guard runs atbin/cli.ts:130beforeprogram.parse();serveis a registered command (:522) so it routes through the same parse. Single bin entry (dist/bin/cli.js), single shebang — no bypass path.cli.js --versionon Node 22.23 → normal output,exit: 0, no added lines. Guard returnsnulland is a no-op.engines.node(single source of truth), no hardcoded literalgetPackageMeta()readspkg.engines?.nodevia the same walk-up read asgetVersion(); no"22.12.0"literal in source.compareVersions; nosemver/new runtime depgetNodeVersionErrorcallscompareVersions; nopackage.jsondependency change in diff.version-check.ts, invoked near home-stray guard, built-in globals onlyassertNodeVersionusesprocess.version/console.error/process.exit— self-safe on the old Node it rejects. Invoked atbin/cli.ts:130.Coverage: 6/6 AC items fully met
CI Status
typecheckbuild (22.x)validate-skillsvalidate-pluginCI Summary: 4 passed, 0 pending, 0 failed
Quality Metrics
any)Local
npx vitest run version-check.test.ts→ 66 passed.npm run build(tsc) → clean.Test Coverage Analysis
src/lib/version-check.tssrc/lib/version-check.test.tsbin/cli.tsassertNodeVersion(engineFloor)call)Coverage: Pure logic fully unit-tested; the thin CLI wiring is exercised by the E2E smoke test.
Code Review
Strengths:
getNodeVersionErrorvsassertNodeVersion) makes the core logic trivially testable without touchingprocess.exit.replace(/^[^\d]*/, "")) strips the>=range operator; a dedicated test guards this load-bearing detail (without itparseInt(">=22")→NaN→0would wrongly pass Node 20).null) — apackage.jsonmetadata problem can't brick the CLI.getVersion()→getPackageMeta()refactor avoids a second package.json walk-up; clean reuse.Issues:
Suggestions:
package-lock.jsonmodification (removal oflibcfields from optional deps) — a local-checkout artifact, NOT part of PR feat(cli): runtime Node-version preflight guard (#734) #736's committed diff. Recommendgit checkout package-lock.jsonin the worktree before merge to avoid accidentally staging it.Execution Evidence
node dist/bin/cli.js --versionengines.node=>=999.0.0,node dist/bin/cli.js statusgetNodeVersionError("v22.23.0", ">=999.0.0")Evidence status: Complete
Risk Assessment
engines.nodevalue, which is handled by the fail-softnullreturn (guard skips rather than crashes).getNodeVersionErroris pure and the boundary table covers the comparison logic; the guard uses only built-in globals so it can't crash the old Node it rejects.dist/bin/cli.js); the guard sits ahead ofprogram.parse(), so every subcommand (includingserve) is covered by the single guard.Adversarial Re-Read
Findings: No gaps found because: (1) traced the only entry point —
package.jsonbinmaps solely todist/bin/cli.js, only shebang file isbin/cli.ts, andserveis a registered command routing throughprogram.parse()which runs after the guard, so the AC-1serverequirement is genuinely covered; (2) the "evidence" is a post-fix E2E (bumped floor → exit 1, restored floor → exit 0), not a pre-fix bug repro; (3) inspected process state — found an uncommittedpackage-lock.jsonlibc-field change in the worktree, confirmed it is NOT in the committed PR diff and flagged it for cleanup; (4) sibling sites cited above (single entry point, no cross-file or intra-file siblings); (5) checked Non-Goals — nosemveradded, no bypass env var, no per-command guards, no npm/git/gh version checks; implementation stays within scope.Status: Clean
Verdict: READY_FOR_MERGE
A+ implementation. All 6 ACs met and literally verified (flags/values traced, not assumed), CI green, pure logic fully unit-tested across the AC-5 boundary table, and the fail-fast path confirmed E2E. Clean reuse of
compareVersionswith zero new dependencies, scope held exactly to the (already overcomplexity-critiqued) design.Documentation
### Added, references feat(cli): runtime Node-version preflight guard (clear message instead of opaque crash below engines floor) #734)Next Steps
package-lock.jsonchange in the worktree before merge (git checkout package-lock.json).fix(cli): close Node-guard import-time window + add real Node 20 CI c…
feat(cli): runtime Node-version preflight guard (#734) (#736)