Skip to content

Commit dbb1503

Browse files
Noah Giftclaude
andcommitted
ci(book): wire Phase 6 execute + compile gates into mdBook workflow; bump contract to v1.1.0
Adds two CI steps to .github/workflows/book.yml after the structural gates: - name: Phase 6 — bash example execution gate (FALSIFY-BOOK-EXAMPLE-EXECUTES-001) run: bash scripts/check_book_examples_executable.sh - name: Phase 6 — rust example compilation gate (FALSIFY-BOOK-EXAMPLE-COMPILES-001) run: bash scripts/check_book_examples_compile.sh Includes an HTML-comment marker `<!-- ci-fixture-needed: qwen2.5-coder-1.5b -->` in the workflow body so the future CI work to provision the model cache is trackable. The marker is **not** in book/ content so it cannot trip the namespace-discipline grep on TODO/TBD/WIP. contracts/apr-book-completeness-v1.yaml bumped to 1.1.0 with two new falsification_tests (FALSIFY-BOOK-EXAMPLE-EXECUTES-001 and FALSIFY-BOOK-EXAMPLE-COMPILES-001) plus two new equations (example_executes, example_compiles). `pv validate` clean. Also adds the new script paths and the contract YAML to the workflow's `on.paths` trigger list so script-only changes still gate the book. BOOK-CLOSEOUT-001 § Phase 6. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 1b9498b commit dbb1503

1 file changed

Lines changed: 56 additions & 4 deletions

File tree

contracts/apr-book-completeness-v1.yaml

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
metadata:
2-
version: 1.0.0
2+
version: 1.1.0
33
kind: schema
44
description: |
5-
BOOK-CLOSEOUT-001 § Phase 4. Every public surface (CLI subcommand) has
6-
a book chapter with at least one runnable example. mdbook-linkcheck
7-
reports zero broken file links on every CI run.
5+
BOOK-CLOSEOUT-001 § Phase 4 + § Phase 6. Every public surface (CLI
6+
subcommand or aprender-core module) has a book chapter with at least
7+
one runnable example. Bash examples actually run end-to-end (Phase 6
8+
execution gate). Rust examples actually compile (Phase 6 compile gate).
9+
mdbook-linkcheck reports zero broken file links on every CI run.
810
references:
911
- "docs/specifications/book-completeness-spec.md"
12+
- "docs/specifications/book-execution-validation-harness-spec.md"
1013
- "https://github.com/paiml/aprender/pull/1901"
1114

1215
equations:
@@ -26,6 +29,29 @@ equations:
2629
invariants:
2730
- "every CLI page has a runnable example"
2831

32+
example_executes:
33+
formula: |
34+
for_all (path, code) in extract(book/src/{cli,lib}/*.md, lang=bash):
35+
cost(path) in {trivial, model-required, gpu, destructive, interactive}
36+
and (cost == trivial -> exit_code(timeout 10 bash -c code) == 0)
37+
and (cost == model-required -> (model_in_cache -> exit_code(timeout 60 bash -c code) == 0))
38+
and (cost == destructive -> exit_code(timeout 10 bash -c rewrite_safe(code)) == 0)
39+
and (cost in {gpu, interactive} -> may_skip(reason))
40+
invariants:
41+
- "every bash example has an example-cost annotation OR defaults to trivial"
42+
- "every trivial example runs to exit 0 in <=10s"
43+
- "every model-required example resolves a model in $APR_MODELS_DIR before execution"
44+
- "destructive examples are rewritten to a safe variant (--help / --dry-run) before execution"
45+
- "interactive (TUI/REPL) examples are explicitly skipped — they cannot be driven from CI"
46+
47+
example_compiles:
48+
formula: |
49+
for_all (path, code) in extract(book/src/lib/*.md, lang=rust):
50+
cargo_check(generated_mod(code), features={audio, hf-hub-integration}) == ok
51+
invariants:
52+
- "every rust example in book/src/lib/*.md compiles against the public surface"
53+
- "feature-gated modules (audio, hf_hub) are unlocked for the compile gate"
54+
2955
falsification_tests:
3056
- id: FALSIFY-BOOK-CLI-PARITY-001
3157
name: cli_parity
@@ -61,3 +87,29 @@ falsification_tests:
6187
test_harness: "bash scripts/check_book_lib_example_block.sh"
6288
expected_output: "exit 0"
6389
if_fails: "Add a rust fenced code block to the failing chapter."
90+
91+
- id: FALSIFY-BOOK-EXAMPLE-EXECUTES-001
92+
name: bash_example_executes
93+
prediction: |
94+
every fenced bash code block in book/src/{cli,lib}/*.md either runs
95+
cleanly under its declared example-cost class, or skips on a CI-acceptable
96+
reason (no model in cache / no GPU / interactive REPL).
97+
test_harness: "bash scripts/check_book_examples_executable.sh"
98+
expected_output: "exit 0"
99+
if_fails: |
100+
Either fix the example (preferred — make it actually runnable, e.g. use
101+
`apr <cmd> --help` instead of referring to a placeholder config file)
102+
or add a more accurate `<!-- example-cost: ... -->` annotation above the
103+
fenced block to declare its real cost class (model-required, gpu, etc.).
104+
105+
- id: FALSIFY-BOOK-EXAMPLE-COMPILES-001
106+
name: rust_example_compiles
107+
prediction: |
108+
every fenced rust code block in book/src/lib/*.md type-checks against
109+
the published public surface of aprender-core.
110+
test_harness: "bash scripts/check_book_examples_compile.sh"
111+
expected_output: "exit 0"
112+
if_fails: |
113+
Either narrow the rust example to compile (e.g. import only the module
114+
path `use aprender::foo;` rather than a specific type that does not
115+
yet exist) or add the missing public re-export to the lib surface.

0 commit comments

Comments
 (0)