Repository navigation
Conversation
doublewhy
force-pushed
the
380-experiment-template-catalog
branch
2 times, most recently
from
October 9, 2026 10:34
64ddfd7 to
3ad4b31
Compare
Every worked example, template, and pattern entry in examples/library/catalog.yaml now records validation_status (validated or guidance), sdl_sections, intended_user, and limits. The gate rejects an entry whose status is outside the vocabulary, a template that is not validated, a pattern that claims validation, an unknown intended user, empty limits, or a section name that is not a current SDL section. Validated worked examples are now parsed through parse_sdl_file and fail on errors or advisories, and a validated entry must list only sections present in its SDL. The catalog description no longer calls every entry validated. The entry checks live in a new support module, tools/example_library_checks.py, because tools/check_example_library.py was already 488 lines against SonarCloud's 500-line file limit. The template-body SDL check moves there with its rule ids and messages. The module imports raes at module level, so the example-library-template-import rule for a failed raes import is removed. The top-level fields that are not sections come from tools/sdl_catalog_parity/_paths.py, which the SDL catalog parity gate keeps in step with specs/sdl/sections.md. examples/README.md documents the fields and what the gate checks.
…laim notes
Add two scenario templates beside minimal-validated-scenario:
segmented-network-scenario (two switched segments, linked hosts with
fixed addresses, HTTPS-only access rules, a service feature) and
parameterized-scenario (host operating system, size, instance count, and
service port from declared variables). Both bodies pass the SDL parser
and semantic validator with no advisories, and both are cataloged with
the entry metadata.
Every template now carries a validation list of commands with their
expected results. The gate requires the field, and
tools/example_library_checks.py checks that it is a non-empty list of
mappings with non-empty command and expected strings. The gate does not
run the commands.
examples/README.md lists what each scenario template shows and does not
claim, how to validate an adapted copy with raes semantic validate, and
that a ${name} placeholder in a template body must name a declared
variable.
… studies Add two templates whose bodies are experiment-authoring-input-v1 documents: seeded-run-plan (run count, seed, and episode controls for one task) and two-condition-study-design (a treatment factor, two compared conditions, and the runs per condition). Both pass the experiment authoring-input loader, parse_experiment_spec. A template's catalog entry may now declare contract: experiment-authoring-input-v1. Such an entry names experiment-author as its intended user and lists no sdl_sections, and the gate validates its body with the experiment loader instead of the SDL parser. Worked examples and patterns stay SDL. examples/README.md separates the SDL, experiment-input, guidance, and unsupported parts of the task, run, and study surfaces, including why there is no experiment-task-v1 template, and gives a command to validate an adapted experiment template.
doublewhy
force-pushed
the
380-experiment-template-catalog
branch
from
October 9, 2026 13:00
3ad4b31 to
8897527
Compare
doublewhy
marked this pull request as ready for review
October 9, 2026 13:27
This was referenced Oct 9, 2026
This branch has not been deployed
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.
Summary
Builds on #1445 (issue #378), which builds on #1438 (issue #381). Until those merge, this PR also shows their commits,
6fa7bdabandf397d0a4. This PR's own change is commit88975279.The library's task, run, and study templates were SDL wrappers only. This PR adds two templates whose bodies are
experiment-authoring-input-v1documents, the pre-run experiment design that ADR-074 defines:seeded-run-plan(run surface): the run count, a seed, and episode controls for one task.two-condition-study-design(study surface): a treatment factor, two compared conditions, and the runs per condition.Their catalog entries declare
contract: experiment-authoring-input-v1. The gate validates such a body withraes_contracts.experiment_spec.parse_experiment_spec, the authoring-input loader, instead of the SDL parser.How this meets the issue's points:
experiment-task-v1document, and the repository has no task loader.raes semantic validate --contract experiment-task-v1exits 2 with "The contract selector is not supported."ExperimentTaskModelalso requires at least one artifact reference with a checksum, size, and creation time, which a template would have to invent. Anexperiment-authoring-input-v1document cannot serve as a task template either: it names a task intask_refand must not repeat task meaning (ADR-074 §2). The README lists the task template under "Outside current support".validationlist gives the gate command and a loader command for an adapted copy. The README gives the copy command too.target_run_count. The study template has factors and a condition allocation. Thelimitsstate that each is pre-run design only and not anexperiment-run-v1orexperiment-study-v1record, and they name the checks the loader does not make.Requirement UIDs
requirement_refsname AUT-806 and EXP-736 (the experiment authoring-input requirement) as context. No requirement record or traceability line changes.Related Issues
Closes #380
ADR Impact
Changes
examples/library/templates/run/seeded-run-plan.yamlandexamples/library/templates/study/two-condition-study-design.yaml(new): each holds anexperiment-authoring-input-v1body and twovalidationentries.examples/library/catalog.yaml: catalogs both templates withcontract,validation_status: validated,intended_user: experiment-author, andlimits, and nosdl_sections. The catalogdescriptionnow mentions experiment templates.tools/example_library_checks.py:contract. The allowed values aresdl-yaml/v1, the default, andexperiment-authoring-input-v1, which only templates may use.sdl-authororexperiment-author.sdl_sectionsis required for SDL entries and must be absent for experiment entries.example-library-entry-contract, reports a contract the entry may not use.check_template_bodysends an experiment body to the loader, and a loader failure is reported asexample-library-template-body. A body under an unknown contract is not validated, because the contract rule already fails the entry.tools/check_example_library.py: unchanged, at 478 lines (wc -l).examples/README.md: adds the experiment templates to the library table. Adds acontractrow to the metadata table and updates thevalidation_status,sdl_sections, andintended_userrows. Adds the "Task, run, and study entries" subsection and the adapted-copy command, and updates the gate paragraph and the template-boundary paragraphs.docs/explain/getting-started.md: one table cell now says a template body validates as current SDL or as anexperiment-authoring-input-v1document.implementations/python/tests/test_issue_380_experiment_templates.py(new): a passing experiment template, and 8 violations that must each produce exactly one rule id:sdl_sectionson an experiment entry, andsdl-authoron an experiment entry;experiment-authoron an SDL template;task_ref, an SDL body under the experiment contract, and an experiment body without a contract.Test Plan
All commands ran from the worktree root under CPython 3.12.13 on head
88975279. The base isorigin/devat35122105plus the #1438 and #1445 commits,6fa7bdabandf397d0a4.I ran each documented command.
uv run --project implementations/python --frozen python tools/check_example_library.pyexited 0 and printed nothing. For each experiment template, I saved itsbodyasmy-experiment.exp.yamlin the worktree root and ran the README'sload_experiment_speccommand. It printedlibrary-seeded-run-planandlibrary-two-condition-study-design, each with exit 0. On a copy that declares bothtarget_run_countandallocation, the same command exited 1, and its traceback ended withExperimentSpecValidationErrorreporting/run_plan: value_error. I removed the file after each run.On a scratch copy where
seeded-run-plandeclares both run-count sources, the gate with--repo-rootexited 1. It reported[example-library-template-body] examples/library/templates/run/seeded-run-plan.yaml: template body is not a valid experiment-authoring-input-v1 document, followed by the loader's/run_plan: value_error.For the task decision,
uv run --project implementations/python --frozen raes semantic validate --contract experiment-task-v1 contracts/fixtures/experiment-core/experiment-task-v1/valid/reference.jsonprintedvalidate: usageanderror [cli.selector] The contract selector is not supported., and exited 2.The
limitsrest on these loader probes against edited copies of the two bodies:condition_id, and a duplicate YAML key.task_refto a task that does not exist.uv run --project implementations/python --frozen --all-extras python -m pytestontest_issue_380_experiment_templates.py,test_issue_378_scenario_templates.py,test_issue_381_example_catalog_metadata.py, andtest_example_library_policy.pywith-q -p no:cacheproviderpassed: 39 passed (9 new). None of the modules has integration-marked cases, and-m integrationdeselects all 39.Regression check: I restored #1445's
tools/example_library_checks.pyfromf397d0a4and kept the new tests and templates. 8 of the 9 new cases failed. The ninth,experiment-body-without-contract, passes on both versions, because a template without a contract is validated as SDL in both. With the change restored, all 39 pass. A coverage.py branch report from the same modules covers every line and branch oftools/example_library_checks.py, including every line this commit adds.nox -s verify-fast-feedback -- --base-rev origin/devpassed, with every non-skipped stage green.policy / requirement governancewas skipped because the branch resolves no requirement UID and no scope file exists for #380.nox -s lintandmake policypassed.This head is rebased onto #1445's head
f397d0a4, which is rebased onto #1438's head6fa7bdab. The previous head,3ad4b312, was on6b467ebc. Three hunks conflicted. Intools/example_library_checks.py, thesdl_sectionsmessage keeps #1438's new wording, "names values that are not SDL sections". Inexamples/README.md, the gate paragraph keeps #1445's new sentence that the gate does not run thevalidationcommands. The "Template Boundary" placeholder sentence from #1445 now says "an SDL template body", becauseparse_experiment_specaccepted aseeded-run-planbody whosetitleordescriptioncontains${undeclared}. The templates and tests are unchanged. CI on3ad4b312(run 37918467275) passed.CI on head
88975279: run 37933867593 (CI) passed, and all 32 checks pass, withdeployskipped. The SonarCloud quality gate is OK on88975279: 0 new issues, 99.3% coverage on new code, and 0.0% duplication.Ground Control Checks
make policyexited 0, and the only skipped stage was requirement governance.Pre-push code review and test-quality review: not run for this lane.
Traceability
examples/library/templates/run/seeded-run-plan.yaml,examples/library/templates/study/two-condition-study-design.yaml,examples/library/catalog.yaml,tools/example_library_checks.py,examples/README.md,docs/explain/getting-started.mdimplementations/python/tests/test_issue_380_experiment_templates.pyChecklist
contracts/schemas/and the experiment loader are untouched, and the templates only use them. No executable or runtime adoption is claimed: nothing admits, schedules, or runs these plans.feat(examples), because the new templates are user-visible.examples/README.mdanddocs/explain/getting-started.mddescribe the templates.Documentation
Updated:
examples/README.md(library table, metadata table, "Task, run, and study entries", template boundary) and one table cell indocs/explain/getting-started.md.