Repository navigation
fix(lint)!: refuse an action body whose regular-expression literal never closes or carries a bad flag set - #35672
Conversation
…ver closes or carries a bad flag set action-body-does-not-compile sent every host SyntaxError opening "Invalid regular expression" to warning. V8's two token errors (an unterminated literal, "missing /", and an invalid flag set) open the same way, and QuickJS refuses both, so such a body was accepted at write and failed every run. Only the pattern-body shape stays a warning. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgTggz8AL2bCABoDGis
|
repo:objectstack#1 · os-sales · session_01L6bhgTggz8AL2bCABoDGis
Generated by Claude Code |
📓 Docs Drift CheckThis PR changes 2 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 174 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 11ff6df082c1f4da3794f0b9a88122bb3dd1b5d8 && git checkout 11ff6df082c1f4da3794f0b9a88122bb3dd1b5d8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d9801038abf9b0e09b334bcc35a11de1e438eb50 bf5fc6514f08e388b31e13b9b54f3fae12d102cd && git checkout -B drift-repro d9801038abf9b0e09b334bcc35a11de1e438eb50 && git merge --no-ff bf5fc6514f08e388b31e13b9b54f3fae12d102cd
node scripts/docs-audit/affected-docs.mjs --json d9801038abf9b0e09b334bcc35a11de1e438eb50
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTggz8AL2bCABoDGis Contract-review-claim: session_01L6bhgTggz8AL2bCABoDGis · head bf5fc65 · 2026-11-19T23:04Z Generated by Claude Code |
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTggz8AL2bCABoDGis Contract review brief — PR #35672 @
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTggz8AL2bCABoDGis Contract reviewServed-tier: Inputs read, and nothing else: card #35040 (body and its one comment, the claim 7001374222); PR #35672 (body, its eight-file list, the net diff against Check-runs on this head: 60 ① Derived judgments
② Semver level
③ Boundary flagsDev report 7024071886, its deviations in order:
Acceptance note 2 — a second pattern disagreement, modifier groups. Stated consistently in the docblock, the rule explanation, the docs page and the new entry. It is true of Node 22's V8 only; see N1 and N2. Acceptance note 3 — branch name. The claim 7001374222 names Acceptance note 4 is deviation 1. Open question, posed as a question: is amending the prose of the 18.6.0-released entry in place acceptable, or should it stay byte-identical with only the new entry carrying the change? Amending is acceptable, and here it is the better choice. From the tree, not from anyone's account:
SQL push-down: the diff holds no query, no id materialisation and no join. Nothing to find. Author: ④ Design judgment
I found no body the rule now refuses that the runtime runs.
No must-fix, no should-fix.
Disposition: all four sit in files outside the prose faces, so a fix moves the head and this record no longer covers it. N3 is an accepted deviation. N1, N2 and N4 go on the PR's review follow-ups card, apart from the defect card escalated in ③. Implemented-by: VERDICT: PASS Generated by Claude Code |
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob L2 adoption · 2026-11-19T23:25Z · The seat adopts the #35040 card thread's isolated record 7025076166 for head The record also judges the question L1 named: editing the released 18.6.0 entry's prose in place is fine, on the precedent of four protocol-17 entries corrected the same way. N3 is accepted. The reproducible gap the record names (six pattern-error classes QuickJS also rejects still take the warning arm) gets its own card under the filing gate, and N1, N2 and N4 ride that card. The thread files it before landing. |
|
repo:objectstack#1 · os-sales · session_01L6bhgTggz8AL2bCABoDGis Landing · 2026-11-19T23:29Z · head
State change: draft → ready, auto-merge armed (squash). Follow-up gap and nits N1/N2/N4 → #35694 (filed before landing). The #35040 card closes on merge through Generated by Claude Code |
Requested by Sales · project thread
repo:objectstack#1 · os-sales · session_01L6bhgTggz8AL2bCABoDGis
Fixes #35040
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — no published skill teaches the action-body compile check or regular-expression literals in an action body (
git grepoverskills/at df02e1c: 0 hits fordoes-not-compile, 0 relevant hits for regular expressions)维护者速读
/abc、非法 flag 如/a/gg)现在在保存/校验时直接报错拒收,而不是只给警告。packages/lint/src/validate-action-body-compiles.ts(REGEXP_PATTERN_FAILURE一行决定警告/拒收分界)、同目录测试文件末尾新 describe、packages/spec/src/migrations/entries/semantic/18.action-body-regexp-literal-token-refused.ts。pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-action-body-compiles.test.ts,预期 25 个用例全绿。What changes
action-body-does-not-compilesent every hostSyntaxErrorwhose sentence opensInvalid regular expressiontowarning. V8's two token errors open the same way: an unterminated literal (Invalid regular expression: missing /) and an invalid flag set (Invalid regular expression flags). QuickJS refuses both, so a body carrying one was accepted at write and failed every run with the coded 500.packages/lint/src/validate-action-body-compiles.ts: the warning arm is now positively identified by V8's pattern-body shape only (Invalid regular expression: /PATTERN/FLAGS: REASON, anchored on the colon-space-slash). Every other sentence — the two token errors included, and any future one — iserror. The two token errors get their own hint (close the literal / escape a slash / give a division its left operand; flags fromdgimsuvy, each once, neveruwithv). The module docblock and theseverityfield doc now state the measured split.packages/lint/src/rule-explanations.ts,packages/lint/src/authoring-rules.ts(comment),content/docs/automation/hook-bodies.mdx: the "a regular-expression literal the host refuses is a warning" sentence would be false after this change; each now says only a pattern is a warning.packages/spec/src/migrations/entries/semantic/18.action-body-regexp-literal-token-refused.ts: new ADR-0087 semantic entry for the narrowing.packages/spec/src/migrations/entries/semantic/18.action-body-does-not-compile-refused.ts: amended, two phrases. The entry shipped in 18.6.0 (content/docs/releases/v18/18-6.mdxrow andpackages/spec/CHANGELOG.md), but the registry is whatos migrate metaand the upgrade guide project at HEAD; left as it was, an upgrader reading 18.7 would get "never refused" beside the new entry's "refused". The amendment keeps the 18.6 meaning for patterns and points to the new entry for tokens. The released CHANGELOG and release page are untouched..changeset/35040-action-body-regexp-literal-token-refused.md:@objectstack/lintminor,@objectstack/specminor, both declaration lines,registered action-body-regexp-literal-token-refused.Sibling #34987 (hook and job bodies, same file) is out of scope and untouched.
QuickJS probe (the measurement the split follows)
Host: node 22.23.5, V8 12.4.254.21-node.57,
vm.Script. Runtime:quickjs-emscripten0.32.0 (newQuickJSWASMModule, release-sync variant — the onepackages/runtime/src/sandbox/quickjs-runner.tsuses),evalCodeof the same wrapper(async (input, ctx) => { SOURCE }), which compiles and does not call.return /abc;Invalid regular expression: missing /unexpected end of regexpreturn /[/;missing /unexpected end of regexpreturn /abcmissing /unexpected end of regexpreturn /abc+ backslashmissing /unexpected end of regexpreturn /abNLc/;missing /unexpected line terminator in regexpreturn /a/gg;Invalid regular expression flagsinvalid regular expression flagsreturn /a/zz;flagsreturn /a/q;flagsuwithvreturn /a/uv;flags/a/+ backslash-u0067flagsexpecting ';'vreturn /[a&&b]/v;d,gimsuy/a/d,/a/gimsuyreturn /(/;Unterminated groupexpecting ')'a)Duplicate capture group namereturn /(?i:a)/;Invalid groupreturn /a**/;return /[b-a]/;u)u)/\p{Nope}/uu)/a{/uabeforebconst input = 1invalid redefinition of parameter nameFlag sweep: 55 single characters (
a-z,A-Z,$,_,0) plus all 64 ordered pairs ofdgimsuvy= 119 flag sets, V8 and QuickJS agree on accept/refuse for 119/119; no flag set V8 refuses is accepted by QuickJS.Reading: the hypothesis holds. Both token classes are refused by QuickJS in every probed case, so they go to
error. The dialect gap lives in the pattern body — and it is two places, not the one the module docblock named: modifier groups are a second pattern V8 (Node 22) refuses and QuickJS runs. Pattern-body failures staywarning; some of them (unterminated group, nothing to repeat, …) are refused by QuickJS too, which this PR leaves at warning (see Acceptance notes).Tests
New top-level
describeinpackages/lint/src/validate-action-body-compiles.test.ts(the rule's existing harness file):[rule, severity, path]=['action-body-does-not-compile', 'error', 'actions[0].body.source'];error;warning;/a/dgimsuyand av-flag class compile clean;os validaterefusesreturn /abc;at error, and the runtime publish gate puts it inerrors, none inadvisories.Assertions are rule id + severity (+ path), no message or hint text pinned.
Results (head df02e1c)
pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-action-body-compiles.test.ts— Test Files 1 passed (1), Tests 25 passed (25).pnpm --filter @objectstack/lint test— Test Files 220 passed (220), Tests 9288 passed / 5 skipped (9293);pnpm --filter @objectstack/lint typecheck— tsc clean,check:test-typecheck: OK.pnpm --filter @objectstack/spec build && check:generated— "All 14 generated artifacts are up to date";vitest run src/migrations— Test Files 5 passed (5), Tests 198 passed (198).pnpm --filter @objectstack/cli exec vitest run test/migrate-meta-engine-guidance.test.ts— 3 passed (3).pnpm --filter @objectstack/dogfood test— VERDICT command-exit 0, Test Files 482 passed / 3 skipped (485), Tests 4092 passed / 68 skipped (4160), no failures.validateActionBodyCompilesover every action exported byexamples/app-showcase/src/ui/actions/**(the only example tree carryinglanguage: 'js'action bodies) — 0 findings.Ablation (one-shot; no permanent file)
Committed the fix first, then
node scripts/ablation-replace.mjsrestored the old classifier (REGEXP_PATTERN_FAILUREback to the unanchored^SyntaxError: Invalid regular expression) — anchor 1 → 0, blob bae57fbc → 1fb048a7. The test file went red: 8 failed / 17 passed (25) — exactly the four unterminated, three flag and one door pins; the two warning-preservation pins stayed green as they should. Restore: blob after restore = HEAD blob bae57fbc,git diff HEADempty. The test imports the rule fromsrc/(relative import), so nodist/leg applies.Acceptance notes
warning— the card's Done-when covers the token classes only. Promoting them means an allow-list of V8 pattern reasons, which a future V8 can widen under us; left as a note, not filed. carrier: none.claude/project-thread-iswnar, notclaude/issue-35040-…— platform exception: this card thread can push only its assigned branch (claim comment 7001374222).Clause-②: nowith no arm; this PR and the changeset declareClause-②: no (narrowing), because the level gate refusesMetadata-protocol: narrowedbeside a line with no(narrowing)arm (scripts/check-changeset-no-major.mjs) and the change does narrow the accepted set. The title carries!for the same reason: AGENTS.md names a(narrowing)arm BREAKING.Verification
Local subset:
node scripts/pm/dispatch-gates.mjs --commands(no paths; change set from merge base 3819afe, tree df02e1c) derived 115 families; all 115 run, reconciled with--ran: "115 derived famil(ies) accounted for — 115 run, 0 NOT-MEASURED".overlap-check.mjsbefore each push:VERDICT clean exit 0. Every CI family is read from this PR's check-runs, not re-run locally.Gate readings
All 115 derived commands exited 0. Five first exited 3/1 as unmet prerequisites (nothing measured), and passed on a re-run after the prerequisite was met:
node scripts/check-plugin-teardown-shape.mjs --self-test— exit 3 on the shallow clone (pinned positive-control commit unreachable); after fetching that one commit into a private ref, exit 0, 48 cases.pnpm --filter @objectstack/cli exec vitest run test/migrate-meta-engine-guidance.test.ts— exit 1 at oclif manifest load (cli not built); after@objectstack/cli...build, exit 0, 3/3.pnpm --filter @objectstack/spec run check:skill-examples— exit 3 (client-react dist missing); after build, exit 0, "345 prose examples type-check".pnpm check:dual-build-cjs-loads— exit 3 (dists missing); after the full packages build, exit 0.pnpm check:type-check-debt— exit 3 (lock queue timeout while the dogfood run held it); run under the lock, exit 0, "0 raw tsc error(s) total, none above its recorded number".Local-only family
check:dev-prereqs(not derived): exit 1, "35 of 108 workspace packages declare an entry point under dist/ that is not on disk" — all underui/, which this box never built; a reading of this container, not of the diff.Main merge before opening (head bf5fc65, origin/main e91d967): merged cleanly; main changed one file in this diff's set (
packages/lint/src/rule-explanations.ts, no conflict). Re-run only what it touches, after rebuilding spec dist:vitest run src/validate-action-body-compiles.test.ts25/25;pnpm --filter @objectstack/lint test221 files / 9322 tests passed; linttsc --noEmitexit 0; specvitest run src/migrations5/5 files, 198/198; speccheck:generated"All 14 generated artifacts are up to date" (first attempt hit the default heap; re-run with--max-old-space-size=8192).overlap-check.mjs: VERDICT clean exit 0, 0 PR heads. The dogfood battery and the 115-family run above are on df02e1c and were not repeated.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgTggz8AL2bCABoDGis