Repository navigation
fix(core): match one sed character for . and bracket expressions - #15701
Conversation
The simulated sed path compiled patterns without the s and u flags, so `.` did not match `\r` in CRLF files and astral characters were matched as two UTF-16 code units, leaving a lone surrogate that was written as U+FFFD. Compile with su/gsu and escape a literal ] outside bracket expressions so the stricter u mode still accepts patterns such as [\[\]]. Closes QwenLM#15675
|
Verdict: merge-ready — 77/77 scripted assertions passed at head 中文摘要
Central claimThe simulated The oracle here is not hand-written expectations — it is the real A/B result
The cells are byte comparisons, not visual checks. Examples from the run (base → real
Both arms were bundled separately from their own worktree; the base bundle contains no Mutation matrix
The new test is not vacuous: reverting the whole apply-side change (M2) turns it red with the assertion it was written for, and each half of the bundled Survivors were adjudicated by building the mutant, not by reading it:
FindingsS1 — a zero-width global match over an astral character follows BSD, not GNU. S2 — nothing pins the gate's flags to the substitution's flags (M1). A one-line test would close it: S3 — the Observation (not a finding): head declines two patterns base simulated — CorrectionsNone. There was no earlier verification round or bot review on this PR describing the code, so there is nothing to correct; the two author claims I tested (the Not covered
MethodologyTwo detached worktrees, one at |
|
@qwen-code /triage |
|
Head is |
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
Not explored to full depth (tool budget reached): "agent 6b": packages/core/src/tools/shell.test.ts sed-integration tests were not run — the file needs packages/core/dist/index.js , and this worktree is unbuilt; the uni…; "agent 6c": did not run the full packages/core suite (only the parser file plus targeted greps of shell.test.ts ), and did not run the mutation experiment by deleting th….
Test Plan (not a blocker): tests: 52 passed — this review observed 18646, 2035, 38776, 2278, 306, 13338 passed.
中文说明
未探索到全部深度(达到工具调用预算):"agent 6b":packages/core/src/tools/shell.test.ts sed-integration tests were not run — the file needs packages/core/dist/index.js , and this worktree is unbuilt; the uni…;"agent 6c":did not run the full packages/core suite (only the parser file plus targeted greps of shell.test.ts ), and did not run the mutation experiment by deleting th…。
Test Plan(非阻断):tests: 52 passed — this review observed 18646, 2035, 38776, 2278, 306, 13338 passed。
— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.2)
|
Verdict: blocked — 289/297 scripted assertions passed at head 中文摘要
Follow-up round: previous-finding statusRound 1 (2026-10-27, head Correction to round 1 (my own earlier report): its merge-ready verdict is superseded. The r1 corpus (59 cells, groups A–E) did not include the u-only acceptance class — patterns that compile under
Central claim + A/BThe simulated
"Wrong" counts a cell against both oracles unless the cell is marked as deliberately following one (B5 follows BSD; A6/D4/D12–D14 follow GNU — all pre-existing choices, identical in both arms). Of the 5 head-wrong cells, F1/F2/F3/F8 are the PR regression and F5 is pre-existing (both arms wrong). All six issue rows flip base-wrong → head-match on both oracles. The corpus is a reconstruction: r1's harness no longer exists locally, so groups A–E were rebuilt from r1's group descriptions, the issue's six rows verbatim, and existing-test shapes (r1's A/B counts 5/6 and 8/10 reproduce exactly; E is 4/4 here vs r1's 3/4 because this round's fourth spelling is R1-1 regression (Critical, blocking)Under Measured bytes (input
Against BSD (the issue's own platform) every row is a clean match→wrong regression. Against GNU, F1 was already wrong at base (base simulated a pattern GNU rejects — pre-existing), and head changes the wrong bytes to a worse shape. BRE is safe: the translator emits Blast radius: every Reproduce: The proposed fix is measured, not eyeballed. Widening the guard to
The fix should ship with those assertions; the author's promised commit has not landed at this head. Mutation matrix12 rows, head's 52-test suite via JSON reporter, fresh scratch copy per row, every anchor asserted unique, kills attributed to named failing tests. Runner positive control: C1 (replaceAll forced false) kills with 15 failures; unmutated baseline 52/52.
The new test is not vacuous: transplanted onto base source it fails exactly once, on its first astral assertion ( Trial merge and sibling PRs
Findings
Not covered
MethodologyLocal maintainer round on macOS (Node v22.23.1, GNU sed 4.10 at Verification round 2 by @wenshao's local |
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
Test Plan (not a blocker): tests: 52 passed — this review observed 19060, 2067, 39336, 2340, 306, 13620 passed.
Deferred under the convergence posture (round 2, not a blocker) — recorded, not requested in this round:
packages/core/src/utils/sedEditParser.test.ts:264 (+1 locations) — [review] the new s/x*/-/g assertion pins a result GNU sed does not produce for zero-width global matches over an astral character
中文说明
Test Plan(非阻断):tests: 52 passed — this review observed 19060, 2067, 39336, 2340, 306, 13620 passed。
收敛姿态下延后(第 2 轮,非阻断)——已记录,本轮不要求修改:共 1 条(原文未翻译,列表见上方英文部分)。
— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.3)
|
Two Criticals at R1-1 (still standing). Confirmed on R1-2. Taking the decline assertions as written, R2-1 (new, accepted). Confirmed at Both fixes and their assertions go in one commit on top of |
`\p{…}`, `\P{…}` and `\u{…}` are literals to sed but Unicode property and
code-point escapes to a `u`-flagged regex, so the simulator accepted patterns
real sed rejects or leaves alone and wrote the simulated bytes to disk. Widen
the divergent-escape guard and pin the declines, plus the `u`-only rejection
class the flag introduced.
On a CRLF file, `s/.$//` consumes the trailing carriage return, but the write path restores CRLF, so the edit reported success while the bytes on disk were unchanged. Compare the prepared write content against the original instead of the parser's intermediate string.
Head branch was pushed to by a user without write access
|
All three are fixed. R1-1 — R1-2 — same commit. Added R2-1 — Evidence: |
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
Not explored to full depth (tool budget reached): "agent 6c": I did not run the two touched test files ( npx vitest run for shell.test.ts / sedEditParser.test.ts ), so the new assertions are reviewed by inspection only…; "agent 3a": none — no check was cut short..
Convergence: round 3 posted 4 inline comment(s), 4 of them reported for the first time; the previous round posted 3 (1 new). Findings keep coming back to the same files: packages/core/src/utils/sedEditParser.ts (findings in rounds 1, 2; 1 more now). The rate of new findings is not falling. A cluster that keeps producing siblings usually means the fixes are treating instances of a shared root cause — triaging that cause before the next round, or splitting an independent cluster into its own pull request, tends to end the loop faster than fixing them one at a time. Batching the remaining fixes and verifying them before the next push, or dropping this PR's reviews to --severity-floor critical, keeps the loop from re-deriving the same set. (Observation only — nothing was withheld from this review because of this observation.)
中文说明
未探索到全部深度(达到工具调用预算):"agent 6c":I did not run the two touched test files ( npx vitest run for shell.test.ts / sedEditParser.test.ts ), so the new assertions are reviewed by inspection only…;"agent 3a":none — no check was cut short.。
收敛情况:第 3 轮发布了 4 条行内评论,其中 4 条是首次提出;上一轮发布了 3 条(其中 1 条首次提出)。发现反复回到同一批文件:packages/core/src/utils/sedEditParser.ts(第 1、2 轮已出过发现,本轮又有 1 条)。新发现的产出速度没有下降。一个不断再生兄弟发现的簇,通常意味着逐条修复只在处理同一根因的实例——先定位并处理该根因,或把独立的簇拆成单独的 PR,通常比逐条修复更快结束循环。把剩余修复攒成一批、验证后再推送,或将本 PR 的评审降到 --severity-floor critical,可以避免循环反复推导同一组发现。(仅为观察——本轮评审未因此扣留任何内容。)
— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.3)
|
Verdict: findings — 62/62 scripted assertions passed at head 中文摘要
Previous-finding statusRound 2 (2026-10-28, head
The bot's three corrected rulings (R1-1, R1-2, R2-1 "fixed by …") are accurate: each is confirmed by that fix's own witness going red when the fix is reverted. Central claim + A/BClaim unchanged: the simulated
Derived from those rows: head differs from base on four parser cells (A1, B1, F1, L1), all in the fixed direction; the shell matrix moves S2 into the fixed column and changes S7's report only. Mutation matrixRunner: the author's suites through a throwaway copy of the head tree, baseline green (53/53, 375/375) before any row, each anchor asserted unique, each revert replayed as that commit's production diff. The coverage claim is per-commit:
Both survivors were adjudicated by running their builds. Removing Correction to round 2 (my own earlier report)Round 2 said the widened guard left "0 of 59 non-F cells" with collateral damage, reasoning from FindingsR3-1 — Critical, blocking, reproduced. On a UTF-8-BOM CRLF file the read returns BOM-stripped R3-3 — Suggestion, reproduced in both directions. R3-2 — Suggestion, reproduced. The guard assumes R3-4 — Suggestion. Every positive-write assertion in the N-1 — note on the write path (pre-existing, not a regression of this PR). A CRLF→LF conversion simulated in-process never reaches the file: the write path restores CRLF ( Pre-existing, unchanged at every arm: B5 zero-width global over an astral character follows BSD (round 1's S1, still standing). Not covered
MethodologyLocal maintainer round: three arm sources exported with Verification round 3 by @wenshao's local |
The write-back prediction decoded the prepared bytes as UTF-8 and compared them with the read content, so a file carrying a BOM or a non-UTF-8 encoding never matched and the false `sed edit applied` this PR removes survived. Compare content strings instead, and only predict the CRLF normalization when the writer applies it: a client-side write stores the content verbatim, so `s/\r$//` is a real edit there and must not be suppressed.
`\0` is NUL to a `u`-flagged regex but a literal `0` to sed, so the simulator found no match and answered `sed edit made no changes` instead of falling back to the real binary.
|
Round 3 is addressed in two commits on top of R3-1 (Critical — BOM / non-UTF-8 made the comparison false). The guard no longer decodes the prepared bytes. It compares content strings against the content the read returned, and applies the CRLF normalization only when the active writer applies it, so a BOM or a non-UTF-8 encoding can no longer make an unchanged file look changed. R3-2 (a client-side write never restores CRLF). Added R3-3 ( R3-4 (only the skip branch was pinned).
Resolving the threads. @qwen-code /review |
|
Verdict: findings — 36/39 scripted assertions passed at head 中文摘要
Previous-finding statusRound 3 (2026-10-29, head
Central claim + A/BClaim unchanged: the simulated
The endpoint cells print in FindingsR4-1 — Critical, blocking, reproduced. Suggested fix: a capability flag says the client can write, not how it writes; the ACP service cannot distinguish a verbatim IDE from the in-repo daemon. Keep the conservative prediction (normalize) unless the writer proves verbatim — the r3 column of R4-2 — Suggestion, measured. R4-3 — Suggestion, measured. Dropping CorrectionsMy first control mutation ( Not covered
MethodologyLocal maintainer round, three detached worktrees at base / round-3 head / head; each arm runs the same probe file ( Verification round 4 by @wenshao's local |
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
Partially reviewed — gaps disclosed. Suggestions are inline.
Not reviewed: build-and-test — Test (windows-latest, Node 22.x) was skipped in CI and the suite did not run locally, so the Windows-only needsCrlfLineEndings (.bat/.cmd) disjunct of the no-op guard is unexecuted.
Test Plan (not a blocker): tests: 53 passed — this review observed 21509, 2093, 41039, 2366, 355, 14832 passed.
Convergence: round 4 posted 1 inline comment(s), 1 of them reported for the first time; the previous round posted 4 (4 new). Findings keep coming back to the same files: packages/core/src/utils/sedEditParser.ts (findings in round 3; 1 more now). A cluster that keeps producing siblings usually means the fixes are treating instances of a shared root cause — triaging that cause before the next round, or splitting an independent cluster into its own pull request, tends to end the loop faster than fixing them one at a time. No Critical finding is open on this round, so merging and moving the remaining Suggestion threads to a follow-up issue is available as an ending — a merged pull request cannot diverge further. (Observation only — nothing was withheld from this review because of this observation.)
中文说明
仅完成部分审查,审查缺口已披露。 建议见行内评论。
未审查(原文为英文):build-and-test — Test (windows-latest, Node 22.x) was skipped in CI and the suite did not run locally, so the Windows-only needsCrlfLineEndings (.bat/.cmd) disjunct of the no-op guard is unexecuted.
Test Plan(非阻断):tests: 53 passed — this review observed 21509, 2093, 41039, 2366, 355, 14832 passed。
收敛情况:第 4 轮发布了 1 条行内评论,其中 1 条是首次提出;上一轮发布了 4 条(其中 4 条首次提出)。发现反复回到同一批文件:packages/core/src/utils/sedEditParser.ts(第 3 轮已出过发现,本轮又有 1 条)。一个不断再生兄弟发现的簇,通常意味着逐条修复只在处理同一根因的实例——先定位并处理该根因,或把独立的簇拆成单独的 PR,通常比逐条修复更快结束循环。本轮没有未决的 Critical,因此"合入后把剩余 Suggestion 线程转到后续 issue"是一个可选的结束方式——已合入的 PR 不会继续发散。(仅为观察——本轮评审未因此扣留任何内容。)
— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.8)
| // equivalence class. Matching only the self-contained `[[:alpha:]]` form let | ||
| // negated and mixed expressions such as `[^[:space:]]` or `[[:alpha:]abc]` | ||
| // through, and the simulation then disagreed with sed on them. | ||
| return /\[[:.=]/u.test(pattern); |
There was a problem hiding this comment.
[Suggestion] R4-1: The widened POSIX-class guard also swallows plain bracket classes such as [.], [=] and [:], so those commands leave the simulated-edit path even though the translator handles them exactly like sed.
hasPosixBracketExpression now tests the raw pattern against /\[[:.=]/u, which matches any [ followed by :, . or =. A POSIX character class, collating symbol or equivalence class only opens inside a bracket expression ([[:alpha:]], [[.ch.]], [[=a=]]); a plain class whose first member is one of those characters is not one. sed -i 's/[.]/_/g' file.txt is a common literal-dot idiom and now parses to null, so the command runs as a real shell command: no diff preview, no prior-read gate, no undo snapshot — and on a host without a sed binary it fails outright where it previously worked.
Witness:
PR (63dc1eb9): [.] DECLINED [=] DECLINED [:] DECLINED [.]$ DECLINED [abc] ACCEPTED
BASE : all four accepted; s/[.]/X/g on "a.b" -> "aXb"
GNU sed : printf 'a.b\n' | sed 's/[.]/X/g' -> aXb
still declined on both: [^[:space:]] [[:alpha:]abc] [[=a=]] [a[:digit:]]
| return /\[[:.=]/u.test(pattern); | |
| function hasPosixBracketExpression(pattern: string): boolean { | |
| let inBracketExpression = false; | |
| for (let i = 0; i < pattern.length; i++) { | |
| const char = pattern[i]!; | |
| if (char === '\\') { | |
| i++; | |
| continue; | |
| } | |
| if (char === '[') { | |
| if (inBracketExpression && /[:.=]/u.test(pattern[i + 1] ?? '')) { | |
| return true; | |
| } | |
| inBracketExpression = true; | |
| continue; | |
| } | |
| if (char === ']') { | |
| inBracketExpression = false; | |
| } | |
| } | |
| return false; | |
| } |
The guard must keep declining [^[:space:]], [[:alpha:]abc], [[=a=]] and the nested [a[:digit:]] form (pinned at sedEditParser.test.ts:240-247), which a naive two-opening-bracket regex would miss — hence the bracket-state walk. Add expect(parseSedEditCommand("sed -i 's/[.]/X/g' f.txt")).not.toBeNull() plus an apply-level row such as expect(applySed("sed -i 's/[.]$//' f.txt", 'ab.\n')).toBe('ab\n'); both are red today, and removing the bracket-state guard must red them again.
中文说明
放宽后的 POSIX 字符类守卫把普通的方括号表达式也一起拒绝了,例如 [.]、[=]、[:]——翻译器其实能正确处理它们,与 sed 行为一致。
hasPosixBracketExpression 现在直接用 /[\[:.=]/u 匹配原始 pattern,只要出现 [ 后紧跟 :、. 或 = 就判为 POSIX 结构。但字符类、排序符号、等价类只在方括号表达式内部才会开启([[:alpha:]]、[[.ch.]]、[[=a=]]);首个成员恰好是这些字符的普通字符类并不是 POSIX 结构。sed -i 's/[.]/_/g' file.txt 是很常见的「字面点」写法,现在会解析为 null,改走真实 shell 命令:失去 diff 预览、失去先读校验、失去撤销快照;在没有 sed 的主机上,原本可用的命令现在直接失败。
建议按方括号状态判断(模块里 hasBracketCharacterEscape 已经用同样的走法):进入 [ 后,只有「已在方括号表达式内部」时遇到 [ 紧跟 :/./= 才拒绝。必须继续保持拒绝 [^[:space:]]、[[:alpha:]abc]、[[=a=]] 以及嵌套的 [a[:digit:]](sedEditParser.test.ts:240-247 已钉住),简单的双开括号正则会漏掉嵌套形式,所以要走括号状态。请补上 s/[.]/X/g 的 not.toBeNull() 断言和一条 apply 用例,它们在当前代码上是红的;去掉括号状态守卫后必须重新变红。
— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.8)
There was a problem hiding this comment.
Fixed in 3bb1a0d (rebased onto main as 104c467). hasPosixBracketExpression now walks the pattern and only reports a POSIX construct when [ is followed by :, . or = inside an already-open bracket expression, so [.], [=] and [:] keep the simulated path while [^[:space:]], [[:alpha:]abc], [[=a=]] and [a[:digit:]] stay declined.
Added s/[.]/X/g / s/[=]/X/g / s/[:]/X/g parse assertions and an apply-level s/[.]$// row. Verified: with the new guard removed the added case fails (1 failed / 53 passed); with it, src/utils/sedEditParser.test.ts is 54 passed.
2SinceJuly
left a comment
There was a problem hiding this comment.
Both notes were addressed in b8ccdda4, which landed after you wrote this.
-
hasPosixBracketExpressionnow tests/\[[:.=]/uover the raw pattern, so[^[:space:]],[[:alpha:]abc]and[[=a=]]all decline and fall through to the real sed. Your three witness cells are the cases that commit exists for. The blunt anywhere-match is deliberate and documented: it also declines[a[]], which would in fact translate correctly, because a false decline costs only the fast path. -
sedEditParser.test.tscovers the multibyte backreference next to thex*case, with the GNU/BSD comment naming both:s/\(.\)\1/X/gon😀😀xassertsXx, and the note says BSD compares bytes and leaves the file alone.
Nothing else changed on top of what you reviewed. Not run locally here: the full packages/core suite.
…6385) With experimental.unifiedAgentLoop on, the stream processor hands a shared round's tool batch to the round's submitQuery, which awaits it, its completion step and the round that step sends, once its own stream and activity ended. While another stream is active, which may be the stream that sent the round (a response of provider replays alone), the batch completes on its own as before. - The Ink executor takes a scheduler hold: the scheduler's completion callback returns once the completion step stopped the turn or is about to send the next round, as the current path holds it, up to the round whose calls need the scheduler. - A batch whose executed calls history all answered no longer sends its replay answers alone. The design doc describes PR 3b-2b.
* feat(serve): add atomic user Skill activation * test(serve): cover conditional user Skill activation capability * docs(serve): index user Skill activation endpoint * fix(serve): preserve User Skill refresh recovery
…#16422) * feat(skills): add file-backed archive installation kernel * feat(skills): expose native archive routes and receipts
* chore(release): v0.26.8 * chore(release): sdk-typescript v0.1.28 --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
Matching `[:`/`[.`/`[=` anywhere in the pattern rejected ordinary classes such as `[.]` -- a common literal-dot idiom that sed and the translator both handle. Only open a POSIX construct when the opening bracket sits inside a bracket expression, so `[^[:space:]]` and `[[=a=]]` stay declined while `s/[.]/X/g` keeps the simulated path.
|
Merged The only failing check was
|
|
Verdict: merge-ready — 58/58 scripted assertions passed at head 中文摘要
Previous-finding statusRound 5 (2026-10-31, head
Central claim + A/BClaim unchanged in shape, narrower in scope this round: the simulated Three arms, each bundled from its own Sweep: 1,110 generated bracket-expression cells; 66 were rejected by the real binary and skipped; 1,044 were adjudicated against both seds.
Named cells: the six rows of issue #15675 plus the bracket family and the leading- The round-6 delta
Endpoint input closure
The three CRLF no-op tests in Mutation matrixRunner: the author's two core suites (
FindingsF1 — Suggestion, new in this delta: an escaped
Reproduce: F2 — Suggestion, carried: the Windows F3 — Suggestion, carried and accepted: a verbatim ACP writer loses line-ending-only edits. Unchanged from round 5, and the closure above shows the behaviour is byte-identical. The skip is reported as "made no changes" — truthful about bytes, silent about the dropped request. Not covered
MethodologyLocal maintainer round on macOS (Node 24.18.1). Four parser arms — base Verification round 6 by @wenshao's local |
`s/\\[[:alpha:]]/X/g` is a literal `[` and an ordinary class to BSD sed, so the simulation rewrote the file. GNU sed rejects that pattern outright as a malformed bracket expression, so a simulated edit writes a change the user's own sed would have refused. The bracket scanner skipped the escaped `[` and so never saw the nested class. Decline the POSIX-shaped lookalike outside a bracket expression and leave a plain escaped `[`, and an escaped `[` inside a class, on the fast path they already had.
|
F1 fixed in F1 — an escaped The scanner now declines
Pinned by Verified at
Caveat you should weigh: this machine has no GNU sed ( Not run: the bracket sweep harness, the endpoint cells, and CI — this head's lanes were cancelled, as you noted. |
yiliang114
left a comment
There was a problem hiding this comment.
The changes correctly fix Unicode and CRLF handling in sed simulation by using su RegExp flags.
sedEditParser.ts:new RegExp(pattern, 'su')— thesflag makes.match\r(dotAll), andutreats characters as Unicode code points, resolving both astral-character corruption and CRLF line-matching failures.- POSIX bracket detection rewritten as a state machine that correctly handles negated, mixed, and equivalence-class forms while keeping plain
[.]-style classes on the fast path. - Divergent escape detection extended for
\p,\P,\u, and\0— all of which diverge between sed and JavaScriptu-mode regexes. toJavascriptPattern:]escaping scoped to outside-bracket positions only (required byu-flag strict mode).shell.ts: CRLF restoration prediction prevents false "edit applied" reports when the substitution's only effect is consumed by the write path.fileSystemService.ts: Export ofneedsCrlfLineEndingsfor the prediction logic.
Tests comprehensively cover astral characters, CRLF substitution, POSIX bracket edge cases, and the GNU/BSD backreference split. All patterns that cannot be safely simulated fall back to real sed.
No P0/P1 findings.
|
Closeout check on head The newest verification report is wenshao's 58/58 run at A verification pass bound to |
|
Closeout (b) isn't met for head This PR changes Also still open on the same file: the round-5 |
|
The head has not moved since your comment —
I am not going to post a On the round-5 |
…n-hook main advanced 11 commits (stacked-skill overflow #16404, workflow agent approvals #16432, daemon UI tool blocks #16306, sibling model settings #15829, late snapshot publication claim #16489, inline FQN imports in runtime modules #16504, cancelled shell as interrupted #15836, CSI statement helper fold #16503, Maven suite cache write-back #15274, sed char match #15701, Ink TUI tool-batch round #16428). One conflict, the workflow size ratchet: - .size-baseline: sdk-java.yml auto-merged to 167124 bytes (HEAD recorded 161927 / main 165241, both below the combined actual), so record the actual merged size 167124 per the ratchet's "record the real size in the same PR" rule. The absolute gate (470000) and the 4096-byte baseline allowance both pass. No source conflict: main's commits did not touch this branch's A3 source files, so RuntimeBrokerService / RuntimeExecutionRecovery (R18-1/R19-1 observe-only mount-handback guard) and the cli serve fence are unchanged. Verification: check-workflow-size.sh green (bash5); workflow meta tests (workflow-size + sdk-java-workflow + hosted-process-ci) 428 green; workspace build and ClassSizeRatchetTest re-run after the merge.
|
Released in v0.27.0. |













What this PR does
The shell tool's in-process sed simulation now compiles substitution patterns with the
sanduflags. This makes.match a carriage return and makes character classes and quantifiers operate on Unicode characters instead of UTF-16 code units. A literal]outside a bracket expression is escaped during translation so the stricter Unicode mode still accepts patterns such as[\[\]].Why it's needed
On CRLF files,
s/=.*$/=new/matched nothing and the tool reported that the edit made no changes. On files containing astral characters,s/^.//removed one half of an emoji and wrote the lone surrogate back as U+FFFD, silently corrupting the file. Real sed treats both cases as one character.Reviewer Test Plan
How to verify
Run the sed parser unit tests. The new regression case covers the six rows from the issue: astral characters with
., a negated class, a zero-widthx*match, and a CRLF substitution. Before the change it fails on the first astral row; after the change all cases pass. Also confirm that ordinary bracket patterns such as[abc],[^abc], and[\[\]]still take the simulation path rather than falling back.Evidence (Before & After)
N/A for UI. Unit tests: 53 passed, including new pins for negated, mixed and equivalence-class POSIX forms (
[^[:space:]],[[:alpha:]abc],[[=a=]]) and for the GNU/BSD multibyte-backreference split. The full core suite passed 39,351 tests; the singlebun-pty.test.tsfailure also reproduces on unmodified main. Typecheck, lint, and formatting pass.Tested on
Linux was verified in a Docker
node:22-bookwormarm64 container.Environment (optional)
Node 22.23.4; unit tests only.
Risk & Scope
uflag can reject patterns that previously compiled, so those commands now fall back to real sed. That is the existing fail-safe path and never writes a wrong file.x*iteration and multibyte backreferences are bytewise, while BSD sed and this simulation are characterwise. The POSIX-class guard now declines any pattern containing[:,[.or[=, so mixed and negated character classes also fall back to real sed instead of being simulated wrongly.Linked Issues
Closes #15675
中文说明
这个 PR 做了什么
shell 工具的进程内 sed 模拟现在会用
s和u标志编译替换模式。这样.能匹配回车符,字符类和量词也按 Unicode 字符而不是 UTF-16 code unit 工作。翻译时会把字符类外的字面量]转义,保证更严格的 Unicode 模式仍能接受[\[\]]这类模式。为什么需要
在 CRLF 文件上,
s/=.*$/=new/匹配不到任何内容,工具会报告没有产生修改。在包含星平面字符的文件上,s/^.//只删掉 emoji 的一半,并把孤立代理项写成 U+FFFD,静默损坏文件。真实 sed 在两种情况下都按一个字符处理。评审测试计划
如何验证
运行 sed 解析器单测。新增回归用例覆盖 issue 里的六行:星平面字符配合
.、否定字符类、零宽x*匹配,以及 CRLF 替换。修改前第一行星平面用例失败,修改后全部通过。同时确认[abc]、[^abc]、[\[\]]这类普通字符类仍然走模拟路径,而不是回退。证据(修改前后)
UI 变化:N/A。单测 53 通过,新增取反/混合/等价类 POSIX 形态(
[^[:space:]]、[[:alpha:]abc]、[[=a=]])以及 GNU/BSD 多字节反向引用分歧的钉子。core 全量 39,351 通过;唯一失败的bun-pty.test.ts在未修改的 main 上也能复现。类型检查、lint、格式化均通过。测试环境
Linux 在 Docker
node:22-bookwormarm64 容器中验证。运行环境(可选)
Node 22.23.4;仅单测。
风险与范围
u标志会拒绝一些以前能编译的模式,这些命令会回退到真实 sed。这是既有的 fail-safe 路径,不会写错文件。x*与多字节反向引用按字节推进,而 BSD sed 和本模拟按字符推进。POSIX 字符类 guard 现在对含[:、[.、[=的模式一律回退,混合与取反写法也不再被错误模拟。关联 issue
Closes #15675