fix(memory): upgrade-side v1 reader skips status lines inside code fences

This commit is contained in:
bchanot committed 2026-10-28 16:23:33 +01:00
1 parent 197b899c3f
commit c742b1f322
2 files changed
+14 -4

No files matched your search

+4 -4
View File
@@ -591,11 +591,11 @@ memory_legacy_status() { # <file> <ID> [<end>] → the v1 lexical status line
| tail -1
return
fi
RE="$_MEM_LEGACY_RE" awk -v id="$2" -v end="$end" '
/^```/ { fence = !fence }
!fence && $0 ~ end { on = 0 }
RE="$_MEM_LEGACY_RE" END_RE="$end" awk -v id="$2" '
/^```/ { fence = !fence; next }
!fence && $0 ~ ENVIRON["END_RE"] { on = 0 }
!fence && $0 ~ "^## " id " " { on = 1; next }
on && tolower($0) ~ tolower(ENVIRON["RE"]) { last = $0 }
on && !fence && tolower($0) ~ tolower(ENVIRON["RE"]) { last = $0 }
END { if (last != "") print last }' "$1"
}
+10
View File
@@ -428,6 +428,16 @@ v1blk d15/fenced '## BLK-003 — three' 'Status: resolved' '```' \
bash "$MEM" upgrade d15/fenced >/dev/null 2>&1
check T15-fenced-no-repair "$(grep -c 'upgrade)' d15/fenced/blockers.md)" 0
check T15-fenced-open "$(memory_word_of d15/fenced/blockers.md BLK-003)" open
# status words inside a ``` fence are not the entry's status
v1blk d15/fstat-a '## BLK-003 — three' 'Status: open' '```' 'Status: resolved' '```'
bash "$MEM" upgrade d15/fstat-a >/dev/null 2>&1
check T15-fenced-status-a-no-repair "$(grep -c 'upgrade)' d15/fstat-a/blockers.md)" 0
check T15-fenced-status-a "$(memory_word_of d15/fstat-a/blockers.md BLK-003)" open
v1blk d15/fstat-b '## BLK-003 — three' 'Status: open' '```' \
'## BLK-009 — quoted' 'Status: resolved' '```'
bash "$MEM" upgrade d15/fstat-b >/dev/null 2>&1
check T15-fenced-status-b-no-repair "$(grep -c 'upgrade)' d15/fstat-b/blockers.md)" 0
check T15-fenced-status-b "$(memory_word_of d15/fstat-b/blockers.md BLK-003)" open
# `## ID—x` (no space) is no v1-visible heading: no silent flip
v1blk d15/nospace '## BLK-001—x' 'Status: resolved' '' \
'## BLK-002 — y' 'Status: open'