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: graph.views kind: intent statement: “WHEN the graph artifact is derived, THE scenario card view SHALL render, for one binding-row slug, ONE parse-level projection joining the owning file’s folded machine (citations highlighted, dangling citations annotated with no edges and no phantom nodes), the binding row’s confidence tier (unconfirmed hatched, confirmed, attested over oracle records), the contract TOML’s archetype and test bindings under the hh64 join, and the conform verdict records — each absent layer its labeled no_* element, byte-identical on re-runs, and never a view cleaner than the artifacts it reads.”

graph-views Specification

Purpose

Make the typed reference graph of any specodelic-compliant corpus thinkable-with rather than merely machine-readable: a deterministic, pipeline-friendly edge list as the single projection boundary, and human-readable views (per-file state machines, file-level traceability, the schema’s own shape) rendered from that boundary at build time. Views are derived facts — never authored, never committed, never cleaner than the artifact they came from.

Constraints

idkindexprtraces_to
process_lifecycleinvariantthe capability advances through its declared lifecycle states under the repo's change process — each stage transition fires only when its stage gate holds[[graph.views]]
card_is_parse_levelinvariantthe scenario card consumes the parsed Spec and the derived graph report alone — requires parsed, not linted — so a binding row renders while its file is lint-red mid-change; the value-set and target-kind contracts of binding cells stay the linter's beat, and the card never re-reports them[[graph.views]]
card_join_key_ambiguity_refusedinvariantthe binding-row id IS the slug and the join key; a slug bound by zero rows renders the labeled no_projection element at exit 0, and a slug bound by more than one row refuses with a labeled error naming every binding file — a silent first-pick would render a claim the corpus never picked[[graph.views]]
card_citations_highlightinvariantevery resolved given/asserts citation highlights its cited state with a dotted claim edge from the binding node, every resolved on citation bolds its transition’s folded edge (the states view’s folding conventions reused), and every verifies citation renders one labeled precondition frame on the binding node (constraint_guards_are_frames precedent) — never a machine node[[graph.views]]
card_dangling_no_phantominvariantevery unresolved binding-cell citation renders as a red-dashed element naming the unresolved target and draws no edge and no node — no phantom elements ever (the specodelic-szen contract class); the card exits 0 over it, parse-level[[graph.views]]
card_confidence_tiersinvariantevery binding row grades into exactly one pinned tier — unconfirmed (status absent or draft: hatched gray dash + an unconfirmed badge), confirmed (status confirmed, no oracle evidence: plain, its own middle tier), attested (status confirmed AND ≥1 conform verdict record for the slug: the strongest tier with the verdict breakdown in the badge) — and the tier rides both the edges TSV annotation and the binding node’s label/class[[graph.views]]
card_contract_layers_hh64invariantthe archetype and test-binding layers join by exact contract id == slug over the hh64 contract walk (every *.toml beneath the contracts dir, the dir-root config.toml alone excluded, tests entries keyed by runner carrying a non-empty command or flags, active-only contribution, DISTINCT pairs) — an absent layer renders no_archetype or no_test_bindings, the layers stay independent, and an inactive matching contract annotates without contributing; a contracts dir that is missing, empty, or malformed refuses with a labeled hint before any output[[graph.views]]
card_verdict_layer_labeledinvariantthe conform verdict layer grades attestation off the –oracle corpus classified parse-level against the binding’s own file (conform::classify_traces — no lint gate, no compiled artifacts); with no records for the slug it renders the labeled no_conform_records element[[graph.views]]
card_view_shapeinvariantan unbound slug renders the labeled no_projection element and exits 0 in every format; re-running over an unchanged corpus is byte-identical (sorted machines, claims, dangles, contract rows, verdict counts); exit codes otherwise inherit the projection exit_code_mapping — typing violations exit 1 riding annotation rows, refusals exit 2 — and nothing is ever written to the worktree[[graph.views]]

Model

States

  • proposed
  • approved
  • implemented
  • archived

Transitions

idfromtoguard
approveproposedapproved[[graph.views.process_lifecycle]] ∧ proposal reviewed and approved by the maintainer
implementapprovedimplemented[[graph.views.process_lifecycle]] ∧ all tasks.md items complete; spk lint, view tests, and openspec validate --strict pass
archiveimplementedarchived[[graph.views.process_lifecycle]] ∧ just archive-change id=add-scenario-card ran with the dual-format recipe

Properties

idkindderives_fromgeneratorpredicate
card_parse_level_checkedunit[[graph.views.card_is_parse_level]]lint_dirty_fixture_rendered()the card renders exit 0 over a binding row whose status column the row-shape rule would flag — the card is parse-level
card_join_key_checkedunit[[graph.views.card_join_key_ambiguity_refused]]unbound_and_ambiguous_slugs()unbound slug renders no_projection at exit 0 ∧ ambiguous slug exits 2 naming every binding file
card_citations_checkedunit[[graph.views.card_citations_highlight]]two_exercised_transitions_plus_one_constraint()exactly the 2 exercised transitions and 2 cited states highlight ∧ exactly 1 verifies frame renders
card_dangling_checkedunit[[graph.views.card_dangling_no_phantom]]phantom_on_citation()a red-dashed element names f1.ghost ∧ zero edge lines and zero node declarations for f1.ghost, exit 0
card_tiers_checkedunit[[graph.views.card_confidence_tiers]]draft_confirmed_and_attested_rows()draft renders hatched [unconfirmed] ∧ confirmed renders plain [confirmed] ∧ attested renders [attested: permitted 1] with --oracle
card_contract_layers_checkedunit[[graph.views.card_contract_layers_hh64]]contracts_bound_and_unbound_to_the_slug()unbound slug renders no_archetype + no_test_bindings ∧ tests render under no_archetype when the archetype cell is absent ∧ root config.toml is excluded
card_verdict_layer_checkedunit[[graph.views.card_verdict_layer_labeled]]no_oracle_invocation()the verdict layer renders the labeled no_conform_records element without --oracle
card_determinism_checkedunit[[graph.views.card_view_shape]]card_rendered_twice_in_three_formats()render_1 == render_2 in edges, dot, and mermaid
process_lifecycle_checkedunit[[graph.views.process_lifecycle]]lifecycle_model_present()check(file) == passed

Requirements

Requirement: Deterministic edge-list projection

The system SHALL provide spk graph --format edges emitting a sorted TSV edge list (source id, source kind, typed reference field, target kind, target id, annotation) with exactly one row per recorded edge — plus annotation rows per the violations requirement below — using canonical node IDs (intent IDs and qualified row IDs), byte-identical across re-runs on an unchanged corpus. When --format edges is given, raw TSV goes to stdout, overriding envelope formatting.

Scenario: Projection over a compliant corpus

  • WHEN spk graph --format edges runs over a corpus with ≥1 lint-clean intent
  • THEN the output is a sorted TSV whose every endpoint is a canonical node ID (intent ID or qualified row ID)

Scenario: Re-run determinism

  • WHEN the projection runs twice over an unchanged corpus
  • THEN both outputs are byte-identical

Scenario: Display labels excluded

  • WHEN the corpus contains label-qualified pseudo-nodes in the raw graph output
  • THEN the projection contains only canonical ids — no label-qualified endpoints

Requirement: Violations never silently hidden

The edge-list projection SHALL include one annotation row per violation in the graph artifact, and views SHALL render violations as annotated (not omitted, not silently clean) elements.

Scenario: Violation-bearing corpus projects annotated rows

  • WHEN the graph artifact reports N typing violations
  • THEN the edge list contains exactly N annotation rows

Scenario: Views annotate rather than omit

  • WHEN a view is rendered from an artifact carrying violations
  • THEN each violation appears rendered as a dashed/annotated element

Requirement: Derived per-file state-machine view

The system SHALL derive, per corpus file whose artifact contains transition edges, a state-machine view from transitions.from, transitions.to, and transitions.guard edges alone — no re-walking of markdown.

Scenario: State machine from edges only

  • WHEN a file’s spec defines states and guarded transitions
  • THEN the derived view shows the same states, transitions, and guard annotations as the file’s Model tables

Scenario: File without transitions skipped cleanly

  • WHEN a file has no transition edges
  • THEN no state-machine view is emitted for it and the build succeeds

Requirement: Derived file-level traceability view

The system SHALL derive a corpus-level view collapsing all edges to intent (file) granularity, annotating fan-in per intent, from the edge list alone.

Scenario: Collapse to intents

  • WHEN the projection is derived from the specodelic corpus
  • THEN the view’s node set equals the corpus’s intent set and edges connect only intents

Scenario: Fan-in annotation

  • WHEN an intent is the target of edges from k distinct intents
  • THEN the view annotates that intent with fan-in k

Requirement: Derived revision-labeled schema view

The system SHALL derive the schema view (kinds as nodes, typed reference fields as typed edges with allowed targets) from the acset Schema value (acset::schema::canonical() — the Reference Typing table as data, lint-gated against openspec/specs/specodelic/spec.md by schema_matches_typing_table) and the format revision marker, labeled with the revision it was derived from.

Scenario: Schema from the Schema value

  • WHEN the schema view is rendered
  • THEN its nodes and typed edges match the Schema value’s objects and morphisms, and the format revision is named in the output

Requirement: The schema export is a typed genesis envelope

spk guide --schema --json SHALL provide the schema view through a genesis envelope whose data contains schema_version 1, format_revision, sorted object names, and morphisms sorted by source/name. Each morphism SHALL carry name, column, source, target, refinements (side/kind pairs sorted by side/kind), source_rule (unchecked, appears_on or same_kind), and endo_acyclic (boolean or null).

Scenario: Schema export connects producer and renderer

  • WHEN the production exporter serializes canonical Schema and two valid constructed schemas differing in one morphism
  • THEN its canonical payload matches the source rows and rendering the two constructed exports changes the corresponding edge without a renderer edit

Requirement: The schema renderer validates the export

The schema renderer SHALL consume the serialized export, display refinement labels and reject unsuccessful envelopes, missing fields, unknown versions, duplicate identities and absent endpoints with schema_export_invalid and a regeneration hint before writing output. It SHALL neither parse Rust source nor reconstruct schema structure from corpus edges.

Scenario: Invalid schema export is refused

  • WHEN the renderer receives an unsuccessful envelope or schema data with a missing field, unknown version, duplicate identity or absent endpoint
  • THEN it fails as schema_export_invalid with a regeneration hint before writing a diagram

Requirement: The schema export derives from canonical Schema alone

The export SHALL derive directly from canonical Schema; guide typing constants SHALL NOT supply its rows. Ordinary guide –json SHALL expose kinds, row shapes and revision independently.

Scenario: Revision bump changes the view

  • WHEN a new Revision adds a Reference Typing field (Schema + corpus doc updated together under the lint gate)
  • THEN the regenerated schema view includes the new field without any renderer change

Requirement: Build-time generation, never committed

Rendered views SHALL be generated into the docs build at build time via a just docs-graphs recipe and SHALL NOT be committed to version control; no hand-edit path exists.

Scenario: Build leaves the worktree clean

  • WHEN just docs-graphs runs and the docs build completes
  • THEN git status reports no new or modified tracked files from view generation

Scenario: Empty corpus is refused at the transform, clean at the projection

  • WHEN views are generated over a directory with zero spec files
  • THEN the scope gate exits non-zero with a remediation hint (out_of_scope_refused), while the tool-level projection itself exits 0 with empty output (empty_corpus_valid)

Requirement: Row identity survives raw projection

Raw edge projection SHALL retain canonical intent IDs and qualified row IDs without collapsing rows to their file. File-level traceability and wiring views MAY collapse rows to their owning intent; state-machine views SHALL retain distinct state and transition identities.

Scenario: Two states in one file remain distinct

  • WHEN one file defines transition order.t from order.s1 to order.s2
  • THEN raw projection retains both distinct state IDs and both edges, and the state-machine view renders two states

Requirement: Folded per-file state-machine view

spk graph --view states SHALL render per owning file one state-machine subgraph in which each transition’s transitions.from, transitions.to, and transitions.guard edge rows collapse onto ONE solid labeled edge (transition id (guard citations)), with canonical node ids throughout and no raw field edges exposed.

Scenario: Transitions fold to labeled edges

  • WHEN the corpus carries a transition f1.t1 from f1.s1 to f1.s2 guarded by [[f1.c1]]
  • THEN the view renders one solid edge f1.s1 -->|"f1.t1 (f1.c1)"| f1.s2 and no transitions.from field edge

Scenario: One subgraph per owning file

  • WHEN two files each carry transitions
  • THEN the view renders two subgraphs, each grouping its own file’s transitions, with cross-file state references still resolving to the same node

Requirement: Distinct-source fan-in

A state’s (fan-in N) node suffix SHALL count DISTINCT source transitions (specodelic-3xc): a transition whose from- and to-edges land on the same state counts once.

Scenario: Self-loop counts once

  • WHEN one transition’s from- and to-edges both target the same state, and a second transition also enters it
  • THEN the state renders (fan-in 2), not 3

Requirement: Violations and dangling references annotate, never silently clean

Typing violations SHALL render as red-dashed annotated elements; dangling references (an unresolvable guard or from/to cell) SHALL render as red-dashed dangling elements naming the unresolved target, and a half-folded transition SHALL draw no solid edge and no phantom state node (specodelic-szen).

Scenario: Slice render annotates the dangling guard

  • WHEN the view runs over a slice where a transition’s guard citation does not resolve
  • THEN the output carries a red-dashed dangling element naming the unresolved target, and the folded edge draws no unguarded arrow

Scenario: Undeclared target state draws no phantom

  • WHEN a transition’s to cell names a state the file never declares
  • THEN the machine renders no blank-named state node and no pass-through edge; the dangling element carries the event

Requirement: Empty and deterministic projection

A corpus with no transition edges SHALL render the labeled no_states element and exit 0; re-running over an unchanged corpus SHALL be byte-identical; exit codes otherwise inherit the projection mapping (openspec/specs/errors/spec.md exit_code_mapping).

Scenario: Transition-free corpus

  • WHEN the view runs over a corpus whose artifact carries no transition edges
  • THEN the output is the labeled no_states element and the command exits 0

Scenario: Byte-stable re-runs

  • WHEN the view runs twice over an unchanged corpus
  • THEN both outputs are byte-identical

Requirement: Cross-machine precedence view

spk graph --view precedence SHALL render every cross-file guard edge whose target is a State as one precedence arrow from the target state’s owning file to the guarded transition’s owning file, labeled with the target state id and the guarded transition id, derived from the graph artifact alone.

Scenario: State guards render as precedence arrows

  • WHEN the corpus carries orchestrate.start_lint guarded by [[specodelic.parsed]] and refactor.analyze guarded by [[graph.queryable]]
  • THEN the view renders lifelines for specodelic, orchestrate, graph, and refactor, with an arrow specodelic→orchestrate labeled reaches parsed — start_lint may fire and an arrow graph→refactor labeled reaches queryable — analyze may fire

Scenario: Raw edge flip is auditable

  • WHEN the precedence view is rendered next to --format edges
  • THEN every arrow’s label names the guarded transition id and the target state id of exactly one recorded transitions.guard edge row

Requirement: Constraint-target guards render as frames, never arrows

A cross-file guard whose target is a Constraint SHALL render as a labeled precondition frame on the guarded file’s lifeline, never as a precedence arrow — a Constraint citation asserts an invariant holds, which has no position in time.

Scenario: Rename’s checker citations are frames

  • WHEN the view renders over the live corpus (rename’s accept/reject transitions guard on linter.graph_shape.acyclic and linter.referential_integrity.ref_resolves)
  • THEN rename’s lifeline carries two precondition frames naming the checker constraints, and no arrow between rename and either linter file

Requirement: Dangling guards annotate, never silently clean

A cross-file guard whose target does not resolve in the rendered corpus SHALL render as a red-dashed annotation element naming the unresolved target (specodelic-szen contract class) — a slice render never reads as if a guard were absent.

Scenario: Slice render annotates the missing target

  • WHEN the view runs over a slice containing refactor but not graph
  • THEN the output carries a red-dashed dangling element naming graph.queryable, and refactor’s lifeline shows no precedence arrow for the unresolvable guard

Requirement: Deterministic precedence projection

A corpus with zero cross-file guards SHALL render the labeled no_precedence element and exit 0; re-running over an unchanged corpus SHALL be byte-identical. The view otherwise inherits the projection exit-code mapping (openspec/specs/errors/spec.md exit_code_mapping): typing violations are findings (exit 1) riding along as annotation rows, a nonexistent path is an invocation error (exit 2).

Scenario: Guard-free corpus

  • WHEN the view runs over a corpus whose guard edges are all same-file
  • THEN the output is the labeled no_precedence element and the command exits 0

Scenario: Precedence byte-stable re-runs

  • WHEN the view runs twice over an unchanged corpus
  • THEN both outputs are byte-identical

Requirement: The scenario card view

spk graph --view scenario <slug> SHALL render ONE parse-level projection joining the folded machine with citations highlighted, the binding’s confidence tier, the contract TOML’s archetype and test bindings, and the conform verdict records — derived from the parsed Spec and graph artifact alone. A slug bound by more than one row SHALL refuse with a labeled ambiguity error naming every binding file; an unbound slug SHALL render the labeled no_projection element and exit 0.

Scenario: One projection per binding row

  • WHEN the view runs over a corpus whose ### Scenario bindings table binds renders-card to a machine with states s1/s2/s3, transitions t1/t2/t3, and constraint c1 — the row claims given s1, on t1 and t2, asserts s3, verifies c1
  • THEN exactly the two exercised transitions and exactly the two cited states render highlighted, t3 and s2 stay unhighlighted, and exactly one precondition frame renders for c1

Scenario: An unbound slug is labeled, not clean

  • WHEN the view runs for a slug no binding row carries
  • THEN the output is the labeled no_projection element and the command exits 0 — in every format, and regardless of the contracts dir (the join key fires before any other input loads)

Scenario: An ambiguous slug refuses

  • WHEN two files each carry a binding row with the same slug
  • THEN the command exits 2 with a labeled refusal naming every binding file — the card projects exactly one binding row, and a silent first-pick would lie about which claim rendered

Requirement: Binding citations highlight the machine; dangling citations draw nothing

A resolved binding cell (given/on/asserts) SHALL highlight its cited machine element — cited states bold with a dotted claim edge, exercised transitions’ folded edges bold — reusing the states view’s folding conventions. A verifies cell SHALL render each cited constraint as one labeled precondition frame attached to the binding node, never a machine node. An unresolvable citation SHALL render as a red-dashed dangling element and SHALL draw no edge and no node.

Scenario: A phantom transition id draws no phantom

  • WHEN a binding row’s on cell cites [[f1.ghost]], which resolves in no file (the fixture may be lint-dirty — the card is parse-level)
  • THEN the output carries a red-dashed dangling element naming f1.ghost in all three formats, the command exits 0, and no edge line and no node declaration exist for f1.ghost

Requirement: Confidence tiers grade every binding row

Each binding row’s confidence SHALL grade into one of three pinned tiers: unconfirmed (status absent or draft), confirmed (status confirmed with no conform evidence for the slug), or attested (status confirmed AND at least one conform verdict record for the slug). The tier SHALL ride the binding row’s annotation column in the edges TSV and the binding node’s label and class in dot/mermaid.

Scenario: Draft, confirmed, and attested rows grade apart

  • WHEN one file binds three slugs — one with status = draft, one with status = confirmed, one with status = confirmed plus an oracle record whose trace walks the declared machine — and the view runs with --oracle naming that corpus
  • THEN the draft row renders hatched [unconfirmed], the confirmed row renders plain [confirmed], and the attested row renders the strongest tier [attested: permitted 1]

Requirement: The contract and verdict layers render or render their labeled absence

The card’s contract layers SHALL join by exact contract id == slug over the hh64 contract walk (every *.toml under the contracts dir, root config.toml excluded): active contracts contribute the archetype cell and their DISTINCT [[tests.<runner>]] entries; an absent layer SHALL render the labeled no_archetype or no_test_bindings element. The conform verdict layer SHALL grade attestation off --oracle, rendering the labeled no_conform_records element absent oracle records.

Scenario: Absent layers stay labeled

  • WHEN the view runs for a slug whose contracts dir binds other scenarios only
  • THEN the output carries the labeled no_archetype and no_test_bindings elements; a matching contract with tests but no archetype cell renders the test rows under a no_archetype element; and with no --oracle the verdict layer is the labeled no_conform_records element

Scenario: Broken contract input refuses before output

  • WHEN --contracts names a path that is not a directory, a directory with zero contract TOMLs, or a directory holding a contract with no id
  • THEN the command exits 2 with a labeled refusal and remediation hint, and no card bytes are written

Requirement: Deterministic scenario card projection

Re-running the view over an unchanged corpus SHALL be byte-identical — sorted everywhere (machines, claims, dangles, contract rows, verdict counts), no timestamps, no iteration-order leakage — and nothing is ever written to the worktree. Exit codes inherit the projection exit_code_mapping (openspec/specs/errors/spec.md): typing violations are findings (exit 1) riding along as annotation rows, invocation and refusal errors are exit 2, and no_projection is exit 0.

Scenario: Card byte-stable re-runs

  • WHEN the view runs twice over an unchanged corpus, in each of the three formats
  • THEN both outputs are byte-identical

Scenario bindings

idstatusgivenonassertsverifies
transitions-fold-to-labeled-edgesconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.process_lifecycle]]
one-subgraph-per-owning-fileconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.process_lifecycle]]
byte-stable-re-runsconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.process_lifecycle]]
state-guards-render-as-precedence-arrowsconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.process_lifecycle]]
raw-edge-flip-is-auditableconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.process_lifecycle]]
rename-s-checker-citations-are-framesconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.process_lifecycle]]
precedence-byte-stable-re-runsconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.process_lifecycle]]
violation-bearing-corpus-projects-annotated-rowsconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.process_lifecycle]]
one-projection-per-binding-rowconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.card_citations_highlight]]
an-unbound-slug-is-labeled-not-cleanconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.card_join_key_ambiguity_refused]]
an-ambiguous-slug-refusesconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.card_join_key_ambiguity_refused]]
a-phantom-transition-id-draws-no-phantomconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.card_dangling_no_phantom]]
draft-confirmed-and-attested-rows-grade-apartconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.card_confidence_tiers]]
absent-layers-stay-labeledconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.card_contract_layers_hh64]]
broken-contract-input-refuses-before-outputconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.card_contract_layers_hh64]]
card-byte-stable-re-runsconfirmed[[graph.views.approved]][[graph.views.implement]][[graph.views.implemented]][[graph.views.card_view_shape]]