fix(phase-lifecycle): fast-path replaceInCurrentMilestone only when pattern matches after
The previous guard `if (after.trim().length > 0)` incorrectly triggered when `after` contained only footer text (e.g. `---\n*Last updated*`). In that case `after.replace(pattern, replacement)` is a no-op and the function returned unchanged content instead of falling through to the slow path that searches inside the last `<details>` block. Fix: capture the replaced string first, then only take the fast path when the replacement actually changed `after`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -111,8 +111,9 @@ export function replaceInCurrentMilestone(
|
||||
|
||||
// Fast path: the current milestone is not inside a <details> block — the
|
||||
// pattern lives in the plain text after the last </details>.
|
||||
if (after.trim().length > 0) {
|
||||
return before + after.replace(pattern, replacement);
|
||||
const replacedAfter = after.replace(pattern, replacement);
|
||||
if (replacedAfter !== after) {
|
||||
return before + replacedAfter;
|
||||
}
|
||||
|
||||
// Slow path: the active milestone is inside the last <details> block.
|
||||
|
||||
Reference in New Issue
Block a user