Commit 63b62c2
committed
fix(deck): close 6 high-confidence findings from skill-refactor review
Architectural review (4 parallel Opus auditors) found that the skill_runner
core was already generic, but the deck SURFACE was still fused to
Editorial Monocle. Fixed:
* validator: now takes optional `grammar` param (DeckGrammar TypedDict);
skill-agnostic by default (only checks file present, parses, ≥5
slides, self-contained). Third-party deck skills (guizang, swiss)
now pass validation cleanly. Editorial-specific rules opt-in via
`EDITORIAL_MONOCLE_GRAMMAR`. (finding #2)
* skills/openkb-deck-editorial/SKILL.md: declares its grammar +
output_path_template under `od:` frontmatter — `run_skill` reads
these and applies them post-run.
* run_skill: now honors frontmatter `od.mode`, `od.output_path_template`,
`od.deck_grammar`. When mode=="deck" and template is set, the runner
injects the path into intent, verifies the file exists post-run, and
runs validate_deck with the skill's grammar. Validation result is
returned via new SkillRunResult dataclass. (findings #4, #5)
* `openkb deck new --skill <name>`: CLI flag accepts any installed deck
skill (default openkb-deck-editorial). guizang and swiss now usable
from the scripted CLI, not only freeform chat. (finding #1)
* `/deck new --skill <name>` chat slash: same flag, parsed positionally
alongside --critique. (finding #1)
* tests/test_read_kb_file.py: 13 new tests mirroring test_write_kb_file
for the read-side allow-list. Pins refusal of `.openkb/config.yaml`,
`.env`, `raw/`, `..` traversal, absolute paths. (finding #6)
* Generator deck branch: no longer calls validate_deck directly; just
propagates run_deck_create's SkillRunResult.validation up. Validation
is now a property of "this skill declared mode=deck", not of "this
CLI path was taken".
Existing tests updated:
* tests/test_deck_validator.py: explicit grammar arg on Editorial-
specific tests; added test_guizang_shape_passes_generic_mode +
test_missing_cover_ignored_in_generic_mode to pin both modes.
* tests/test_deck_creator.py: mocks return SkillRunResult; new
test_run_deck_create_honors_skill_name_override for --skill flag.
* tests/test_generator.py: deck dispatch test mocks SkillRunResult.
Below-threshold findings deferred:
* Generator if/else → registry (score 70) — works, just not extensible
via plugin; future.
* Iteration backup in chat freeform path (score 75) — needs write_kb_file
hook; separate change.
* run_skill / scan_local_skills / _handle_slash_critique direct tests
(scores 60-70) — covered indirectly by integration; can add later.
Regression: 538 tests pass (was 523 pre-fix; net +15 = 13 new
read_kb_file tests + 2 new validator-mode tests).1 parent 708baa3 commit 63b62c2
11 files changed
Lines changed: 645 additions & 188 deletions
File tree
- openkb
- agent
- deck
- skill
- skills/openkb-deck-editorial
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
609 | | - | |
610 | | - | |
| 609 | + | |
| 610 | + | |
611 | 611 | | |
612 | 612 | | |
| 613 | + | |
613 | 614 | | |
614 | | - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
615 | 618 | | |
616 | 619 | | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
617 | 625 | | |
618 | 626 | | |
| 627 | + | |
619 | 628 | | |
620 | 629 | | |
621 | 630 | | |
622 | | - | |
| 631 | + | |
623 | 632 | | |
624 | 633 | | |
625 | 634 | | |
| |||
650 | 659 | | |
651 | 660 | | |
652 | 661 | | |
653 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
654 | 667 | | |
655 | 668 | | |
656 | 669 | | |
657 | 670 | | |
658 | 671 | | |
659 | 672 | | |
660 | 673 | | |
| 674 | + | |
661 | 675 | | |
662 | 676 | | |
663 | 677 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
12 | 25 | | |
13 | 26 | | |
14 | 27 | | |
| 28 | + | |
15 | 29 | | |
16 | | - | |
| 30 | + | |
17 | 31 | | |
18 | 32 | | |
19 | 33 | | |
| |||
30 | 44 | | |
31 | 45 | | |
32 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
33 | 64 | | |
34 | 65 | | |
35 | 66 | | |
| |||
39 | 70 | | |
40 | 71 | | |
41 | 72 | | |
| 73 | + | |
42 | 74 | | |
43 | | - | |
44 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
45 | 86 | | |
46 | 87 | | |
47 | 88 | | |
48 | | - | |
49 | | - | |
| 89 | + | |
50 | 90 | | |
51 | 91 | | |
52 | 92 | | |
| |||
55 | 95 | | |
56 | 96 | | |
57 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
58 | 101 | | |
59 | 102 | | |
60 | 103 | | |
61 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
62 | 109 | | |
63 | 110 | | |
64 | | - | |
| 111 | + | |
| 112 | + | |
65 | 113 | | |
66 | 114 | | |
67 | 115 | | |
| |||
74 | 122 | | |
75 | 123 | | |
76 | 124 | | |
77 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
78 | 138 | | |
79 | 139 | | |
80 | 140 | | |
| |||
131 | 191 | | |
132 | 192 | | |
133 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1934 | 1934 | | |
1935 | 1935 | | |
1936 | 1936 | | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
1937 | 1947 | | |
1938 | | - | |
| 1948 | + | |
1939 | 1949 | | |
1940 | 1950 | | |
1941 | 1951 | | |
| |||
1945 | 1955 | | |
1946 | 1956 | | |
1947 | 1957 | | |
| 1958 | + | |
1948 | 1959 | | |
1949 | 1960 | | |
1950 | 1961 | | |
| |||
2007 | 2018 | | |
2008 | 2019 | | |
2009 | 2020 | | |
2010 | | - | |
| 2021 | + | |
| 2022 | + | |
2011 | 2023 | | |
2012 | 2024 | | |
2013 | 2025 | | |
2014 | 2026 | | |
2015 | 2027 | | |
2016 | 2028 | | |
2017 | 2029 | | |
| 2030 | + | |
2018 | 2031 | | |
2019 | 2032 | | |
2020 | 2033 | | |
| |||
0 commit comments