Skip to content

Commit 30b0981

Browse files
test(hex-line): de-flake anchor-extraction regexes in smoke.mjs
Tightened three regexes in the round-trip and CHECKSUM_MISMATCH tests so the anchor pattern [a-z2-7]{2}\.N is followed by \t<content>. The loose form could accidentally match a substring of the mtime timestamp in the readFile meta line (e.g. "25.2" in "...T19:17:25.29...Z"), producing a bogus anchor and a HASH_MISMATCH failure on CI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d72675b commit 30b0981

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

mcp/hex-line-mcp/test/smoke.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,8 +2755,8 @@ describe("protocol: edit_file output", () => {
27552755
fs.writeFileSync(tmp, "aaa\nbbb\nccc\n");
27562756
try {
27572757
const read = readFile(tmp, { ranges: ["1-3"] });
2758-
const startAnchor = read.match(/([a-z2-7]{2}\.1)/)?.[1];
2759-
const endAnchor = read.match(/([a-z2-7]{2}\.3)/)?.[1];
2758+
const startAnchor = read.match(/([a-z2-7]{2}\.1)\taaa/)?.[1];
2759+
const endAnchor = read.match(/([a-z2-7]{2}\.3)\tccc/)?.[1];
27602760
// Mutate the file to make checksum stale
27612761
fs.writeFileSync(tmp, "aaa\nXXX\nccc\n");
27622762
try {
@@ -2823,7 +2823,7 @@ describe("E2E: workflow round-trips", () => {
28232823
try {
28242824
// Read
28252825
const read = readFile(tmp, { ranges: ["1-3"] });
2826-
const anchor = read.match(/([a-z2-7]{2}\.2)/)?.[1];
2826+
const anchor = read.match(/([a-z2-7]{2}\.2)\tconst y = 2;/)?.[1];
28272827
assert.ok(anchor, "Got anchor from read");
28282828
// Edit
28292829
const editResult = editFile(tmp, [{ set_line: { anchor, new_text: "const y = 42;" } }]);

0 commit comments

Comments
 (0)