From 31134cffae18c60b804970dcf0ec3c3a943b0343 Mon Sep 17 00:00:00 2001 From: vycdev2 Date: Tue, 29 Sep 2026 01:05:25 +0000 Subject: [PATCH 1/2] fix: avoid false embedded scan candidates for optional markers --- src/utils/embedded/regex.ts | 3 ++- test/embedded-regex.spec.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/utils/embedded/regex.ts b/src/utils/embedded/regex.ts index c633e49..9766e18 100644 --- a/src/utils/embedded/regex.ts +++ b/src/utils/embedded/regex.ts @@ -33,8 +33,9 @@ export const hasEmbeddedMatch = (content: string, regex: RegExp): boolean => { const matcher = new RegExp(regex.source, regex.flags); return splitLines(content).some((line) => { + const trimmed = _.trimStart(line); matcher.lastIndex = 0; - return matcher.test(_.trimStart(line)); + return matcher.test(trimmed) && parseEmbeddedMatches(trimmed, regex).length > 0; }); }; diff --git a/test/embedded-regex.spec.ts b/test/embedded-regex.spec.ts index cb29d55..390f673 100644 --- a/test/embedded-regex.spec.ts +++ b/test/embedded-regex.spec.ts @@ -80,6 +80,18 @@ describe('Embedded todo scan pre-check', () => { expect(hasEmbeddedMatch('const ready = true;\r // TASK ship it', regex)).to.equal(true); }); + + it('skips matches without a configured marker capture', () => { + const regex = /(TODO)?(hello)/g; + expect(hasEmbeddedMatch('hello', regex)).to.equal(false); + expect(hasEmbeddedMatch('TODOhello', regex)).to.equal(true); + }); + + it('finds a later valid match after an empty alternative', () => { + const regex = /(TODO)|(?:)/g; + expect(hasEmbeddedMatch('nothing', regex)).to.equal(false); + expect(hasEmbeddedMatch(' TODO', regex)).to.equal(true); + }); }); describe('Embedded todo line parsing', () => { From 71193e0f9210a34ee68def871d5900659294d4f0 Mon Sep 17 00:00:00 2001 From: Codex Integration Review Date: Wed, 14 Oct 2026 07:39:04 +0000 Subject: [PATCH 2/2] docs: record optional embedded marker fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1cf4c4..fd37401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ #### Review fixes +- Skipped false embedded-todo scan candidates when custom expressions match without a non-empty marker. - Preserved balanced closing parentheses, brackets, and braces in relative file-link filenames while excluding surrounding punctuation. - Preserved unsaved archive buffers, serialized simultaneous transfers, and replaced closed archive files only after a complete write. Failed writes, stale source documents, and rejected editor edits keep source tasks intact. - Preserved archive task order, sibling project structure, attached comment indentation, and standalone notes when removing empty projects.