Skip to content

feat: AADL integration — schema, adapter, WASM rendering, architecture dogfood#3

Merged
avrabe merged 24 commits intomainfrom
feat/aadl-integration
Mar 9, 2026
Merged

feat: AADL integration — schema, adapter, WASM rendering, architecture dogfood#3
avrabe merged 24 commits intomainfrom
feat/aadl-integration

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Mar 8, 2026

Summary

  • AADL schema (schemas/aadl.yaml) — defines aadl-component, aadl-analysis-result, aadl-flow artifact types with traceability rules
  • AADL adapter (Layer 1 → Layer 2) — started as CLI JSON integration, upgraded to direct spar-hir library integration for parsing .aadl files and running analyses
  • WASM rendering — WIT interface (pulseengine:rivet/renderer), wasmtime host bindings, browser JS/CSS for architecture diagram rendering with highlight support, build/fetch scripts for WASM distribution
  • Architecture dogfood — rivet models its own architecture in AADL (arch/ directory with RivetSystem, RivetAdapters, RivetDashboard), traced to requirements via artifacts/architecture.yaml
  • New CLI subcommandsdocs (document listing/rendering), schema (schema inspection)
  • Dashboard enhancements/api/render-aadl endpoint, AADL diagram placeholders in documents, architecture linkage highlighting, live reload, source viewer, git diff, STPA views, coverage reporting, project selector

Test plan

  • cargo test — all unit and integration tests pass
  • cargo test -p rivet-core --features wasm — WASM runtime tests pass
  • rivet validate on example AADL project (examples/aadl/) succeeds
  • rivet validate on dogfood project (root) succeeds with architecture artifacts
  • Verify AADL schema traceability rules fire correctly

🤖 Generated with Claude Code

avrabe and others added 10 commits March 8, 2026 13:15
Documents:
- Markdown with YAML frontmatter and [[ID]] wiki-link references
- Document model, parser, reference extraction, section hierarchy
- DocumentStore, validate_documents() for broken ref detection
- /documents and /documents/{id} serve routes with rendered body,
  table of contents, glossary, and referenced artifacts table
- Example SRS document (docs/srs.md) with 16 artifact references
- rivet.yaml `docs:` config field

Graph improvements:
- Full-viewport graph container with zoom controls (+/-/fit)
- Clickable nodes navigating to artifact detail via HTMX
- Touch support (pinch zoom, drag pan)
- Edge labels with background pills for readability
- Color legend showing present artifact types
- Focus autocomplete with datalist
- Wider nodes (200px) and better spacing

75 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Atkinson Hyperlegible for body text, JetBrains Mono for IDs/code
- CSS custom properties design system (colors, spacing, shadows)
- Dark sidebar (#0f0f13) with active nav state tracking
- HTMX loading bar animation and content swap transitions
- Refined tables (alternating rows, hover), cards (subtle shadows),
  badges (consistent palette), form controls (focus rings, styled selects)
- Stat boxes with hover lift, scrollbar styling, selection color
- Keyboard navigation focus-visible outlines throughout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lossary

The document body had a duplicate glossary as a markdown table that wasn't
being parsed. Added table rendering (header, separator, body rows) to the
lightweight markdown renderer and replaced the body table with a reference
to the frontmatter glossary panel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… polish

- Coverage: rivet-core/src/coverage.rs module with compute_coverage(), CLI
  `rivet coverage` command (table/json output, --fail-under), /coverage
  dashboard route with progress bars and uncovered artifact lists
- Init: `rivet init` command creates rivet.yaml + artifacts/ + docs/ scaffold
  with --name, --schema, --dir options
- Search: Cmd+K command palette with debounced search across artifacts and
  documents, arrow key navigation, highlighted matches, grouped results
- ASPICE example: examples/aspice/ with full V-model braking system
  (STKH->SYSREQ->SWREQ->SWARCH->SWDD->UVER->SWINTVER->SWVER->SYSINTVER->SYSVER)
- UI: Atkinson Hyperlegible font, dark sidebar, loading bar, content
  transitions, refined tables/badges/forms, command palette styling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Stat boxes have colored top borders (blue/green/orange/red/amber/purple)
  matching their semantic meaning, with matching number colors
- Nav sidebar shows artifact count, error badge (red if >0), and doc count
- Nav divider separates primary views from analysis tools
- Artifact detail uses styled primary/secondary action buttons
- Footer shows "Powered by Rivet v{version}" from CARGO_PKG_VERSION
- CSS classes: stat-{color}, nav-badge, nav-badge-error, nav-divider,
  nav-label, btn, btn-primary, btn-secondary, detail-actions, footer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace HTML entity icons with clean 16x16 inline SVG icons (Lucide-style
  stroke icons for Overview, Artifacts, Validation, Matrix, Coverage, Graph,
  Documents, Search)
- Per-type colored badges: badge_for_type() computes rgba(r,g,b,.12)
  background from type_color_map() hex colors, applied across all views
- Artifact list client-side search filter with inline SVG search icon
- Overview status distribution with horizontal progress bars showing
  approved/draft/unknown ratios
- Validation summary bar: green gradient for pass, red gradient for fail
- Sidebar active state with left blue accent border
- h2 headings with bottom border for visual separation
- Better heading hierarchy throughout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…g, project selector

- rivet-core: add results module (TestStatus, TestRun, ResultStore, load_results)
- rivet-core: add results field to ProjectConfig for test run YAML directory
- rivet-core: enhance markdown renderer with code blocks, ordered lists,
  blockquotes, inline code, and markdown links
- rivet-cli: add verification dashboard (/verification) showing req→verifier
  mapping with test steps, method badges, and latest result dots
- rivet-cli: add results dashboard (/results, /results/{run_id}) with run
  history, pass rate stats, and per-artifact result tables
- rivet-cli: add project overview with coverage summary, test results, and
  quick links on the landing page
- rivet-cli: add project selector with sibling discovery (examples/ and peers)
  shown as a dropdown in the context bar
- rivet-cli: add load_project_full() for serve command to load docs + results
- examples/aspice: add test result YAML files (run-001, run-002)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- docs/architecture.md: system architecture document covering rivet-core
  modules, data flow, dashboard architecture, and schema system
- docs/verification.md: verification strategy mapping 59 tests to
  requirements across ASPICE SWE.4/5/6 levels
- artifacts/verification.yaml: 10 TEST-xxx artifacts with verifies links
  to requirements they cover
- results/run-001.yaml: test run capturing current 59-test pass state
- rivet.yaml: add results directory config

Dogfooding: rivet now tracks 53 artifacts, 3 documents, 132 cross-refs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Live reload: Arc<RwLock<AppState>> with POST /reload endpoint and
  reload button in context bar; re-loads all project data from disk
- Source code viewer: /source file browser with directory tree, syntax-
  aware code display, artifact ID cross-references, and line highlighting
- Git diff view: /diff route comparing artifact YAML between git refs
  (HEAD, HEAD~N, tags, branches, working tree) with field-level changes
- STPA dashboard: /stpa hierarchical tree (loss→hazard→constraint→UCA→
  scenario) with collapsible nodes, link-type labels, and UCA table
- Store: derive Clone for working-tree diff comparison
- Nav: conditional STPA entry (only shown when STPA artifacts exist)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Defines aadl-component, aadl-analysis-result, and aadl-flow artifact
types with traceability rules linking to ASPICE requirement types.
Adds modeled-by/models link type. Includes schema loading test.

Enables spar analysis results to flow into rivet traceability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 8, 2026

avrabe and others added 9 commits March 8, 2026 19:12
AadlAdapter imports AADL components and analysis results from spar's
JSON output. Supports direct JSON parsing (Bytes mode) and CLI mode
(calls 'spar analyze --format json'). Produces aadl-component and
aadl-analysis-result artifacts for rivet traceability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Demonstrates spar+rivet integration with AADL components linked to
ASPICE requirements via allocated-from. Shows the Layer 1 integration
pattern with generic-yaml artifacts and AADL source files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…it history

- /traceability route showing OSLC-style resource linkage from any root
  artifact type through all backlink chains (up to 3 levels deep)
- Coverage matrix: rows = root artifacts, columns = link types, colored
  cells showing which requirements have design/feature/test coverage
- Per-artifact git history via /traceability/history endpoint
- Filter by root type, status, and text search
- Smart default: auto-selects stakeholder-req or first available type
  when requirement type is absent (works for ASPICE example)
- Nav entry with chain-link icon between Coverage and Graph

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Change AADL-DIAG-{index} to 1-based indexing (conventional for
  artifact IDs in requirements management)
- Set status: "imported" and tags: ["aadl"] on component artifacts
- Add analysis name to diagnostic artifact tags
- Update test fixture to match spar's lowercase category/severity output

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extend WIT with renderer interface and spar-component world
- Detect ```aadl code blocks in documents, emit diagram placeholders
- Add /api/links/{id} endpoint for traceability-based highlighting
- Add /api/render-aadl endpoint scaffold for server-side SVG rendering
- Add AADL diagram JS (DOMParser-based SVG insertion, interactive
  node clicking, highlightAadlNodes) and CSS
- Embed AADL link data in artifact detail for diagram highlighting
- Add integration test for AADL diagram placeholder in documents

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…a etch

The endpoint finds .aadl files in the project, shells out to
spar analyze --format json, parses the instance tree, builds a
petgraph, and renders SVG via etch with category-based colors,
interactive data-id attributes, and highlight support. Falls back
gracefully if spar is not on PATH.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cture

- Add wasmtime::component::bindgen! for typed spar-component calls
- Implement call_render() on WasmAdapter — preopens AADL dirs, calls
  the renderer interface via typed bindings, returns SVG or error
- Add test that loads actual spar_wasm.wasm component and validates
  the renderer interface is callable
- Add scripts/build-wasm.sh (build + jco transpile from source)
- Add scripts/fetch-wasm.sh (download from GitHub releases)
- Add rivet-cli/assets/wasm/ directory with README
- Gitignore binary WASM assets (come from builds or releases)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Loads spar WASM component via wasmtime, preopens the examples/aadl
directory, calls renderer.render("FlightControl::Controller.Basic"),
and validates the returned SVG contains expected structure. Writes
SVG to temp file for manual inspection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…hema CLI

- Add AADL architecture models for rivet itself (arch/ with RivetSystem,
  RivetAdapters, RivetDashboard) and architecture.yaml artifacts traced
  to requirements
- Rewrite AADL adapter to use spar-hir directly (Layer 2) instead of
  shelling out to spar CLI
- Add docs subcommand for document listing and rendering
- Add schema subcommand for schema inspection
- Add embedded module for built-in schema loading
- Extend AADL schema, features, roadmap, and rivet.yaml config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avrabe avrabe changed the title Add full dashboard, dogfood docs, and traceability views feat: AADL integration — schema, adapter, WASM rendering, architecture dogfood Mar 9, 2026
avrabe and others added 5 commits March 9, 2026 07:26
…cture doc

- Add `arch/` as an AADL source in rivet.yaml with root-classifier
  RivetSystem::Rivet.Impl so spar parses the .aadl files and produces
  aadl-component artifacts visible in the dashboard
- Add ```aadl code blocks to docs/architecture.md at key structural
  sections (system overview, core internals, CLI, dashboard, adapters)
  so the document viewer renders interactive architecture diagrams

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ighting

- All CLI commands (validate, list, stats, matrix, diff) now support
  --format json with consistent envelope output for agent consumption
- rivet init --preset (dev/aspice/stpa/cybersecurity/aadl) generates
  schema-appropriate sample artifacts with realistic domain content
- rivet context generates richer agent-context.md with coverage summary,
  traceability rules, example IDs per type, and command reference
- Server-side YAML/bash syntax highlighting in source viewer and docs
- Fix artifact hover tooltip (was showing full page due to missing
  HX-Request header on fetch)
- Fix docs topic routing for slugs with slashes (schema/common etc.)
- Dashboard Help & Docs section with schema browser, link types, rules
- Clean up all clippy manual_strip warnings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The arch/ AADL files are kept under docs: for browsing but no longer
imported as artifact sources. The 21 hand-authored ARCH-xxx artifacts
in artifacts/architecture.yaml provide proper traceability links.

Coverage: 100% (was 48% due to unlinked auto-imports)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
smol_str 0.3.6 (via spar's rowan dependency) requires rustc 1.89.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avrabe avrabe merged commit a8ffcb7 into main Mar 9, 2026
13 checks passed
@avrabe avrabe deleted the feat/aadl-integration branch March 9, 2026 06:40
avrabe added a commit that referenced this pull request Apr 22, 2026
* docs+feat(variant): feature-model schema reference + init scaffolder

Pain point: users reverse-engineer the feature-model YAML schema because
`rivet variant --help` has no field reference and `selects:` vs
`selected:` / group types / s-expression constraint syntax / bindings
file shape are undocumented.

Changes:
- Add docs/feature-model-schema.md: top-level reference for feature
  model YAML (root, features, group types, constraint syntax) with a
  worked example.
- Add docs/feature-model-bindings.md: dedicated binding file reference.
- Link both from docs/getting-started.md.
- Variant subcommand doc-comment now points at the schema reference so
  `rivet variant --help` surfaces it.
- Add `rivet variant init <name>` scaffolder that writes a starter
  feature-model.yaml + bindings/<name>.yaml with comments documenting
  every field.

Tests: 3 new integration tests in rivet-cli/tests/variant_init.rs
covering scaffolded file contents, overwrite protection, and that the
scaffolded template parses clean via `rivet variant list`.

Implements: REQ-042, REQ-043, REQ-044
Refs: REQ-046

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(hooks): pre-commit hook walks up to find rivet.yaml (marker discovery)

Pain point: `rivet init --hooks` emitted a pre-commit hook that ran
`rivet validate` at the git root. If the rivet project is relocated
inside the working tree (e.g. moved to subdir/), the hook either
silently validates the wrong directory or fails to find rivet.yaml.

Fix: the installed pre-commit hook now walks up from $PWD until it
finds a directory containing rivet.yaml, then cd's there before
invoking `rivet validate`. If no rivet.yaml exists in the ancestor
chain, the hook exits 0 silently so it does not block commits in
unrelated repositories.

Tests: rivet-cli/tests/hooks_install.rs adds 2 integration tests — one
verifies the hook body does not embed a hard-coded -p/--project flag and
uses the walk-up pattern; one stages a fresh project, moves rivet.yaml
into a subdirectory, and confirms the hook still discovers it when run
from a nested path.

Fixes: REQ-051

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(variant): check-all + optional --variant on validate (API ergonomics)

Pain point: variant-scoped validation required --model, --variant, and
--binding to be passed together — there was no way to validate just
model/binding consistency, and no single-invocation way to assert a
whole batch of variants is valid.

Changes:
- `rivet validate --model X --binding Y` (no --variant) now parses the
  model, parses the binding, and checks that every feature referenced
  in the binding exists in the model. Reports a clear diagnostic on
  unknown feature names instead of the old "must all be provided
  together" error. The full --model + --variant + --binding mode is
  unchanged.
- `rivet variant check-all --model M --binding B` iterates every
  variant declared under `variants:` in the binding file, prints a
  PASS/FAIL line per variant, and exits non-zero if any fail.
- `FeatureBinding` in rivet-core grows an optional `variants:` field
  (default empty) so the same file can carry bindings and declared
  variants without schema churn.

Tests: 5 new integration tests in rivet-cli/tests/variant_scoped_api.rs
cover the no-variant validate mode, the unknown-feature diagnostic,
check-all exit codes for mixed/all-pass fixtures, and JSON output shape.
Existing feature_model unit tests still pass (binding YAML is
backward-compatible — `variants:` defaults to empty).

Implements: REQ-044, REQ-045, REQ-046

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(sexpr): semantic notes on filter parse errors

Pain point: `[FilterError { offset: 14, message: "unexpected atom at
top level" }]` exposed parser internals. Users writing `A and B`,
`and A B`, or `(bogus A B)` got a positional offset with no hint that
they were using the wrong syntax.

Fix: extend `FilterError` with an optional `note` field, populated by a
classifier that inspects the source before parsing. Three common shapes
get a semantic nudge:
  - bare infix (`A and B`) → suggest `(and A B)`.
  - missing outer parens (`and A B`) → suggest wrapping it.
  - unknown head (`(bogus …)`) → reference the supported form list.
`FilterError::Display` renders the positional detail followed by the
note on a new line. Feature-model constraint errors now format via
Display instead of Debug, so the note bubbles out through
`rivet variant check` / `rivet validate --model` paths.

Tests: 4 new unit tests in sexpr_eval covering the three error shapes
plus a success case that must carry no note. All pre-existing tests
unchanged.

Fixes: REQ-043
Implements: REQ-042

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(variant-solve): per-feature origin tracking (selected vs mandatory vs implied)

Pain point: `rivet variant solve` output mixed user-picked features with
ones the solver added via mandatory-group propagation or constraint
implication. A flat list like `base, auth, oauth, token-cache, metrics`
didn't tell the user which features were their intent and which were
downstream effects.

Minimum-impact change per scope-limits brief (risk of conflict with
PR #156 cross-tree constraint work):
- Extend `ResolvedVariant` with a per-feature `origins: BTreeMap<String,
  FeatureOrigin>` where FeatureOrigin is UserSelected / Mandatory /
  ImpliedBy(name) / AllowedButUnbound.
- Populate origins alongside the existing selected-set fixpoint loop —
  no algorithmic changes. First-reason-wins on insertion so user
  selection beats later mandatory/implied discoveries.
- Text output of `rivet variant solve` prints one feature per line,
  prefixed with `+`, labeled (mandatory) / (selected) / (implied by X).
- JSON output is strictly additive: `effective_features` + `feature_count`
  preserved, new `origins` object keyed by feature name.

Tests:
- 4 new unit tests in rivet-core/src/feature_model.rs covering each
  origin variant.
- 2 new integration tests in rivet-cli/tests/variant_solve_origins.rs
  asserting text prefixes/labels and JSON backwards compatibility.
- All 15 pre-existing feature_model unit tests still pass; all 6
  proptest_feature_model properties still hold.

Implements: REQ-043, REQ-046
Refs: REQ-052

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant