Skip to content

Commit bfc0542

Browse files
committed
refactor(compiler): use shared frontmatter module; fix --- boundary + concept malformed fallback
- Import openkb.frontmatter; replace local _yaml_kv_line / _yaml_list_line / _parse_yaml_list_value / _set_fm_line bodies with thin aliases to the shared module exports (call sites unchanged). - Replace all ad-hoc text.find("---", 3) splits with frontmatter.split(): _write_summary, _write_concept, _write_entity, _read_concept_briefs, _read_entity_briefs, compile_long_doc backfill, _gen_update, _gen_entity_update, summary-rewrite strip, _prepend_source_to_frontmatter, _remove_source_from_frontmatter, scan_affected_pages. - Add module-level _resolve_description(fm) helper; use it in both reader functions to consolidate description/brief fallback logic. - _read_concept_briefs and _read_entity_briefs now use frontmatter.parse() instead of manual yaml.safe_load. - Replace re.sub(r"^brief:.*\n?", ...) with frontmatter.drop_line() in both _write_concept and _write_entity update paths. - Add malformed-frontmatter fallback to _write_concept update path: when frontmatter.split returns None, rebuild valid block (type: Concept, sources, description) rather than writing a bare body. - Remove now-unused direct yaml import. - Add 3 regression tests: concept round-trip with "---" in brief, entity round-trip with "---" in brief, concept update on malformed frontmatter.
1 parent 7cfa30d commit bfc0542

4 files changed

Lines changed: 410 additions & 180 deletions

File tree

0 commit comments

Comments
 (0)