Skip to content

feat: embed phases 2+5 — diagnostics, matrix, snapshots, docs#96

Merged
avrabe merged 7 commits intomainfrom
feat/embed-phases-2-5
Apr 1, 2026
Merged

feat: embed phases 2+5 — diagnostics, matrix, snapshots, docs#96
avrabe merged 7 commits intomainfrom
feat/embed-phases-2-5

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 1, 2026

Summary

Implements Phases 2 and 5 from issue #92, plus embed documentation:

Phase 5: Diagnostics + matrix embeds

  • {{diagnostics}} / {{diagnostics:error|warning|info}} — validation issues as HTML table with severity filter and summary footer
  • {{matrix}} / {{matrix:from_type:to_type}} — inline traceability matrix with coverage bar, auto-detects link type from schema rules

Phase 2: Snapshot infrastructure

  • rivet snapshot capture — dumps project state (stats, coverage, diagnostics) to JSON with git commit + dirty status
  • rivet snapshot diff — compares current vs baseline (text/json/markdown)
  • rivet snapshot list — lists available snapshots with summary
  • Delta computation with NEW/RESOLVED diagnostic tracking
  • EmbedContext.baseline field for future delta=BASELINE rendering

Documentation

  • Added computed embed syntax reference ({{stats}}, {{coverage}}, {{diagnostics}}, {{matrix}}, etc.) to the existing rivet docs documents topic
  • Phase 4 guide endpoint was reverted — it duplicated rivet schema + rivet context

Safety constraints

Constraint Mechanism
SC-EMBED-2 Snapshot records exact git commit + dirty status
SC-EMBED-6 Schema version checked on diff; warns on mismatch

Tests

  • 12 unit tests (snapshot, diagnostics/matrix embeds, parser edge cases)
  • 6 CLI integration tests (snapshot capture/list, embed diagnostics/matrix/stats/coverage)
  • 2 serve integration tests (embed errors, stats API)
  • Formatting fixes

Refs #92.

Test plan

  • cargo test --workspace — all tests pass
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo fmt --all -- --check — clean
  • CI

🤖 Generated with Claude Code

avrabe added 5 commits April 1, 2026 17:16
Phase 5: adds two new computed embed types:
- {{diagnostics}} / {{diagnostics:error|warning|info}} — validation
  issues as HTML table with severity filter and summary footer
- {{matrix}} / {{matrix:from_type:to_type}} — inline traceability
  matrix with coverage bar, auto-detects link type from schema rules

7 unit tests + 2 CLI integration tests.
Phase 2: project snapshot infrastructure for baseline comparison:
- Snapshot struct with stats, coverage, diagnostics, git context
- rivet snapshot capture — dumps current state to JSON
- rivet snapshot diff — compares current vs baseline (text/json/markdown)
- rivet snapshot list — lists available snapshots
- Delta computation with NEW/RESOLVED diagnostic tracking
- SC-EMBED-2 (git commit in snapshot), SC-EMBED-6 (schema version)

5 unit tests + 2 CLI integration tests.
Adds optional baseline snapshot to EmbedContext so embed renderers
can show delta columns when delta=BASELINE option is used. All
callers updated to pass baseline: None (wiring comes next).
Phase 4: self-documenting schema guide for AI agents and developers:
- /api/v1/guide — JSON endpoint with artifact types, fields, link
  types, traceability rules, embed syntax reference, commit trailers,
  and common mistakes
- rivet guide --format json|text — CLI equivalent for scripting
- Refreshes from current AppState on each request (SC-EMBED-5)

2 CLI integration tests + 1 serve integration test.
@avrabe avrabe changed the title feat: embed phases 2+5 — diagnostics, matrix, snapshots feat: embed phases 2+4+5 — diagnostics, matrix, snapshots, guide API Apr 1, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: b4e3dfc Previous: ca97dd9 Ratio
store_insert/10000 14664673 ns/iter (± 745083) 10878958 ns/iter (± 357041) 1.35
link_graph_build/10000 41461816 ns/iter (± 2979474) 25883542 ns/iter (± 188443) 1.60
validate/10000 6734006 ns/iter (± 480908) 5184757 ns/iter (± 21355) 1.30
query/10000 137180 ns/iter (± 362) 91618 ns/iter (± 423) 1.50

This comment was automatically generated by workflow using github-action-benchmark.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 54.80000% with 226 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rivet-core/src/embed.rs 36.40% 145 Missing ⚠️
rivet-core/src/snapshot.rs 79.90% 41 Missing ⚠️
rivet-core/src/document.rs 35.00% 26 Missing ⚠️
rivet-core/src/export.rs 50.00% 14 Missing ⚠️

📢 Thoughts on this report? Let us know!

avrabe added 2 commits April 1, 2026 17:37
Instead of a separate guide endpoint (reverted — duplicated rivet schema
and rivet context), add the embed syntax documentation to the existing
'documents' topic in rivet docs where it naturally belongs.

Covers: {{stats}}, {{coverage}}, {{diagnostics}}, {{matrix}},
{{artifact:ID}}, {{links:ID}}, {{table:TYPE:FIELDS}}, error handling,
and HTML export provenance.
@avrabe avrabe changed the title feat: embed phases 2+4+5 — diagnostics, matrix, snapshots, guide API feat: embed phases 2+5 — diagnostics, matrix, snapshots, docs Apr 1, 2026
@avrabe avrabe merged commit c5ff64c into main Apr 1, 2026
18 of 20 checks passed
@avrabe avrabe deleted the feat/embed-phases-2-5 branch April 1, 2026 22:26
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