Commit ec4c527
committed
fix(compiler): YAML-safe brief in concept frontmatter (closes #67)
LLM-authored brief values often contain colons, quotes, or hashes; the
existing f-string interpolation in _write_concept produced invalid
frontmatter (e.g. "brief: Why X: Y" → mapping value not allowed).
OpenKB's own reader uses string slicing so it never noticed, but
external YAML-aware tools (VS Code preview, Obsidian, doc generators)
reject the page.
- New _yaml_kv_line helper routes the value through yaml.safe_dump so
PyYAML auto-quotes when needed.
- Both write sites in _write_concept (re.sub update path + create
path) use the helper. re.sub now takes a lambda replacement to
bypass backref interpretation when brief contains literal \1 / \g<…>.
- New find_invalid_frontmatter check in lint.py runs yaml.safe_load
on every wiki page's frontmatter and is wired into the
run_structural_lint report; future regressions surface immediately
instead of silently writing bad YAML.
Repro and root-cause analysis by @invu557 (issue #67).1 parent 7289cfe commit ec4c527
2 files changed
Lines changed: 63 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
564 | 565 | | |
565 | 566 | | |
566 | 567 | | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
567 | 581 | | |
568 | 582 | | |
569 | 583 | | |
| |||
598 | 612 | | |
599 | 613 | | |
600 | 614 | | |
| 615 | + | |
601 | 616 | | |
602 | | - | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
603 | 620 | | |
604 | | - | |
| 621 | + | |
605 | 622 | | |
606 | 623 | | |
607 | 624 | | |
| |||
611 | 628 | | |
612 | 629 | | |
613 | 630 | | |
614 | | - | |
| 631 | + | |
615 | 632 | | |
616 | 633 | | |
617 | 634 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
402 | 405 | | |
403 | 406 | | |
404 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
405 | 438 | | |
406 | 439 | | |
407 | 440 | | |
| |||
418 | 451 | | |
419 | 452 | | |
420 | 453 | | |
| 454 | + | |
421 | 455 | | |
422 | 456 | | |
423 | 457 | | |
| |||
455 | 489 | | |
456 | 490 | | |
457 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
458 | 501 | | |
459 | 502 | | |
0 commit comments