Skip to content

fix(index-append): stop losing the conclusion on numbered lists — and never miss silently - #1

Merged
bhyi4 merged 2 commits into
mainfrom
fix/index-append-list-styles
Aug 4, 2026
Merged

fix(index-append): stop losing the conclusion on numbered lists — and never miss silently#1
bhyi4 merged 2 commits into
mainfrom
fix/index-append-list-styles

Conversation

@bhyi4

@bhyi4 bhyi4 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What broke

The knowledge-index extractor assumed the ## What was closed section opened with a - bullet:

r'##\s*What was closed[^\n]*\n(?:>.*\n)*-\s*(.+)'

A numbered list (1. …) matched nothing → the entry was indexed with an empty conclusion.
But the close still succeeded and the log still printed 📚 knowledge index appended.
The failure was invisible, which is the part that matters.

Not hypothetical

Found while auditing a real ledger: 3 of 11 entries had an empty conclusion, all three from
this same cause
, and the two most recent closes were consecutive misses — the newer
writing style was quietly draining the index one close at a time.

The fix

  • Take the section's first substantive line and strip only the list marker (-/*/+, 1., 1)).
    **1. …** is content, so it is kept verbatim.
  • Warn loudly next to the success line when extraction yields nothing. Still best-effort —
    it never blocks the close (asserted).

Tests

Seven assertions in tests/test_gates.sh: bullet / numbered / paren-numbered / bold-numbered /
leading blockquote / loud-miss / never-blocks.

Manipulation check — reverted bin/index-append to the old version and re-ran: 4 of the 7 fail
(numbered, paren-numbered, bold-numbered, loud-miss); the other 3 are backward-compat and pass on both.
The tests bite the actual defect rather than restating the new code.

🤖 Generated with Claude Code

Mother Seara and others added 2 commits August 4, 2026 23:13
… never miss silently

The knowledge-index extractor assumed the "What was closed" section opened with a
`- ` bullet. A numbered list (`1. …`) matched nothing, so the entry was indexed with
an empty conclusion — while the close still succeeded and the log still printed
"knowledge index appended". The failure was invisible.

Observed in a real ledger, not hypothetically: 3 of 11 entries were empty, all three
from the same cause, and the two most recent closes were consecutive misses — i.e. the
newer writing style was silently draining the index.

- take the section's first substantive line and strip only the list marker
  (`-`/`*`/`+`, `1.`, `1)`); `**1. …**` is content and is kept verbatim
- warn loudly next to the success line when extraction yields nothing, so a miss is
  visible at close time. Still best-effort: it never blocks the close.
- regression tests for each list style + the loud-miss path. Verified they fail
  against the old extractor (4 of 7 assertions), so the tests actually bite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bhyi4
bhyi4 merged commit d7887c8 into main Aug 4, 2026
3 checks passed
@bhyi4
bhyi4 deleted the fix/index-append-list-styles branch August 4, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant