33\* Callers: scanCommandDirectory, tryLoadCommand and SkillsManager (load, read, update). One guard serves all.
44\* Source: the header language in a workspace command or skill file. Sink: the gray-matter engine call.
55\* Failure: a file header selects an executable engine and the extension runs its code.
6- \* Invariant : NoExecutableEngine. gray-matter is an oracle. Only the header language is modeled.
6+ \* Invariants : NoExecutableEngine and ValidDataAccepted . gray-matter is an oracle. Only the header language is modeled.
77\* Expect: Fixed holds. None fails at once. NoBomStrip fails with a BOM and an executable header.
8- \* Result: Fixed holds in 6 states. None fails in 1 state. NoBomStrip fails in 1 state, with a BOM.
8+ \* Expect: CaseSensitive fails ValidDataAccepted on an upper-case data header.
9+ \* Result: Fixed holds in 8 states. CaseSensitive fails ValidDataAccepted in 1 state, with upper-case YAML.
10+ \* Result: Before this change, Fixed held in 6 states. None fails in 1 state. NoBomStrip fails in 1 state, with a BOM.
911\* Replay: gray-matter runs a js header in the real library. The guard in the code stops it.
1012\* Not modeled: the YAML and JSON parsers. The file body.
1113\* Cost: TLC runs in under 1 second. Agent time is not measured.
12- \* Review: 1 covered (bot thread on double BOM, PR 2455), 0 added, 1 gap.
13- \* Gap: PR 2456 bot thread on uppercase YAML. The spec models safety only, not false rejects. A test covers it.
14+ \* Review: 1 covered (bot thread on double BOM, PR 2455), 1 added, 0 gap.
15+ \* Added: PR 2456 bot thread on uppercase YAML. ValidDataAccepted and the CaseSensitive config model it.
16+ \* Gap: an upper-case JSON header passes the guard. gray-matter then throws "engine not registered". It is a safe false reject. The code is unchanged.
1417\* Gap: a YAML tag such as !!js/function is not a header language. The spec cannot express it. A test covers it.
1518\* Replay: two BOMs do not run code in gray-matter. It is a false alarm. A test case stays.
1619\* Skills: the skill caller is the same input domain. The skill path was unguarded before this change.
1720\* Property test: src/utils/__tests__/safeFrontmatter.spec.ts. Caller tests: SkillsManager.spec.ts, frontmatter-commands.spec.ts.
1821
19- CONSTANT Variant \* "Fixed", "None" or "NoBomStrip "
22+ CONSTANT Variant \* "Fixed", "None", "NoBomStrip" or "CaseSensitive "
2023
2124VARIABLE in
2225
23- \* "exec" = js or javascript in any case. "data" = yaml, yml, json or no language.
26+ \* "exec" = js or javascript in any case. "data" = yaml, yml, json or no language, lower case.
27+ \* "upper" = yaml or yml with an upper-case letter. gray-matter does not lowercase json.
2428\* "other" = any other name. gray-matter finds no engine for it.
25- Inputs == [ bom : BOOLEAN , lang : { "data" , "exec" , "other" } ]
29+ Inputs == [ bom : BOOLEAN , lang : { "data" , "upper" , " exec", "other" } ]
2630
2731\* The guard reads the header language. Without the BOM strip it misses the header.
28- GuardSeesHeader ( i ) == Variant = "Fixed" \/ ( Variant = "NoBomStrip" /\ ~ i . bom )
29- Rejected ( i ) == GuardSeesHeader ( i ) /\ i . lang # "data"
32+ GuardSeesHeader ( i ) == Variant \in { "Fixed" , "CaseSensitive" } \/ ( Variant = "NoBomStrip" /\ ~ i . bom )
33+ Rejected ( i ) == GuardSeesHeader ( i ) /\ i . lang # "data" /\ ( i . lang # "upper" \/ Variant = "CaseSensitive" )
3034Executed ( i ) == i . lang = "exec" /\ ~ Rejected ( i )
3135
3236TypeOK == in \in Inputs
@@ -38,4 +42,7 @@ Spec == Init /\ [][Next]_in
3842\* Safety: no input reaches an executable engine.
3943NoExecutableEngine == ~ Executed ( in )
4044
45+ \* Liveness of valid files: a data header is never rejected.
46+ ValidDataAccepted == in . lang \in { "data" , "upper" } => ~ Rejected ( in )
47+
4148====
0 commit comments