fix(#3740): ack writer searches the exact status-field shape the reader parses (#3940)

* test(#3740): acknowledging a nested-marker status line must clear the entry

* fix(#3740): narrow the ack status-field search to the marker-free shape the reader parses

* chore(#3740): changeset fragment (pr number backfilled after PR creation)

* chore(#3740): backfill changeset PR number (3940)

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-08-27 14:03:48 -04:00
committed by GitHub
parent 11cdc19e39
commit bbecc6a08b
3 changed files with 80 additions and 2 deletions

View File

@@ -2038,8 +2038,19 @@ function acknowledgeDeferredItem(content: string, targetText: string): Acknowled
}
const matchIndexInContent = sectionOffset + start;
const statusFieldRe = /^\s*(?:-\s+)?(\*+status:\*+|status:)/i;
const statusLineIdx = matchedLines.findIndex((rawLine) => statusFieldRe.test(rawLine.replace(/\r$/, '')));
// #3740: the search must mirror the reader exactly. extractGapEntryFields
// strips a bullet marker on line 0 ALONE — a later `- ` line is a nested
// sub-list, never a field line — so a marker-prefixed match on any
// continuation line would rewrite a line no reader reads and report `ok`
// while the entry stays outstanding. Line 0 KEEPS the marker-optional
// form: the reader de-bullets it, so `- status: open` as the entry line is
// a real field there (and first-wins means the insert branch could not
// outrank it). Everything else falls through to the insert branch below,
// which the marker-free and no-status controls already round-trip.
const statusFieldRe = /^\s*(\*+status:\*+|status:)/i;
const statusFieldReLine0 = /^\s*(?:-\s+)?(\*+status:\*+|status:)/i;
const statusLineIdx = matchedLines.findIndex((rawLine, idx) =>
(idx === 0 ? statusFieldReLine0 : statusFieldRe).test(rawLine.replace(/\r$/, '')));
// No CRLF-preservation branch here (WARNING 1, #3458 follow-up review):
// every write goes through `platformWriteSync` → `normalizeContent`, which