Repository navigation
Course code lives here: examples/, and the gates that judge it - #3
Merged
Merged
Conversation
ONE code repo per specialization. A separate paiml/ai-ontology repository was
created for the ontology course's worked examples; that was wrong, and both of
its examples move here instead. ai-ontology is deleted, not archived, so there
is no second place for a reader to look.
examples/gate-the-write constraints compiled from an ontology, applied to
output the model never saw them with
examples/readme-shacl a README's own frontmatter, judged by a closed
SHACL shape it cannot see (lesson 1.2.4)
gate-the-write is refactored on the way in. `check` was grade B at cognitive
complexity 15 -- one match holding three rule bodies -- and is now one function
per rule kind behind a filter_map, so adding a rule adds a function rather than
a branch. `compile` and `main` split the same way. Behaviour is unchanged and
proven so: all three exit codes still fire (0 clean, 1 violation, 2 cannot run),
an empty ontology is still refused rather than passed, 4/4 tests green.
WHAT NOW GATES THIS REPO
`make check` = lint + shell + test + examples + supply-chain + contexts, and the
required `gate` context runs it. Each half is falsifiable:
- scripts/check-examples.awk cross-checks every example against the
example.toml beside it; --self-test makes it judge 7 deliberately broken trees
first, including one with no examples at all, because a checker like this
fails by going quietly blind. 7/7.
- deny.toml states a supply-chain policy and `cargo deny check` runs it for
every example. Licences are allowed exactly as encountered -- MIT and
Apache-2.0 -- since a permission nobody uses is a permission nobody reviewed.
- scripts/check-required-contexts.sh re-verifies
.github/required-status-checks.txt against the LIVE org ruleset, fails on
drift (falsified: adding a bogus context reds it), and SKIPS out loud when it
cannot reach the API rather than reporting success.
`examples` was silently skipped by `make check` at first because a DIRECTORY of
that name exists and make considered the target up to date; .PHONY now covers
it. The tell was the target printing nothing while the run stayed green.
The work moved INTO the `gate` job rather than a job it merely `needs:`. An
aggregator that only inspects another job's result gates nothing by itself, and
a `pmat quality-gate ... || true` I briefly had was the same defect written
smaller.
COMPLY: 3 failures -> 1.
- CB-1701's real half is fixed: a policy now exists and runs inside the
required check.
- CB-1700 and CB-1701's other half are disabled in .pmat.yaml with the
measurement: both read the LEGACY branches/main/protection endpoint, which
answers 404 for a branch protected by an org RULESET. Verified 2026-09-14
with repo + admin:org scope -- orgs/paiml/rulesets/13878864 returns the
ruleset and its `gate` context in the same session the legacy endpoint 404s.
Same exemption, same reason, as paiml/rmedia.
- CB-2100 remains and is NOT exempted. It is org-wide -- rmedia fails it
identically -- and unlike the two above I have no measurement showing it
cannot be fixed, so disabling it would be an exemption outliving its evidence.
check: make check exit 0; cargo test 8/8 + 4/4; clippy -D warnings clean; fmt
clean; bashrs lint 0 errors 0 warnings across all five scripts; cargo deny
advisories/bans/licenses/sources ok for both examples; examples self-test 7/7.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
I had put `pmat comply` in the required `gate` job. It exits 1 on CB-2100 here and in paiml/rmedia alike, so that job could never have gone green -- and the only way out would have been `|| true`, a gate that cannot fail, which is the exact defect this repository's examples are about. Removed, with the reason written beside the step so nobody adds it back without reading it. Comply is run locally and reviewed; it is not faked in CI. Also drops `cargo install --locked pmat` from the job, which was the step making the run crawl for a tool whose output could not be acted on anyway. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CI went red on a step that is green locally: error: unexpected argument '--config' found 0.19 takes --config on the `check` subcommand; 0.20 takes it globally. The local box had 0.19 and CI installed latest, so the same Makefile line was correct on one side and a usage error on the other. Pinned to ~0.19, for the same reason tools.lock pins Jena: a gate whose tool floats is a gate whose invocation is right by luck. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ONE code repo per specialization. A separate
paiml/ai-ontologyrepository was created for the ontology course's worked examples. That was wrong. Both examples move here, andai-ontologyis deleted — not archived — so there is no second place for a reader to look.examples/gate-the-writeexamples/readme-shaclgate-the-write is refactored on the way in
checkwas grade B at cognitive complexity 15 — one match holding three rule bodies. It is now one function per rule kind behind afilter_map, so adding a rule adds a function rather than a branch;compileandmainsplit the same way. Behaviour unchanged and proven: all three exit codes still fire (0clean,1violation,2cannot run), an empty ontology is still refused rather than passed, 4/4 tests green.What now gates this repo
make check=lint shell test examples supply-chain contexts, and the requiredgatecontext runs it. Each half is falsifiable:scripts/check-examples.awkcross-checks every example against theexample.tomlbeside it.--self-testmakes it judge 7 deliberately broken trees first — including one with no examples at all — because a checker like this fails by going quietly blind. 7/7.deny.tomlstates a supply-chain policy andcargo deny checkruns it for every example, inside the required check. Licences allowed exactly as encountered (MIT, Apache-2.0): a permission nobody uses is a permission nobody reviewed.scripts/check-required-contexts.shre-verifies.github/required-status-checks.txtagainst the live org ruleset. Falsified — adding a bogus context reds it. It SKIPS out loud when it cannot reach the API rather than reporting success.Two defects found and fixed in my own work here:
exampleswas silently skipped bymake check, because a directory of that name exists and make considered the target up to date..PHONYnow covers it. The tell was the target printing nothing while the run stayed green.gatejob rather than a job it merelyneeds:. An aggregator that only inspects another job's result gates nothing by itself — and apmat quality-gate … || trueI briefly had was the same defect written smaller.pmat comply: 3 → 1
CB-1700/1701 read the legacy
branches/main/protectionendpoint, which answers404 Branch not protectedfor a branch protected by an org ruleset. Verified 2026-09-14 withrepo+admin:org:orgs/paiml/rulesets/13878864returns the ruleset and itsgatecontext in the same session the legacy endpoint 404s. Same exemption, same reason, aspaiml/rmedia.CB-2100 is left failing on purpose. It is org-wide —
rmediafails it identically — and unlike the two above I have no measurement showing it cannot be fixed. Disabling it would be an exemption outliving its evidence.Verification
make checkexit 0 ·cargo test8/8 + 4/4 ·clippy --all-targets -D warningsclean ·fmtclean ·bashrs lint0 errors 0 warnings across all five scripts ·cargo denyadvisories/bans/licenses/sources ok for both examples · examples self-test 7/7.🤖 Generated with Claude Code