Skip to content

Commit 0605741

Browse files
committed
fix(entity-io): use start-of-line match for rationale header parsing
Addresses CodeRabbit review finding: Content containing "## Rationale" will be incorrectly parsed
1 parent 88d4c09 commit 0605741

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

plugins/kaizen/lib/entity_io.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,10 @@ def markdown_to_entity(path):
205205

206206
# Split body into content and rationale
207207
body = body.strip()
208-
rationale_marker = "## Rationale"
209-
if rationale_marker in body:
210-
idx = body.index(rationale_marker)
211-
content = body[:idx].strip()
212-
rationale = body[idx + len(rationale_marker):].strip()
208+
m = re.search(r"^## Rationale", body, re.MULTILINE)
209+
if m:
210+
content = body[:m.start()].strip()
211+
rationale = body[m.end():].strip()
213212
if rationale:
214213
entity["rationale"] = rationale
215214
else:

0 commit comments

Comments
 (0)