refactor(kb): one definition per fact, one setting per style (v0.13.1) - #7
Merged
Merged
Conversation
- kb_unmerged is the single source for "open features with an unmerged harvest" (index and harvest both read it); kb_meta feeds both index passes; kb_get replaces nine kb_real/kb_field idioms; kb_closed replaces three awk one-liners - drop the intent.md `## Summary` fallback (a format no store ever wrote) and kb_summary_where with it - drop `index --obsidian`: the style is a store setting (config.md index_style), which is what init.sh/close.sh already honour; the flag is an unknown option - fix: `show` now prints Tags from summary.md (it read only intent.md); a CLOSED record outside archive/ sorts and labels as closed - record lines use \037, not tab: a tab is IFS whitespace, so `read` collapsed adjacent tabs and an empty tags/date field shifted the fields after it - tools/kb.sh 605 → 538 lines; knowledge-test section H rewritten for the config-only style (144 assertions) Validation: knowledge-test 144/0, selftest PASS, e2e 152/0, autotest 195/0; page and digests byte-identical to v0.13.0 on a real store except the two fixes above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v0.13.1 — kb.sh without the duplication v0.13.0 shipped with
A refactor of
tools/kb.shwith one intentional behaviour change. Output ofshow,index,list,searchandharvestis unchanged byte for byteexcept where noted; the gates are untouched.
Changes
indexandharvesteach had theirown loop deciding which open features still hold candidates; both now read
kb_unmerged.index's two passes over the features (overview table, thenone section each) share
kb_metafor state, date, tags and title instead ofextracting them twice.
kb_getreplaces the ninekb_real "$(kb_field …)"idioms;kb_closedreplaces the three awk one-liners over
CLOSED.## Summary-inside-intent.md fallback. It supported a formatno store ever wrote — designed and abandoned inside the v0.13.0 work — and its
helper
kb_summary_wherewith it.summary.mdis the digest.index --obsidian. The page style is a property of the store, andinit.shandclose.shregenerate the page without flags, soindex_style: obsidianin the store'sconfig.mdwas already the settingthat mattered. One setting, one place; the flag is now an unknown option.
showprintedTags:only when the intent carried them,although the tags live in
summary.md— the meta line now uses the samekb_tagsthe page uses. A feature that carries aCLOSEDrecord but was neverarchived (an interrupted close) is now treated as closed everywhere on the
page — sorted by
closed_atand labelledclosed <date>— where before onlyarchive/entries were.\037as separator, not a tab: a tab is IFSwhitespace, so
readcollapses adjacent tabs and an empty field (no tags, nodate) shifted the fields after it.
tools/kb.sh605 → 538 lines.Checked against a real store (84 open, 2 archived, Korean records): the page
and the
showdigests are byte-identical to v0.13.0 except for the two linesthe fixes above describe;
harvestoutput is identical.Validation
bash gates/knowledge-test.sh→KNOWLEDGE-TEST PASS, 144 assertions(section H rewritten for the config-only style; the flag refusal is asserted)
bash gates/selftest.sh→SELFTEST PASSbash gates/e2e.sh→E2E PASS, 152 ·bash gates/autotest.sh→AUTOTEST PASS, 195