Skip to content

chore(openspec): upgrade to OpenSpec 2.1.1 with a strict-warning baseline - #245

Merged
Artexis10 merged 4 commits into
mainfrom
chore/openspec-2-1-1
Nov 22, 2026
Merged

Artexis10 merged 4 commits into
mainfrom
chore/openspec-2-1-1

Conversation

@Artexis10

@Artexis10 Artexis10 commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Pins @fission-ai/openspec at exactly 2.1.1 (was ^1.14.0).
  • OpenSpec 1.14.1 made any requirement over 500 characters a warning, and validate --strict fails on warnings. 1.14.0: 99/99 pass; 2.1.1: 67 warnings, 0 errors.
  • npm run openspec:validate, which the lefthook pre-push hook runs through scripts/openspec_validate.ps1, now runs scripts/openspec_strict_gate.mjs. It keeps --strict, but tolerates the warnings in openspec/strict-baseline.json (67 keys, all overlong requirements). New or longer requirements and any other new warning fail.
  • The 12 /opsx: commands are removed (OpenSpec 2.0 dropped them). The OpenSpec skills are committed as real files in .agents/skills and .claude/skills. On Linux 2.x writes .claude/skills as symlinks, and Windows checkouts with core.symlinks=false would get text files instead, so the gate rejects tracked symlinks there.
  • Docs: /opsx: references replaced with skill names.
  • Callers run the pinned CLI as node node_modules/@fission-ai/openspec/bin/openspec.js and the gate spawns it with the running Node, so validation works on native Windows (npx shims can't be spawned without a shell there). The gate exits 2 on a missing report, an empty report, or a failed run with no issues, and names the Node 22.20 floor.

Test plan

  • Gate check: OK, 67 warnings, all baselined (also ran in pre-push)
  • diff -r of the 12 skill pairs: identical; no mode-120000 entries

…line

OpenSpec 1.14.1 made a requirement longer than 500 characters a warning,
which `validate --strict` fails; 67 existing warnings would block every
push. `npm run openspec:validate` now runs scripts/openspec_strict_gate.mjs,
which keeps --strict but tolerates the warnings recorded in
openspec/strict-baseline.json, so new or longer requirements and any other
new warning still fail.

OpenSpec 2.0 removed the /opsx: commands. On Linux, 2.x links
.claude/skills into .agents/skills, and Windows checkouts with
core.symlinks=false cannot follow the links, so the skills are committed as
real files and the gate rejects tracked symlinks there.
The gate named an overlong requirement by counting every
'### Requirement:' line in the spec, while the validator counts only the
headers directly under '## Requirements', outside fenced code. A fenced
example would have shifted the names and let a new overlong requirement
borrow a baselined key. A missing git binary now fails instead of skipping
the symlink check.
OpenSpec 2.1.1 requires Node 22.20 or newer. The gate now says so, with the
version it found and the one-off hook bypass, instead of failing inside
npx.
@Artexis10

Copy link
Copy Markdown
Collaborator Author

Automated review: REQUEST_CHANGES
Patch: 486d92b295a45ff677145227717116940153c0b1
Head: a6844fb
Base: 7a18da3
Reviewer: devin, swe-2-max
Blocking by round: 2
Net call: ship smaller
Worker: 92dac8aca751433aa653892f77da052d
Pass: b5c1bda3c58a2a87

I'm the reviewer lane for the OpenSpec 2.1.1 upgrade. Let me start by looking at the actual diff and the key files.The opsx commands exist on origin/main but not on HEAD — yet --diff-filter=D showed nothing. Let me check the merge-base.Skills pairs are byte-identical. Let me check the repo-owned skill and the .agents diff status, then look at the remaining wiring.Gate passes on this tree (67 warnings, all baselined, exit 0). Now a key concern: this is a Windows-first repo and the npm script routes through npx. Let me verify what Node on Windows does when spawnSync resolves npx → npx.cmd (post-CVE-2024-27980, Node blocks batch-file spawn without shell: true).spawnSync('npx') on Windows fails with ENOENT/EINVAL — that's the post-CVE mitigation, confirmed by Node docs and issue reports. Since this repo's openspec:validate routes through npx, the gate exits 2 on every Windows run → the pre-push hook is permanently red on the repo's primary platform. I'll verify the rest before finalizing.

Let me inspect the validator's JSON output and warning provenance.The gate ignores validate's exit status entirely — if OpenSpec prints a parseable {"items":[]} on an error path, it could pass. Let me probe that edge plus the scratch-copy new-debt test.openspec validate --json on a missing root prints {"status":[...]} (no items) and exits 1 — and the gate ignores both the exit code and the shape, so report.items ?? [] → zero warnings → it would print OK and exit 0. Let me see which conditions emit that status shape.Malformed specs become ERROR issues — safe. But the {"status"} path (no root / command error) bypasses the gate. Let me prove the false pass through the gate itself.False pass confirmed: no root → validate exits 1 with {"status":[...]}, gate prints OK exit 0. Let me check one more trigger — an unreadable spec file — then run the new-debt experiment.EACCES lands as an ERROR item — closed. Now the acceptance experiment: new overlong ADDED requirement in a change must exit 1.All spec items are dir specs — the lookup path holds. Now the insertion test.My probe text was under 500 chars — not a real test. Retry with a longer one.Correct — exit 1 with the right key. Now the false-fail probes: restore the spec, tick tasks, and try archiving a baselined change.Archive carried the four too-long keys correctly — the failure is a legitimately new placeholder-Purpose warning (the auto-generated ## Purpose archive writes). That's a true positive, not a gate bug. Let me check the runbook and quality.yml wiring, then wrap up the remaining probes.Sibling upgrade worktrees exist — the contract says the gate is byte-identical across exomem, q, endstate, endstate-gui and substrate. Let me verify that directly.Gate is byte-identical across all four named sibling repos. Now quick robustness probes: bad command, --write-baseline after --, and a repo-wide search for validation paths bypassing the gate.All live validation paths route through the gate; the other hits are skill text and archived change docs. Two last probes: --write-baseline after --, and the Node-floor message already covered.Fails closed by accident — openspec rejects the unknown flag. Latent wart: --write-baseline after -- still flips mode. Now verify --write-baseline refuses when ERRORs exist.--write-baseline refuses on ERRORs and regenerates correctly. Let me verify the real npm script path works here, and check the openspec bin entry for a portable alternative.I have everything needed. Writing up the review.


Automated review

Risk lens: no

Scope reviewed: origin/main...HEAD on chore/openspec-2-1-1 (3 commits): scripts/openspec_strict_gate.mjs (new), openspec/strict-baseline.json (new), package.json pin/wiring, .agents/skills + .claude/skills OpenSpec 2.x content, .claude/commands/opsx/* deletions, .github/quality.yml, docs /opsx: rewrites, CLAUDE.md.

I ran the gate on the tree (OK: 67 warning(s) all baselined, 0 errors, no tracked skill symlinks (openspec 2.1.1), exit 0), compared specRequirementNames line-by-line against OpenSpec 2.1.1's MarkdownParser/code-fence/requirement-blocks in /tmp/os211, and ran scratch copies for the defect probes below.

1. Defects

D1 — blocking, high — package.json ("openspec:validate" script): the gated command npx --no-install openspec cannot spawn on Windows, so the gate exits 2 on every run there. The contract is "moves to 2.1.1 without turning its strict validation permanently red", on a Windows-first repo whose only enforcement path is the lefthook pre-push hook (pwsh → openspec_validate.ps1 → npm run openspec:validate). The gate does spawnSync(cmd[0], ...) with no shell. Since CVE-2024-27980 (Node 18.20.2+/20.12.2+), Windows Node refuses .cmd without shell:true (EINVAL), and bare npx resolves to the extensionless shell script → ENOENT (reproduced empirically on Node 24.12/Win11, github/copilot-cli#3576: spawn('npx')→ENOENT, spawn('npx.cmd')→EINVAL). Either way runOpenspec hits r.error → fail2 → exit 2 → every Windows push needs OPENSPEC_BYPASS=1 — permanently red on the platform this hook exists for. It only works where Node is installed through a shim that ships npx.exe (e.g. Volta). Reproduction: on a stock Windows Node install, npm run openspec:validate exits 2 with "failed to spawn version command". Fix (verified on this tree, node node_modules/@fission-ai/openspec/bin/openspec.js --version → 2.1.1): "openspec:validate": "node scripts/openspec_strict_gate.mjs -- node node_modules/@fission-ai/openspec/bin/openspec.js" — node.exe is spawnable everywhere and it also removes the npx indirection the runbook claims doesn't exist (see notes).

D2 — blocking, medium — scripts/openspec_strict_gate.mjs:68-74: the gate ignores r.status and never checks report.items exists, so an openspec command-level failure passes the gate green. When validate fails before producing a report, cli/index.js:32 prints {"status":[{severity:"error",code:...}]} to stdout — parseable JSON with no items. report.items ?? [] then yields zero warnings and zero errors → "OK: 0 warning(s) all baselined" → exit 0, while nothing was validated. Reproduced: scratch dir containing scripts/ + openspec/strict-baseline.json but no OpenSpec root → validate exits 1 with the status envelope, gate prints OK and exits 0. The same hole swallows any validate crash (the status envelope exists precisely for command errors) on a real tree — the strict gate would green-light a run in which strict never executed. Fix is two lines: if (r.status !== 0 || !Array.isArray(report.items)) fail2(...). Note the file is byte-identical across five repos by hand (verified identical via cmp against exomem-openspec-211, q-openspec-211, endstate-gui-openspec-211, substrate-openspec-211) — a fix must be replicated to each copy.

Non-blocking observations:

  • argv.includes('--write-baseline') (line 47) scans args after --. Today it fails closed only because openspec rejects the unknown flag; a wrapped command that tolerated --write-baseline would rewrite the baseline instead of checking. Parse the flag from argv.slice(0, sep) only.
  • git ls-files non-zero status silently skips the symlink leg (line 184-191, "outside a git repo -> skip silently"). Inside a repo where git errors (safe.directory, index lock), the check quietly does nothing. git rev-parse --is-inside-work-tree first, or exit 2 on non-zero inside a work tree, would close it. Low severity.
  • 67 warnings → 66 keys: one key covers two warnings (same capability + requirement name). Inherent to name-keying; if a third same-named overlong requirement appears in that capability it would also share the key and pass. Acceptable by design, worth knowing.
  • Verified true positive, not a bug: openspec archive add-profile-inspection -y in scratch carried all four too-long profile-inspection :: * keys to the new spec (name-keying survives archive exactly as designed) but the gate failed on a new placeholder-Purpose warning the archive-generated spec emits. Correct behavior — an archiver must write a real ## Purpose — but the runbook should say so.
  • docs/runbooks/OPENSPEC_ENFORCEMENT.md:31 still says "No npx: OpenSpec is a pinned devDependency; no global installs or npx required" — now literally false and the source of D1. The runbook also documents neither the baseline/gate nor the Node ≥ 22.20.0 floor. package.json has no engines field (optional; the gate names the floor at runtime as required).

2. Inventory

  • Changed/new functions with copies elsewhere: the gate is new, single in-repo copy; verified byte-identical (cmp) to the four other checkouts the contract names — 1 checked, found via sibling worktrees. specRequirementNames mirrors MarkdownParser.parseSections/buildCodeFenceMask/stripClosingSequence/normalizeRequirementName — checked line-by-line against the 2.1.1 dist files: identical semantics including fence info-string rules, BOM, CRLF, ≥ stack-pop, and "any ### child of Requirements" indexing.
  • New writeable values: strict-baseline.json keys — written only via --write-baseline, which refuses while ERRORs exist (verified: exit refusal listing the error). Post--- flag wart noted above.
  • New links between records: .openspec-target (claude own-files) is a legitimate 2.x managed marker (matches shared-skill-target.js format and the released-generated-fingerprints list). Baseline keys ↔ requirement names: lookup verified against parser and by insertion test.
  • Claims: "66 keys over 67 warnings" — verified by running the gate (67 warnings, 66 unique keys; the duplicate is a spec/delta name collision, expected). "Gate check passes" — verified, exit 0.
  • Unchanged behaviors: openspec:validate:ci and the lefthook hook still reach strict validation through the same chain (ps1 → npm → gate); version-format hook untouched; no CI job runs or was added for OpenSpec (workflows contain no openspec reference — consistent with repo notes).
  • Old paths replaced/orphaned: .claude/commands/opsx/*.md — 12 files deleted (D in name-status); grep for opsx: across the repo finds zero live references (docs rewritten to skill names). No orphaned tests.
  • New tests: none added — the gate is self-verifying against real validator output; quality.yml classifies it under scripts alongside openspec_validate.ps1. Acceptable.
  • Private/confidential records: diff scanned — none; baseline contains only requirement names from committed specs.
  • Guard probes: the "guard" here is a validation gate, not a command-text hook — probes above cover its real entry point (spawn failures exit 2, usage exit 2, JSON-parse failure exit 2 — all verified by execution; the one input that slips is D2's status envelope).
  • Added row not in the template: hand-maintained cross-repo copies — verified identical today; nothing mechanical keeps them in step beyond the contract's "maintained by hand" decision, which the packet records as the operator's choice. Any fix to D2 must land in all five copies.

3. Design verdict

  • Delivers the named outcome on Linux: exact pin 2.1.1, every validation path through the gate, tolerated debt baselined by name (which survives archive — the elegant part), new debt fails with a precise key, symlinks rejected, Node floor named before spawn. Does not yet deliver on Windows (D1) — the repo's primary platform.
  • Simplest shape: yes — keying too-long <capability> :: <name> converges delta and spec warnings so archive needs no baseline churn. The parser mirror is the only available name source (validator emits no names for spec warnings) and is faithful.
  • Duplication: the gate exists in 5 repos by hand — the operator's recorded choice; verified identical. The one real unmoored copy is the parser-mirror logic vs the vendored parser, pinned at exactly 2.1.1 — acceptable while the pin holds.
  • No scale/performance concerns — a single validate call plus one git ls-files.

Net call: ship smaller — two small fixes: point the npm script at node node_modules/@fission-ai/openspec/bin/openspec.js (D1, package.json only), and fail on r.status !== 0/!Array.isArray(report.items) (D2, replicated to the five gate copies).

4. Release readiness

No release beyond landing. Dev machines need Node ≥ 22.20.0 — the gate names the floor before spawning (verified in code order); OPENSPEC_BYPASS=1 remains the one-time escape. On Windows, D1 means the bypass is currently permanent, not one-time.

5. Security

Risk lens no: no auth surface, no untrusted input to renderer/export/query/shell. The gate spawns a fixed argv; the spawn itself is shell-free (which is what makes D1 bite).

A baseline key named only the capability and requirement, so a new change
that grew or re-added a baselined requirement matched the old key and
passed. Delta warnings now key by change, spec warnings by spec, and a spec
warning carries only from a change that has since been archived. The gate
also fails when validate returns no report, and callers run the pinned CLI
through Node instead of npx, which cannot be spawned without a shell on
Windows.
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Quality report

05132bf against base 7a18da3. Only the gate fails this check; the rest informs review. Why each check exists: PRACTICES.md.

Gate: passed

Dead code, lint findings and banned patterns on lines this pull request adds. Silence a false positive in .github/quality.yml, in the linter's own config, or for a banned pattern with a reasoned # nosemgrep: line.

Check Result
Unused files, exports and dependencies (knip) not configured
Unreachable Go functions (deadcode) passed
Unused imports and variables, undefined names, redefinitions (ruff F rules) not configured
Lint errors (the repository's ESLint and config) not configured
Go bugs, simplifications and style (staticcheck) passed
Shell script bugs (ShellCheck) no shell script changed
Banned patterns: word lists and word regexes, regex over SQL or markup (semgrep) not configured

Proof weight

Lines added and removed per path class, from git diff --numstat against the base.

Class Files Lines added Lines removed
scripts 1 308 0
tooling 2 3 2
specs 1 73 0
product 1 1 0
docs 27 486 390

Product +1 lines against proof +384 lines (tooling, specs, scripts).
A file that matches no class counts as product; lockfiles and other generated files, and docs, count as neither.
Proof that outweighs the product it covers needs a reason in review.

Measures on added lines

Check Result
New duplicate code, exact token clones (jscpd) none on added lines
Python definitions nothing references (vulture, confidence 60+) not configured

Test runtime

This run against the median of the last 5 successful main runs of this workflow on the same runner, from the GitHub Actions API.

Job This run Median on main Change
Go Tests 18m 07s 23m 18s (5 runs) -22%
Go Tests (macos-latest) 1m 53s 1m 44s (5 runs) +9%
Go Tests (ubuntu-latest) 1m 07s 1m 28s (5 runs) -24%
Integration Test (windows) 0m 39s 0m 48s (5 runs) -19%
Synthetic Shard 0 1m 24s 1m 21s (5 runs) +4%
Synthetic Shard 1 1m 30s 1m 14s (5 runs) +22%
Synthetic Shard 2 1m 05s 1m 13s (5 runs) -11%
Synthetic Shard 3 1m 09s 1m 29s (5 runs) -22%
Synthetic Shard 4 1m 09s 1m 26s (5 runs) -20%
Synthetic Shard 5 1m 08s 1m 11s (5 runs) -4%
Synthetic Shard 6 1m 07s 1m 19s (5 runs) -15%
Synthetic Shard 7 1m 20s 1m 21s (5 runs) -1%
Catalog Matrix 0m 24s 0m 20s (5 runs) +20%
Notepad++ Synthetic Engine Contract 0m 21s 0m 21s (5 runs) +0%

@Artexis10

Copy link
Copy Markdown
Collaborator Author

Automated review: APPROVE
Patch: fc9094138bf2f8b15e83827e5f8bbc6c615f4551
Head: 36f90f8
Base: 7a18da3
Reviewer: devin, swe-2-max
Blocking by round: 2, 0
Net call: ship smaller
Worker: 544c5ffd13364ae5be5b6836172e67ba
Pass: b5c1bda3c58a2a87

Rechecking the correction round. First, what changed since the head I reviewed (a6844fb).Both my findings are addressed: D1 via node node_modules/.../openspec.js + process.execPath mapping, D2 via the items-array and empty-report checks. Now the risky new surface is the key reformat + carry rule. Let me check the MODIFIED warning's exact trigger in the validator first.validate --archived is a separate surface — archived changes are likely excluded from --all by default. Let me verify empirically and re-run the carry probes.Probe text under 500 chars again — no warning emitted. Fixing.Carry refused while the change is active — exit 1, correct. Now probe 2: same-name ADDED from a different new change.Change-scoped keys correctly isolate debt per change — exit 1. Now probe 3: MODIFIED growth of a baselined spec requirement.Growth → new change-scoped key → exit 1 (the scenario ERRORs are my broken fixture, irrelevant). Now the same-length MODIFIED — should produce no too-long warning.Fixture bug explained (find('###') hit ####). The too-long behavior is proven both ways. Now the D2 regression probes and the real-tree gate.--write-baseline after -- no longer flips mode (baseline untouched), npm script green via the node path. One edge left to probe: whether openspec change ids can be nested (a/b), which would break the indexOf('/') cid parse in carriedKey.Nested change dirs produce an ERROR on the outer id — openspec refuses them, so the indexOf('/') cid parse is safe (change ids are flat). Re-verifying byte-identity across the four sibling gate copies and the real tree state.## Re-review — correction round

Risk lens: no

Reviewed a6844fb..HEAD (1 commit, 36f90f8): scripts/openspec_strict_gate.mjs, openspec/strict-baseline.json (regenerated, 67 keys: 27 change/ + 40 spec/), package.json script. The rest of the diff stands as previously reviewed (opsx deletions, byte-identical skill pairs, no tracked symlinks, exact 2.1.1 pin — all re-confirmed unchanged in this round).

Prior findings — recheck

D1 (Windows spawn, was blocking) — fixed. openspec:validate is now node scripts/openspec_strict_gate.mjs -- node node_modules/@fission-ai/openspec/bin/openspec.js; the gate maps cmd[0] === 'node' to process.execPath before spawn (openspec_strict_gate.mjs:55-58). Verified npm run openspec:validate → OK on this tree. On Windows this needs no shell, no .cmd resolution — node.exe is a real executable. This also makes the runbook's "No npx" line true again.

D2 (status-envelope false pass, was blocking) — fixed. Re-verified all three holes close: a {"status":[...]} envelope (no OpenSpec root) now exits 2 via the Array.isArray(report.items) check — reproduced; a non-zero validate exit with zero issues exits 2 (r.status !== 0 && warnings.length === 0 && errors.length === 0); and check mode refuses an empty items while the baseline holds keys — reproduced (exit 2). The earlier wart is also fixed: --write-baseline is now honored only before --; after -- it passes through to openspec, which rejects it (exit 2, baseline untouched — verified).

New surface — the change-scoped keys and carry rule, attacked

  • Carry refused while the change is active — verified. Added an overlong ### Requirement: capture --pin records installed versions to openspec/specs/windows-version-capture-pinning/spec.md while capture-pin is still active → too-long spec/windows-version-capture-pinning :: capture --pin records installed versions reported as a new warning, exit 1. The activeChangeIds check held.
  • Same-name ADDED from a different new change — verified. A probe-change delta adding the same-named overlong requirement for the same capability produced too-long change/probe-change/... — a distinct new key, exit 1. Change-scoping means one change's baseline can't launder another's debt.
  • MODIFIED growth of a baselined spec requirement — verified. A probe-mod change whose MODIFIED block lengthens Drift checks are scheduler-invoked, not resident produced too-long change/probe-mod/scheduled-drift-check :: ..., exit 1 — growth is correctly new debt. The validator only emits the MODIFIED warning when the new text exceeds both 500 chars and the current length (validator.js:680-682), so a same-or-shorter MODIFIED emits nothing (verified — no too-long warning).
  • Archive carry — verified end-to-end. Archived add-profile-inspection in scratch: the four too-long spec/profile-inspection :: * warnings carried via too-long change/add-profile-inspection/... (cid no longer in activeChangeIds — archived changes are excluded from --all items, verified), the gate printed the fold instruction, and still failed on the genuinely new placeholder-Purpose warning. Correct.
  • Capability-exact matching — verified by construction and code read. carriedKey compares /<cap> :: <name> byte-for-byte against /<spec-id> :: <name> after a single-segment cid split; prefix/case/nesting tricks don't match. Change ids are flat — openspec itself emits an ERROR for a nested changes/group/name (verified), so the indexOf('/') split can't misparse.
  • Direct answer to the attack prompt: a spec-level overlong requirement that was never part of a baselined change can borrow a carry only by colliding on (capability, requirement-name) with a baselined inactive change — the name-keying identity OpenSpec itself uses; same inherent limitation as before, no new hole.

Residual notes (non-blocking)

  • git ls-files non-zero still silently skips the symlink leg — fails open only when run inside a broken git repo; low.
  • Baseline comment text still says "shrink it or to carry a renamed requirement" — now also covers archived-change folds; wording slightly behind the mechanism.
  • Archiving a change that creates a capability fails the gate on the placeholder-Purpose warning until a real ## Purpose is written — correct, worth a runbook line alongside the missing gate/baseline/Node-floor docs.

Inventory deltas this round

Gate copy parity re-verified byte-identical (cmp) across exomem, q, endstate-gui, substrate worktrees — all five in step; the D2 fix and key format are already uniform. New-writeable inputs: unchanged. Claims: "67 warnings all baselined" re-verified on the real tree (exit 0); baseline holds 67 distinct keys (the previous 67→66 collision is now properly two namespaced keys). No private records, no new tests needed — gate is self-verifying.

Design verdict

Ship. The change-scoped keying removes the one real ambiguity of the previous scheme (delta vs spec debt sharing a key), the carry rule implements exactly the contract's semantics (inactive cid + exact capability + name), and the fail-closed gaps are closed. Byte-identical hand-maintained copies are the operator's recorded choice and verified in step.

@Artexis10
Artexis10 merged commit 31d34fd into main Nov 22, 2026
17 checks passed
@Artexis10
Artexis10 deleted the chore/openspec-2-1-1 branch November 22, 2026 21:01
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.

1 participant