Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help


id: compile kind: intent checked_against_core: clear statement: “THE Compile transition SHALL translate a linted-and-covered spec file’s Constraints table, Model section, and Properties table into a TOML document, a TLA+ module, and a set of proptest! blocks respectively, without dropping or altering any id.”

Compile

specodelic.md names compile as the transition from linted to compiled, gated on coverage and law_requires_cases, but never specifies what compiling actually produces (STATUS.md §4, P0). This file is that specification: Compile is the functor Set^𝒦 → TOML (constraints), Set^𝒦 → TLA+ (the model), and Set^𝒦 → proptest! (properties) that STATUS.md §1 describes — one functor with three target categories, not three unrelated tools that happen to run at the same pipeline stage.

Purpose

specodelic.md names compile as the transition from linted to compiled, gated on coverage and law_requires_cases, but never specifies what compiling actually produces (STATUS.md §4, P0). This file is that specification: Compile is the functor Set^𝒦 → TOML (constraints), Set^𝒦 → TLA+ (the model), and Set^𝒦 → proptest! (properties) that STATUS.md §1 describes — one functor with three target categories, not three unrelated tools that happen to run at the same pipeline stage.

Notes

This file is what makes specodelic.md’s rename_naturality law fully stated. That property’s naturality case reads compile(rename(I)) == rename(compile(I)) — until now that referenced a compile function with no specification of its own, so the claim was unfalsifiable in practice even though it was written down. With constraint_table_to_toml, model_to_tla, and properties_to_proptest now pinned down field-for-field, compile(·) in that law means something concrete: three specific, checkable translations, not an unnamed black box.

compile_is_total’s “never a silent partial result” is the reason extracting/emitting are split into two states rather than one: a failure during extraction (a malformed Constraint/Model/Property row) and a failure during emission (the three extracted representations don’t agree well enough to produce one coherent output — e.g. a Transition’s guard references a Constraint id that extraction resolved but the TOML and TLA+ passes disagree about its type) are different failure classes, and collapsing them into one failed transition would have been the same God-transition pattern specodelic.md Revision 2 already removed from lint.

Updated for specodelic.md Revision 6: model_to_tla now also compiles a State’s optional emits field into a small Output function alongside Next — the piece that turns a compiled automaton into a compiled Moore machine. This is additive to the existing translation, not a restructuring of it: a Model with no emits fields anywhere compiles exactly as before, Output is simply empty.

checked_against_core: clear (see AGENTS.md’s convention) — every constraint here traces to this file’s own intent rather than to a top-level invariant, the same shape linter-frontmatter.md through linter-coverage.md use for constraints scoped entirely to one feature.

The .tla module is a product of compile alone, not of any checker choice. model_check may run a native interpreter backend that never reads the module (see model_check.md’s Notes on backends), but the module is still emitted: it is the human-reviewable, engine-portable form of the compiled model, and TLC — the opt-in reference engine — consumes it directly. Correspondingly the corpus language no longer offers “or Alloy”: with a native default backend and a reference TLA+ engine it had no remaining role, and dropping it keeps model_to_tla a single, fully specified translation.

model_check and verify (STATUS.md §4, both now done — see model_check.md and verify.md) both consume this file’s output directly: model_check runs a model-check backend against the TLA+ module model_to_tla produces, and verify runs the proptest! blocks properties_to_proptest produces — each specified in its own checker file.

Executable predicate fragments (specodelic.md Revision 15, specodelic-rjb). Every predicate and expr cell may now opt into executable translation with a **rust:** marker — the cell text after the marker is a Rust boolean expression, emitted verbatim, no mini-language in between. This closes the gap the compile functor shipped with: a predicate was compiled to a todo_predicate! placeholder that compiles and panics at execution, so verify’s properties gate failed honestly but could never pass. The four rejection rows keep the marker honest: a fragment on a law row, a non-invariant Constraint, or a Transition guard is a labeled extraction failure, not a silently ignored marker (guards have no binding over the program-counter model — deferred of record). Revision 21 narrows the law-row arm of that sentence: a law row’s fragment is accepted exactly when it is a per-case body (below) — every other law-row fragment is still a labeled extraction failure. fragment_hygiene is the security/totality guard, deliberately defense-in-depth rather than a sandbox: fragments run on the invoking user’s machine with the invoking user’s privileges, the same trust every compiled artifact already had — the banned-token list catches the escape hatches a table cell should never legitimately need. The scaffolding’s element type is now String (the GenVal tuple-struct wrapper retired in the same Revision) so fragments bind plain generator values — the wrapper existed only to carry the placeholder story, and fragments make that story optional.

The closed language-tag grammar (specodelic.md Revision 16, specodelic-lf3). The opt-in marker’s tag is drawn from the closed set {rust, py, ts}; a marker is ** + a tag-shaped label + :** where the tag matches [a-z][a-z0-9_-]* — the lowercase-initial shape is what separates a marker from ordinary bold prose (**Note:** stays prose). Acceptance is grammar-level and emitter-independent: **py:** and **ts:** extract like **rust:**, but gate compile labeled (no_emitter_labeled_failure) until their emitters land, since an accepted tag without an emitter would silently fall through to Rust — the vacuous outcome the closed set exists to prevent. A tag-shaped marker outside the closed set fails labeled, naming the tag and the closed set (unknown_tag_rejected). The one grammar collision is resolved by row kind: a law-kind predicate’s **label:** occurrences are the law-case grammar (Revision 13), never fragment markers, so the fragment grammar exempts law rows; every other fragment-position occurrence is checked.

Per-case bodies on law-kind rows (specodelic.md Revision 21, specodelic-1nhe). A law Property row names its cases as **name:** labels, and Revision 21 lets each of those cases carry its own executable body: a case key — **name::** — immediately followed by the fragment marker in fragment position, as **identity::** `**rust:** v0.len() >= 1` . The body is emitted verbatim as that case’s block body; a case with no body keeps the todo_predicate! placeholder. The labels stay the enumeration of record — a body never adds a case — and the shared parser (law.rs) is what keeps the linter’s law_cases rule and the compiler’s block expansion from disagreeing on what a case is. The closed tag set, the fragment-position rule, the hygiene list and the mention-vs-extraction rule are untouched: a per-case body is a fragment like any other, so **rust:** is never a case label, and a marker outside fragment position is still only a mention.

Two binding layers, one per tool, never merged (decision of record 2026-10-04, specodelic-lf3 — corrected review finding CORR-001, design openspec/changes/add-language-neutral-property-binding D3): the artifact’s // id: / // case: metadata comments and contract-TOML flags are not two spellings of one neutral ABI. The comments key per-block verdicts inside a specodelic artifact — properties_to_proptest emits them, properties_to_proptest’s own metadata comments key them, and nothing outside this file’s emission consumes them. Contract-TOML flags bind existing tests — pytest node ids, shell escape hatches — to scenarios, which is espectacular’s layer and stays there. Ownership: compile.md owns fragment extraction and artifact emission (the closed-tag grammar above); espectacular owns contract binding of existing tests (its [runners] config, already shipped — no parallel registry is built here, CORR-002); specodelic.md owns the format grammar (Revision 16’s closed set). Nothing in this file consumes or produces espectacular contract binding — merging the layers would couple scaffold execution policy to contract-binding policy with different wall-clock, caching, and toolchain stories.

Constraints

idkindexprtraces_tosatisfies
precondition_satisfiedinvariantCompile only runs on a file that has passed both lint and coverage — restates [[specodelic.compile]]’s own guard (transition, not row)[[compile]]
constraint_table_to_tomlinvariantevery Constraint row compiles to one TOML table entry {id, kind, expr, traces_to}, field-for-field, with no lossy transformation[[compile]]
model_to_tlainvariantthe Model section compiles to one TLA+ module — always emitted, regardless of which model_check backend (native stateright or TLC) later runs against the model: the module opens with a single-line TLA+ module header (dashes + MODULE name + dashes — the only form an engine parses); each State becomes a value in the module's state variable's range, each Transition becomes one disjunct of the Next action guarded by its guard field, and one closing stuttering disjunct (UNCHANGED vpc) ends Next — guards travel as prose comments, so a terminal state must not read as an engine-side deadlock; a State with an emitsfield additionally becomes one entry in anOutputfunction from that state value to the effect-kind Constraint'sexpr— absent for a state with noemits, never a default/null entry[[compile]]
properties_to_proptestinvarianteach Property row compiles to one proptest! block: generator becomes the block's input strategy, predicate becomes its assertion body — verbatim as a **rust:** fragment when the row opts in ([[compile.predicate_fragment_opt_in]]), else the un-translated todo_predicate! placeholder that compiles here and fails only at execution; a law-kind property compiles to one block per case enumerated in its predicate's **name:** case labels (the identity and associativity floor is lint-enforced ahead of compile, specodelic.md Revision 13) — Revision 21 gives each case its own body: the case's per-case body (a fragment marker under the case's key name::) becomes that case's block body verbatim, and a case with no body keeps the todo_predicate! placeholder[[compile]]
predicate_fragment_opt_ininvarianta Property's predicate cell may opt into executable translation with exactly one **rust:** marker and a non-empty fragment after it — the fragment is a Rust boolean expression emitted verbatim as the block's assertion body, the cell text after the marker — to the cell's end or the code span's closing backtick — is the fragment, binding the block's generated values (v0…, one per generator named in the generator cell, each a String); the marker opts in only in fragment position — starting the cell or immediately opening the fragment's code span, a backtick directly before it — an occurrence anywhere else (mid-span, as in the defining rows of this very table, or in prose between spans) is a mention of the mechanism and never extracts (specodelic-sd1); a cell with no marker compiles exactly as before (the placeholder) — pure widening, nothing valid before this Revision is invalidated; a law-kind Property row's predicate cell is the one cell that carries more than one marker: one per named case, each under its case key (name::), the case labels themselves staying the law-case grammar and never fragment markers (specodelic.md Revision 21)[[compile]]
invariant_fragment_opt_ininvarianta Constraint's expr cell may carry the same **rust:** fragment when the row's kind is invariant, under the same fragment-position rule as [[compile.predicate_fragment_opt_in]] — the fragment becomes an executable invariant model_check's native backend executes (model_check.md Revision 15); a fragment on a Constraint of any other kind (effect, advisory, a pack fiber kind) is a labeled extraction failure, never a silently ignored marker[[compile]]
fragment_law_rejectedinvarianta law-kind Property row's predicate cell carries at most one executable body per named case, each written under its case key (name::) — each required case needs its own assertion body and one fragment cannot honestly serve several named cases; a fragment that no case key introduces, a second body for one case, a body naming a case the row does not enumerate, an empty body, and a case key that introduces no body are each a labeled extraction failure naming the case, and a case key on a non-law row is rejected the same way — the per-case body grammar is law-only (specodelic.md Revision 21)[[compile]]
fragment_guard_rejectedinvarianta Transition's guard cell must not carry a **rust:** fragment in this Revision — the program-counter model has no data binding a guard could constrain, so executable guards have no defined semantics; violation is a labeled extraction failure, never a silently ignored marker (decision of record: deferred to a future Revision alongside a data-carrying state space)[[compile]]
fragment_language_closedinvariantthe executable-fragment tag set is closed: a cell in fragment position may carry exactly one **rust:**, **py:**, or **ts:** marker per the grammar below — one per cell, except a law-kind Property row's predicate cell, which carries one marker per named case (specodelic.md Revision 21) — the same closed-set discipline as [[specodelic.property_kind_closed]] and [[specodelic.constraint_kind_closed]]; the fragment-position rule and the non-empty-fragment requirement carry over verbatim per tag, and **rust:** remains the fully specified case with byte-identical semantics (widening [[compile.predicate_fragment_opt_in]]/[[compile.invariant_fragment_opt_in]]'s grammar; specodelic-lf3 Revision 16)[[compile]]
unknown_tag_rejectedinvarianta marker in fragment position whose tag is not in the closed set — **go:**, **java:**, any non-member — is a labeled extraction failure naming the unknown tag and the closed set, never a silently ignored marker (sd1's no-silent-markers discipline carried into the widened grammar; specodelic-lf3 Revision 16)[[compile]]
kernel_expr_opt_ininvariantan expr cell may opt into kernel translation per cell with exactly one **kernel:** marker and a non-empty kernel expression after it, under the same fragment-position rule as [[compile.predicate_fragment_opt_in]] — the expression is parsed against the closed atomic grammar (equality, comparisons, bounded ∀/∃ over the finite instances, ∧/¬, and the reference-typed atomics resolves/unique/acyclic/reachable; the closed set's name is kernel_grammar_closed) and evaluates three-valued per model_check.md; an expression using a non-member atomic fails labeled naming the atomic and the closed set — never prose, never silently ignored; a cell without the marker compiles exactly as before (pure widening, nothing valid before this Revision is invalidated; add-min-expr-kernel Revision 17)[[compile]]
kernel_binding_opaqueinvariantan invariant-kind Constraint's kernel.binding cell extracts as an opaque string surfaced verbatim in the compiled Constraints artifact — no parse, no validation, no interpretation of its internals by the toolchain — and the claim path for an external checker is its contract-TOML flags binding (a test node id, a filter expression, or a shell command payload), not a toolchain registry; a row with no binding column compiles exactly as before (design D4, add-min-expr-kernel Revision 17)[[compile]]
rust_back_compatinvariantevery cell that extracted a **rust:** fragment under Revision 15's grammar extracts a byte-identical fragment under the widened grammar, and a cell without any marker compiles exactly as before — pure widening, nothing valid at Revision 15 is invalidated (specodelic-lf3 Revision 16)[[compile]]
no_emitter_labeled_failureinvarianta **py:** or **ts:** fragment in fragment position fails compile labeled, with a remediation hint naming the per-language emitter follow-up — executable emission for those languages is deferred of record (specodelic-lf3 Revision 16, follow-ups add-py-fragment-emission/add-ts-fragment-emission); an accepted tag without an emitter would silently fall through to Rust, the vacuous outcome the closed set exists to prevent[[compile]]
mention_not_extractioninvarianta **rust:**/**py:**/**ts:** occurrence anywhere other than fragment position — mid-span, as in the defining rows of this very table, or in prose between spans — is a mention of the mechanism and never extracts (sd1's rule carried into the widened grammar; specodelic-lf3 Revision 16)[[compile]]
fragment_hygieneinvarianta fragment's text must not contain unsafe, extern, include!, include_str!, include_bytes!, std::fs, std::process, std::net, std::env, asm!, or Command — defense-in-depth against a fragment escaping its artifact's role (fragments run on the invoking user's machine with the invoking user's privileges, exactly like every other compiled artifact; the Rust compiler is not a sandbox); violation is a labeled extraction failure naming the token[[compile]]
compile_is_totalinvariant∀ file that has passed lint and coverage: Compile either produces all three artifacts or reports, for exactly one of them, which stage failed and why — it never returns a silent partial result[[compile]]
compile_preserves_idsinvariantevery id present in the source file appears, unchanged, in at least one compiled artifact — no id is silently dropped in translation[[compile]]
no_semantic_driftinvariantre-parsing a compiled artifact and re-emitting it yields output identical to the original compile — Compile is idempotent under its own round trip[[compile]]
artifact_stem_uniqueinvariant∀ literal compile invocation: two distinct collected files never produce one artifact stem — a corpus whose files collide is refused up front with the label duplicate_artifact_stem, naming both colliding file paths and a remediation hint, before lint, before every artifact write, and before the out-dir exists; a corpus whose stems are unique compiles unchanged, and one path collected twice (repeated argument or overlapping roots) is one file with one artifact set, never a collision[[compile]]
scope_refusal_envelopeinvarianta duplicate-stem refusal rides the error envelope: the label names both colliding files, the remediation hint names the escape (rename one file or compile in separate --out-dir runs), exit is 2, zero artifacts are reported or written, and every parse/hostile-input note collected while building the corpus is re-attached to the refusal envelope — an early refusal never swallows a skipped file's note[[compile]]
extraction_failureeffectcompile.extraction_failure(row_id, reason) — the extraction stage failed on row row_id because reason; the failure rides the errors capability's published error contract (envelope kind, exit code, remediation hint)[[compile]][[errors.envelope_error_kind]] ∧ [[errors.exit_code_mapping]] ∧ [[errors.remediation_hint_present]]
emission_failureeffectcompile.emission_failure(detail) — the emission stage failed because detail; the failure rides the errors capability's published error contract (envelope kind, exit code, remediation hint)[[compile]][[errors.envelope_error_kind]] ∧ [[errors.exit_code_mapping]] ∧ [[errors.remediation_hint_present]]
shared_fragment_defsinvarianta spec file MAY carry an optional ## Fragments section of def <name>: lines each followed by a fenced rust body; any fragment cell in the same file MAY reference a definition by the @name token, and compile SHALL inline each referenced definition's body at every use site as a ({ <items> <name> }) block expression — per-row blocks stay self-contained (the inline-not-shared-module decision of record; add-shared-fragment-helpers)[[compile]]
helper_reference_resolvesinvariantan @name reference naming no def in the file's ## Fragments section fails compile labeled at fragment_extraction, naming the unresolved reference — and a malformed or duplicate def line fails labeled the same way; never a silently ignored marker[[compile]]
helper_collision_labeledinvarianta def name colliding with a generated symbol — spec_gen, todo_predicate, an emitted block fn, or the v0, v1, … strategy-binding namespace — fails compile labeled naming both symbols; never a silent shadow[[compile]]
helper_hygiene_inheritedinvarianta def body containing a fragment_hygiene banned token fails compile labeled naming the token — helper bodies inherit the fragment token ban verbatim, documented imprecision included (defense-in-depth, not a sandbox)[[compile]]
helper_cycle_labeledinvariantdefinitions referencing each other in a cycle fail compile labeled naming the cycle — inlining terminates by construction; an acyclic chain (a fragment references a helper that references another) inlines fully at the use site[[compile]]
dead_helper_warnsadvisorya def reachable from no fragment cell — directly or transitively — is reported as a dead-helper warning on the compile warnings channel, and compile still succeeds: a warning, never a failure[[compile]]
fragments_section_opaqueinvariantthe linter treats ## Fragments as opaque prose — the section carries no frontmatter, tables, or typed references and disturbs no gating rule — and a file without the section compiles byte-identically to the pre-change compiler's output (pure widening)[[compile]]

Model

States

  • not_started
  • extracting
  • emitting
  • compiled
  • extract_failed (emits: [[compile.extraction_failure]])
  • emit_failed (emits: [[compile.emission_failure]])

Transitions

idfromtoguard
beginnot_startedextracting[[compile.precondition_satisfied]] ∧ [[compile.artifact_stem_unique]]
extract_okextractingemitting[[compile.constraint_table_to_toml]] ∧ [[compile.model_to_tla]] ∧ [[compile.properties_to_proptest]]
extract_failextractingextract_failed¬([[compile.constraint_table_to_toml]] ∧ [[compile.model_to_tla]] ∧ [[compile.properties_to_proptest]])
acceptemittingcompiled[[compile.compile_preserves_ids]] ∧ [[compile.no_semantic_drift]]
rejectemittingemit_failed¬([[compile.compile_preserves_ids]] ∧ [[compile.no_semantic_drift]])

Properties

idkindderives_fromgeneratorpredicate
precondition_violation_rejectedunit[[compile.precondition_satisfied]]file_that_has_not_passed_lint()**rust:** { let mut spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); spec.path = Some(std::path::PathBuf::from("file_that_has_not_passed_lint.md")); let report = specodelic::lint::lint_corpus(std::slice::from_ref(&spec)); match specodelic::compile::precondition_satisfied(&spec, &report) { Err(err) => err.stage == "precondition_satisfied" && err.message.contains("lint finding"), Ok(()) => false } } — check(file) == failed — the fixture is given its file identity so the lint labels the finding the way the CLI labels a file on disk
toml_roundtripsunit[[compile.constraint_table_to_toml]]arbitrary_constraint_row()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let doc = specodelic::compile::constraints_to_toml(&spec); let row = spec.constraints.first().expect("the fixture carries a Constraint row"); let cells = row.cells.clone(); let entry = format!("id = {:?}\nkind = {:?}\nexpr = {:?}\ntraces_to = {:?}\n", cells.get("id").cloned().unwrap_or_default(), cells.get("kind").cloned().unwrap_or_default(), cells.get("expr").cloned().unwrap_or_default(), cells.get("traces_to").cloned().unwrap_or_default()); doc.contains(&entry) && doc.matches("[[constraints]]").count() == 1 && specodelic::compile::compile_spec(&spec).is_ok() } — parse_toml(compile(row)) == row
tla_disjunct_count_matchesunit[[compile.model_to_tla]]arbitrary_model_section(n_transitions)**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let tla = specodelic::compile::model_to_tla(&spec); let next = tla.split("Next ==").nth(1).expect("the module carries a Next action"); let mut disjuncts = 0usize; for line in next.lines() { if line.trim_start().starts_with("\\/") { disjuncts += 1; } } disjuncts == spec.transitions.len() + 1 } — count(disjuncts(compile(model).Next)) == n_transitions + 1 — the closing stuttering disjunct
output_function_covers_emitting_states_onlyunit[[compile.model_to_tla]]arbitrary_model_section(n_states_with_emits, n_states_without)**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let tla = specodelic::compile::model_to_tla(&spec); let out = tla.split("Output ==").nth(1).expect("the module carries an Output function"); let body = out.split("====").next().unwrap_or_default(); let ir = specodelic::compile::extract_model_ir(&spec); let mut expected: Vec<String> = vec![]; for state in &spec.states { if state.cells.get("emits").is_some() { expected.push(state.id.clone()); } } let mut keys: Vec<String> = vec![]; for line in body.lines() { let trimmed = line.trim(); if trimmed.is_empty() { continue; } if let Some((key, _value)) = trimmed.split_once(" :> ") { keys.push(key.trim().trim_matches('"').to_string()); } } let mut values_ok = true; for (state, value) in &ir.emits_values { if !body.contains(&format!("{:?} :> {:?}", state, value)) { values_ok = false; } } keys == expected && values_ok && ir.emits.len() == expected.len() } — domain(compile(model).Output) == the_states_with_emits — no entry for the rest
proptest_block_per_propertyunit[[compile.properties_to_proptest]]property_row_with_one_property()**rust:** specodelic::verify::blocks_from_source(&specodelic::compile::properties_to_proptest(&specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"))).len() >= 1
law_property_compiles_required_casesunit[[compile.properties_to_proptest]]law_property_row_with(cases: ["identity", "associativity"])**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let row = spec.properties.first().expect("the fixture carries a Property row"); let predicate = row.cells.get("predicate").cloned().unwrap_or_default(); let src = specodelic::compile::properties_to_proptest(&spec); let blocks = specodelic::verify::blocks_from_source(&src); let mut cases = 0usize; for block in &blocks { if block.case.is_some() { cases += 1; } } let mut labels = 0usize; for label in ["**identity:**", "**associativity:**"] { if predicate.contains(label) { labels += 1; } } blocks.len() == cases && cases == 2 && labels == 2 } — count(compile(row).blocks) == 2
compile_completes_or_fails_cleanlyunit[[compile.compile_is_total]]arbitrary_linted_and_covered_file()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Ok(compiled) => !compiled.toml.is_empty() && !compiled.props.is_empty() && !compiled.tla.is_empty(), Err(err) => !err.stage.is_empty() && !err.message.is_empty() } } — compile(file) ∈ {all_three_artifacts, single_labeled_failure} — never partial
id_preservation_holdsunit[[compile.compile_preserves_ids]]arbitrary_linted_and_covered_file()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let compiled = specodelic::compile::compile_spec(&spec).expect("the fixture compiles"); let mut artifact_ids: Vec<String> = vec![]; for line in compiled.props.lines() { let trimmed = line.trim(); if let Some(rest) = trimmed.strip_prefix("// id: ") { artifact_ids.push(rest.trim().to_string()); } } for line in compiled.toml.lines() { let trimmed = line.trim(); if let Some(rest) = trimmed.strip_prefix("id = ") { artifact_ids.push(rest.trim().trim_matches('"').to_string()); } } let mut ok = compiled.toml.contains(&format!("source = {:?}", spec.intent.id)); for id in spec.defined_ids() { if !artifact_ids.contains(&id) && !compiled.tla.contains(id.as_str()) { ok = false; } } ok } — ids_in(file) ⊆ ids_in(compile(file))
roundtrip_stableunit[[compile.no_semantic_drift]]arbitrary_linted_and_covered_file()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let first = specodelic::compile::compile_spec(&spec).expect("the fixture compiles"); let reparsed = specodelic::spec::parse_str(&v0).expect("the fixture parses again"); let second = specodelic::compile::compile_spec(&reparsed).expect("the fixture compiles again"); first.toml == second.toml && first.props == second.props && first.tla == second.tla } — compile(file) == compile(parse(compile(file))) — the executable form re-parses the spec text and compiles again, comparing the three artifacts byte for byte; the tool exposes no re-parse of a compiled artifact, so that half of the round trip is checked at the spec level
extraction_failure_label_assertedunit[[compile.extraction_failure]]extraction_stage_fails_on_row()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "fragment_extraction" && err.message.contains("p_empty_fragment") && err.message.contains("row"), Ok(_) => false } } — error_label == "compile.extraction_failure" — renaming the label touches the error Constraint, this property, and its note together (EDGE-002)
emission_failure_label_assertedunit[[compile.emission_failure]]emission_stage_fails()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "compile.emission_failure" && err.message.contains("add-py-fragment-emission"), Ok(_) => false } } — error_label == "compile.emission_failure" — same three-site rename rule (EDGE-002)
fragment_body_emitted_verbatimunit[[compile.predicate_fragment_opt_in]]property_row_with_rust_fragment()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let row = spec.properties.first().expect("the fixture carries a Property row"); let cell = row.cells.get("predicate").cloned().unwrap_or_default(); let fragment = specodelic::compile::fragment_of_strict(&cell).expect("the predicate parses").expect("the predicate carries a fragment"); let src = specodelic::compile::properties_to_proptest(&spec); src.contains(&fragment.text) } — the emitted block body contains the fragment verbatim
prose_predicate_stays_placeholderunit[[compile.predicate_fragment_opt_in]]property_row_without_fragment()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let row = spec.properties.first().expect("the fixture carries a Property row"); let cell = row.cells.get("predicate").cloned().unwrap_or_default(); let src = specodelic::compile::properties_to_proptest(&spec); specodelic::compile::fragment_of_strict(&cell).expect("the predicate parses").is_none() && src.contains("todo_predicate!") } — compile(row).body contains todo_predicate! — no widening of pre-Revision behavior
fragment_values_bind_generatorsunit[[compile.predicate_fragment_opt_in]]property_row_with_two_generators()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let row = spec.properties.first().expect("the fixture carries a Property row"); let cell = row.cells.get("generator").cloned().unwrap_or_default(); let src = specodelic::compile::properties_to_proptest(&spec); let mut names: Vec<String> = vec![]; for part in cell.split(',') { let name = part.trim().trim_matches('\u{60}').trim().trim_end_matches("()").trim().to_string(); if !name.is_empty() { names.push(name); } } let mut bound = 0usize; for name in &names { if src.contains(&format!("spec_gen::{}()", name)) { bound += 1; } } let mut args = 0usize; for line in src.lines() { if line.contains("v0 in spec_gen::") { args = line.matches(", v").count() + 1; } } names.len() == 2 && bound == 2 && args == 2 && src.contains("Value = String") } — the emitted block’s args are v0, v1 — one per named generator, each a String
rust_fragment_semantics_unchangedunit[[compile.rust_back_compat]]revision_15_rust_fragment_cell()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let row = spec.properties.first().expect("the fixture carries a Property row"); let cell = row.cells.get("predicate").cloned().unwrap_or_default(); let fragment = specodelic::compile::fragment_of_strict(&cell).expect("the predicate parses").expect("the predicate carries a fragment"); let after = cell.split("**rust:**").nth(1).expect("the cell carries the marker"); let expected = after.split('\u{60}').next().unwrap_or_default().trim(); fragment.text == expected && fragment.lang == specodelic::compile::FragmentLang::Rust } — extract(cell) == revision_15_extract(cell) — byte-identical, pure widening
unknown_tag_labeledunit[[compile.unknown_tag_rejected]]property_row_with_marker_tag("**go:")**rust:** { let mut spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let mut only_go: Vec<specodelic::spec::Row> = vec![]; for row in &spec.properties { if row.id == "p_go_tag" { only_go.push(row.clone()); } } spec.properties = only_go; match specodelic::compile::validate_fragments(&spec) { Err(err) => err.stage == "fragment_extraction" && err.message.contains("go") && err.message.contains("rust, py, ts"), Ok(()) => false } } — error_stage == fragment_extraction ∧ message names the tag and the closed set
non_fragment_tag_is_mentionunit[[compile.mention_not_extraction]]property_row_with_mid_span_marker_tag("**py:")**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let row = spec.properties.first().expect("the fixture carries a Property row"); let cell = row.cells.get("predicate").cloned().unwrap_or_default(); let compiled = specodelic::compile::compile_spec(&spec).expect("the fixture compiles — the mid-span mention never extracts"); specodelic::compile::fragment_of_strict(&cell).expect("the predicate parses").is_none() && compiled.props.contains("todo_predicate!") } — compile(row) == compile(row_without_marker) — mid-span occurrence never extracts
one_tag_extracts_per_cellunit[[compile.fragment_language_closed]]property_row_with_marker_tag("**py:")**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let mut extracted = 0usize; let mut tag = ""; for row in &spec.properties { let cell = row.cells.get("predicate").cloned().unwrap_or_default(); if let Ok(Some(fragment)) = specodelic::compile::fragment_of_strict(&cell) { extracted += 1; tag = fragment.lang.tag(); } } extracted == 1 && tag == "py" } — extract(cell) == Some(fragment_under("py")) — a fragment-position cell extracts under exactly one tag from the closed set {rust, py, ts}; acceptance is grammar-level and emitter-independent
missing_emitter_labeledunit[[compile.no_emitter_labeled_failure]]property_row_with_marker_tag("**py:")**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "compile.emission_failure" && err.message.contains("add-py-fragment-emission") && err.message.contains("py"), Ok(_) => false } } — error_label == "compile.emission_failure" ∧ the remediation hint names the per-language emitter follow-up — never a silent fall-through to Rust emission
law_fragment_labeledunit[[compile.fragment_law_rejected]]law_row_with_fragment()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "fragment_extraction" && err.message.contains("law"), Ok(_) => false } } — error_stage == fragment_extraction
hygiene_violation_labeledunit[[compile.fragment_hygiene]]fragment_with(banned_token: "std::fs")**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "fragment_extraction" && err.message.contains(&["std", "fs"].join("::")), Ok(_) => false } } — the banned token is assembled from its parts so this fragment stays hygiene-clean itself — error_stage == fragment_extraction ∧ message names the token
guard_fragment_labeledunit[[compile.fragment_guard_rejected]]transition_row_with_fragment_guard()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "fragment_extraction" && err.message.contains("guard"), Ok(_) => false } } — error_stage == fragment_extraction
non_invariant_fragment_labeledunit[[compile.invariant_fragment_opt_in]]effect_row_with_fragment()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "fragment_extraction" && err.message.contains("invariant"), Ok(_) => false } } — error_stage == fragment_extraction
kernel_expr_extractsunit[[compile.kernel_expr_opt_in]]invariant_cell_with_kernel_marker()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let row = spec.constraints.first().expect("the fixture carries a Constraint row"); let cell = row.cells.get("expr").cloned().unwrap_or_default(); let expr = specodelic::kernel::parse_kernel_expr(&cell).expect("the kernel expression parses under the closed grammar").expect("the cell opts into kernel translation"); let env = specodelic::kernel::KernelEnv::from_specs(std::slice::from_ref(&spec)); let value = env.evaluate(&expr); matches!(value, specodelic::compile::ThreeValued::Verified) } — the expression extracts under the closed grammar and evaluates to exactly one of verified, counterexample, unknown
kernel_nonmember_labeledunit[[compile.kernel_expr_opt_in]]invariant_cell_with_nonmember_atomic()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "kernel_grammar" && err.message.contains("frobnicate"), Ok(_) => false } } — error_stage == kernel_grammar ∧ the message names the offending atomic and the closed set
binding_text_surfaces_verbatimunit[[compile.kernel_binding_opaque]]constraint_row_with_arbitrary_binding_text()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let row = spec.constraints.first().expect("the fixture carries a Constraint row"); let binding = row.cells.get("kernel.binding").cloned().unwrap_or_default().trim().trim_matches('\u{60}').to_string(); let doc = specodelic::compile::constraints_to_toml(&spec); doc.contains(&format!("binding = {:?}", binding)) } — the compiled TOML carries the binding cell text verbatim — no interpretation, no validation of its internals
claim_path_is_flagsunit[[compile.kernel_binding_opaque]]external_checker_claiming_a_constraint()**rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let row = spec.constraints.first().expect("the fixture carries a Constraint row"); let binding = row.cells.get("kernel.binding").cloned().unwrap_or_default().trim().trim_matches('\u{60}').to_string(); let compiled = specodelic::compile::compile_spec(&spec).expect("the fixture compiles — the binding text is opaque, never interpreted"); compiled.toml.contains(&format!("binding = {:?}", binding)) && !compiled.props.contains(&binding) && !compiled.tla.contains(&binding) } — the claim is carried by contract-TOML flags binding; the toolchain builds no registry

| helper_inlines_at_each_use_site | unit | [[compile.shared_fragment_defs]] | spec_with_one_helper_and_two_referencing_fragments() | **rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let src = specodelic::compile::properties_to_proptest(&spec); let mut bodies = 0usize; let mut stray = 0usize; for line in src.lines() { if line.contains("fn shared_helper") { bodies += 1; } if line.contains(&format!("@{}", "shared_helper")) && !line.trim_start().starts_with("// predicate:") { stray += 1; } } bodies == 2 && stray == 0 } — the helper body appears in the emitted props artifact once per use site, and no @name marker survives outside the verbatim row-quote metadata comments | | unknown_helper_reference_labeled | unit | [[compile.helper_reference_resolves]] | property_fragment_referencing("@ghost(&v0)") | **rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "fragment_extraction" && err.message.contains("ghost"), Ok(_) => false } } — error_stage == fragment_extraction ∧ the message names the unresolved reference | | helper_collision_labeled_asserted | unit | [[compile.helper_collision_labeled]] | helper_named("v0") | **rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "fragment_extraction" && err.message.contains("v0") && err.message.contains("strategy-binding namespace"), Ok(_) => false } } — error_stage == fragment_extraction ∧ the message names both the helper and the generated symbol | | helper_hygiene_labeled | unit | [[compile.helper_hygiene_inherited]] | helper_body_with(banned_token: "std::fs") | **rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "fragment_extraction" && err.message.contains(&["std", "fs"].join("::")) && err.message.contains("fragment_hygiene"), Ok(_) => false } } — the banned token is assembled from its parts so this fragment stays hygiene-clean itself — error_stage == fragment_extraction ∧ the message names the token and the fragment_hygiene rule | | helper_cycle_labeled_asserted | unit | [[compile.helper_cycle_labeled]] | mutually_referencing_helpers("is_a", "is_b") | **rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); match specodelic::compile::compile_spec(&spec) { Err(err) => err.stage == "fragment_extraction" && err.message.contains("is_a") && err.message.contains("is_b"), Ok(_) => false } } — error_stage == fragment_extraction ∧ the message names the cycle; a transitive acyclic chain inlines all bodies at the use site | | dead_helper_warns_asserted | unit | [[compile.dead_helper_warns]] | spec_with_an_unreferenced_def() | **rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let compiled = specodelic::compile::compile_spec(&spec).expect("the fixture compiles — a dead helper warns, never fails"); let mut named = 0usize; for warning in &compiled.warnings { if warning.contains("unused_helper") { named += 1; } } named == 1 && compiled.warnings.len() == 1 } — compile succeeds ∧ the warnings channel names the dead def ∧ referenced defs are not warned | | absent_section_preserves_bytes_p | unit | [[compile.fragments_section_opaque]] | linted_and_covered_file_without_a_fragments_section() | **rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let with_text = specodelic::fixtures::materialize("linted_and_covered_file_with_a_fragments_section").expect("the with-section fixture materializes"); let with_section = specodelic::spec::parse_str(&with_text).expect("the with-section fixture parses"); let without = specodelic::compile::compile_spec(&spec).expect("the without-section file compiles"); let with = specodelic::compile::compile_spec(&with_section).expect("the with-section file compiles"); without.toml == with.toml && without.props == with.props && without.tla == with.tla } — every compiled artifact is byte-identical to the pre-change compiler’s output for that file | | fragments_section_lints_clean_p | unit | [[compile.fragments_section_opaque]] | linted_and_covered_file_with_a_fragments_section() | **rust:** { let spec = specodelic::spec::parse_str(&v0).expect("the materialized fixture parses"); let report = specodelic::lint::lint_corpus(std::slice::from_ref(&spec)); report.issues.len() == 0 } — lint issues == 0 — the section is opaque prose, no gating rule disturbed | | duplicate_stem_refused | unit | [[compile.artifact_stem_unique]] | spec_file_named_pipeline() | **rust:** { let a = specodelic::fixtures::specs::materialize("spec_file_named_pipeline").expect("fixture"); let mut sa = specodelic::spec::parse_str(&a).expect("parses"); sa.path = Some(std::path::PathBuf::from("/corpus/a/pipeline.md")); let mut sb = specodelic::spec::parse_str(&a).expect("parses"); sb.path = Some(std::path::PathBuf::from("/corpus/b/pipeline.md")); match specodelic::compile::artifact_stem_collision(&[sa, sb]) { Some((msg, hint)) => msg.contains("duplicate_artifact_stem") && msg.contains("/corpus/a/pipeline.md") && msg.contains("/corpus/b/pipeline.md") && hint.contains("rename"), None => false } } | | unique_stems_compile | unit | [[compile.artifact_stem_unique]] | spec_file_named_alpha() | **rust:** { let a = specodelic::fixtures::specs::materialize("spec_file_named_pipeline").expect("fixture"); let b = specodelic::fixtures::specs::materialize("spec_file_named_alpha").expect("fixture"); let mut sa = specodelic::spec::parse_str(&a).expect("parses"); sa.path = Some(std::path::PathBuf::from("/corpus/a/pipeline.md")); let mut sb = specodelic::spec::parse_str(&b).expect("parses"); sb.path = Some(std::path::PathBuf::from("/corpus/b/alpha.md")); specodelic::compile::artifact_stem_collision(&[sa, sb]).is_none() } | | repeated_path_is_one_file | unit | [[compile.artifact_stem_unique]] | spec_file_named_alpha() | **rust:** { let a = specodelic::fixtures::specs::materialize("spec_file_named_alpha").expect("fixture"); let mut sa = specodelic::spec::parse_str(&a).expect("parses"); sa.path = Some(std::path::PathBuf::from("/corpus/alpha.md")); let mut sb = specodelic::spec::parse_str(&a).expect("parses"); sb.path = Some(std::path::PathBuf::from("/corpus/alpha.md")); specodelic::compile::artifact_stem_collision(&[sa, sb]).is_none() } | | refusal_names_label_and_remediation | unit | [[compile.scope_refusal_envelope]] | spec_file_named_pipeline() | **rust:** { let a = specodelic::fixtures::specs::materialize("spec_file_named_pipeline").expect("fixture"); let mut sa = specodelic::spec::parse_str(&a).expect("parses"); sa.path = Some(std::path::PathBuf::from("/corpus/a/pipeline.md")); let mut sb = specodelic::spec::parse_str(&a).expect("parses"); sb.path = Some(std::path::PathBuf::from("/corpus/b/pipeline.md")); match specodelic::compile::artifact_stem_collision(&[sa, sb]) { Some((msg, hint)) => msg.contains("duplicate_artifact_stem") && msg.contains("/corpus/a/pipeline.md") && msg.contains("/corpus/b/pipeline.md") && hint.contains("rename"), None => false } } |

Requirements

Requirement: Property coverage mirror

Every property row SHALL be verified by exactly one dedicated scenario; ah sync SHALL derive one contract per VERIFIES link.

Scenario: precondition_violation_rejected

  • WHEN file_that_has_not_passed_lint()
  • THEN check(file) == failed
  • VERIFIES [[compile.precondition_violation_rejected]]

Scenario: toml_roundtrips

  • WHEN arbitrary_constraint_row()
  • THEN parse_toml(compile(row)) == row
  • VERIFIES [[compile.toml_roundtrips]]

Scenario: tla_disjunct_count_matches

  • WHEN arbitrary_model_section(n_transitions)
  • THEN count(disjuncts(compile(model).Next)) == n_transitions + 1 — the closing stuttering disjunct
  • VERIFIES [[compile.tla_disjunct_count_matches]]

Scenario: output_function_covers_emitting_states_only

  • WHEN arbitrary_model_section(n_states_with_emits, n_states_without)
  • THEN domain(compile(model).Output) == the_states_with_emits — no entry for the rest
  • VERIFIES [[compile.output_function_covers_emitting_states_only]]

Scenario: proptest_block_per_property

  • WHEN property_row_with_one_property() — a materialized fixture, not the generator’s own name
  • THEN count(compile(row).blocks) >= 1 — the compiled **rust:** fragment counts the blocks the real compiler emitted for the fixture
  • VERIFIES [[compile.proptest_block_per_property]]

Scenario: law_property_compiles_required_cases

  • WHEN law_property_row_with(cases: ["identity", "associativity"])
  • THEN count(compile(row).blocks) == 2
  • VERIFIES [[compile.law_property_compiles_required_cases]]

Scenario: compile_completes_or_fails_cleanly

  • WHEN arbitrary_linted_and_covered_file()
  • THEN compile(file) ∈ {all_three_artifacts, single_labeled_failure} — never partial
  • VERIFIES [[compile.compile_completes_or_fails_cleanly]]

Scenario: id_preservation_holds

  • WHEN arbitrary_linted_and_covered_file()
  • THEN ids_in(file) ⊆ ids_in(compile(file))
  • VERIFIES [[compile.id_preservation_holds]]

Scenario: roundtrip_stable

  • WHEN arbitrary_linted_and_covered_file()
  • THEN compile(file) == compile(parse(compile(file)))
  • VERIFIES [[compile.roundtrip_stable]]

Scenario: extraction_failure_label_asserted

  • WHEN extraction_stage_fails_on_row()
  • THEN error_label == "compile.extraction_failure" — renaming the label touches the error Constraint, this property, and its note together (EDGE-002)
  • VERIFIES [[compile.extraction_failure_label_asserted]]

Scenario: emission_failure_label_asserted

  • WHEN emission_stage_fails()
  • THEN error_label == "compile.emission_failure" — same three-site rename rule (EDGE-002)
  • VERIFIES [[compile.emission_failure_label_asserted]]

Scenario: fragment_body_emitted_verbatim

  • WHEN property_row_with_rust_fragment()
  • THEN the emitted block body contains the fragment verbatim
  • VERIFIES [[compile.fragment_body_emitted_verbatim]]

Scenario: prose_predicate_stays_placeholder

  • WHEN property_row_without_fragment()
  • THEN compile(row).body contains todo_predicate! — no widening of pre-Revision behavior
  • VERIFIES [[compile.prose_predicate_stays_placeholder]]

Scenario: fragment_values_bind_generators

  • WHEN property_row_with_two_generators()
  • THEN the emitted block's args are v0, v1 — one per named generator, each a String
  • VERIFIES [[compile.fragment_values_bind_generators]]

Scenario: rust_fragment_semantics_unchanged

  • WHEN revision_15_rust_fragment_cell()
  • THEN extract(cell) == revision_15_extract(cell) — byte-identical, pure widening
  • VERIFIES [[compile.rust_fragment_semantics_unchanged]]

Scenario: unknown_tag_labeled

  • WHEN property_row_with_marker_tag("**go:")
  • THEN error_stage == fragment_extraction ∧ message names the tag and the closed set
  • VERIFIES [[compile.unknown_tag_labeled]]

Scenario: non_fragment_tag_is_mention

  • WHEN property_row_with_mid_span_marker_tag("**py:")
  • THEN compile(row) == compile(row_without_marker) — mid-span occurrence never extracts
  • VERIFIES [[compile.non_fragment_tag_is_mention]]

Scenario: one_tag_extracts_per_cell

  • WHEN property_row_with_marker_tag("**py:")
  • THEN extract(cell) == Some(fragment_under("py")) — a fragment-position cell extracts under exactly one tag from the closed set {rust, py, ts}; acceptance is grammar-level and emitter-independent
  • VERIFIES [[compile.one_tag_extracts_per_cell]]

Scenario: missing_emitter_labeled

  • WHEN property_row_with_marker_tag("**py:")
  • THEN error_label == "compile.emission_failure" ∧ the remediation hint names the per-language emitter follow-up — never a silent fall-through to Rust emission
  • VERIFIES [[compile.missing_emitter_labeled]]

Scenario: law_fragment_labeled

  • WHEN law_row_with_fragment()
  • THEN error_stage == fragment_extraction
  • VERIFIES [[compile.law_fragment_labeled]]

Scenario: hygiene_violation_labeled

  • WHEN fragment_with(banned_token: "std::fs")
  • THEN error_stage == fragment_extraction ∧ message names the token
  • VERIFIES [[compile.hygiene_violation_labeled]]

Scenario: guard_fragment_labeled

  • WHEN transition_row_with_fragment_guard()
  • THEN error_stage == fragment_extraction
  • VERIFIES [[compile.guard_fragment_labeled]]

Scenario: non_invariant_fragment_labeled

  • WHEN effect_row_with_fragment()
  • THEN error_stage == fragment_extraction
  • VERIFIES [[compile.non_invariant_fragment_labeled]]

Scenario: kernel_expr_extracts

  • WHEN invariant_cell_with_kernel_marker()
  • THEN the expression extracts under the closed grammar and evaluates to exactly one of verified, counterexample, unknown
  • VERIFIES [[compile.kernel_expr_extracts]]

Scenario: kernel_nonmember_labeled

  • WHEN invariant_cell_with_nonmember_atomic()
  • THEN error_stage == kernel_grammar ∧ the message names the offending atomic and the closed set
  • VERIFIES [[compile.kernel_nonmember_labeled]]

Scenario: binding_text_surfaces_verbatim

  • WHEN constraint_row_with_arbitrary_binding_text()
  • THEN the compiled TOML carries the binding cell text verbatim — no interpretation, no validation of its internals
  • VERIFIES [[compile.binding_text_surfaces_verbatim]]

Scenario: claim_path_is_flags

  • WHEN external_checker_claiming_a_constraint()
  • THEN the claim is carried by contract-TOML flags binding; the toolchain builds no registry
  • VERIFIES [[compile.claim_path_is_flags]]

Requirement: Shared fragment definitions

A spec file MAY carry an optional ## Fragments section of def-lines (def <name>: followed by a fenced rust body); any fragment cell in the same file MAY reference a definition by name, and compile SHALL inline each referenced definition’s body at every use site. The linter treats the section as opaque prose — it carries no frontmatter, tables, or typed references. Referencing, hygiene, and termination behaviors are specified in the scenarios.

Scenario: Helper inlines at each use site

  • WHEN a file defines one helper and two property fragments reference it
  • THEN each emitted block carries the helper’s body inlined, and the helper definition itself is emitted once per use site — not referenced by a generated indirection

Scenario: Unknown reference fails labeled

  • WHEN a fragment references a name no ## Fragments row defines
  • THEN compile fails labeled, naming the unresolved reference

Scenario: Name collision fails labeled

  • WHEN a definition’s name collides with a generated symbol
  • THEN compile fails labeled, naming both symbols — never a silent shadow

Scenario: Helper cycle fails labeled

  • WHEN definitions reference each other in a cycle (def a: uses b, def b: uses a)
  • THEN compile fails labeled naming the cycle — inlining terminates by construction

Scenario: Transitive reference inlines fully

  • WHEN a fragment references a helper that references another helper
  • THEN both bodies are inlined at the use site

Scenario: Unused definition warns

  • WHEN a definition is referenced by zero fragment cells
  • THEN compile emits a dead-helper warning on the warnings channel and still succeeds

Scenario: Absent section preserves bytes

  • WHEN a file has no ## Fragments section
  • THEN its compiled artifacts are byte-identical to the pre-change compiler’s output for that file

Requirement: Duplicate artifact stems refused before any write

spk compile over a corpus SHALL refuse an invocation in which two distinct collected files produce the same artifact stem (compile::artifact_stem) with a duplicate_artifact_stem error envelope naming both colliding paths and the remediation hint (rename one file, or compile in separate --out-dir runs), exiting 2 before lint, before compilation, before every artifact write, and before the out-dir is created, so a refused run leaves no artifacts.

Scenario: Duplicate stems refuse with no artifacts written

  • WHEN two distinct files in one spk compile invocation share an artifact stem
  • THEN the run exits 2 with an error envelope whose label is duplicate_artifact_stem, whose message names both colliding file paths, and whose hint names the rename / separate---out-dir remediation — and the out-dir is never created

Scenario: Unique stems compile unchanged

  • WHEN every collected file in the invocation has a distinct artifact stem
  • THEN every file compiles and writes its artifacts with exit 0 — the guard is collide-only

Scenario: A repeated path is one file, not a collision

  • WHEN the same path is collected twice by one invocation (repeated argument or overlapping roots)
  • THEN the run does not refuse: the repeat is one file with one artifact set, exit 0, and the refusal label never appears

Requirement: Scope refusal keeps the corpus notes

The duplicate-stem refusal SHALL re-attach every parse and hostile-input note collected while building the corpus to the refusal envelope’s warnings channel, exactly as the adjacent empty-corpus refusal does — an early refusal never swallows the note that names a skipped file.

Scenario: Hostile-input note survives the refusal

  • WHEN a corpus carries both a stem collision and a non-ingestable file skipped with a labeled note
  • THEN the error envelope reports the collision label and the skip note naming the skipped file, exits 2, and writes nothing