Skip to content

feat(api): oEmbed provider and Grafana JSON API endpoints#89

Open
avrabe wants to merge 7 commits intomainfrom
feat/oembed-grafana-api-clean
Open

feat(api): oEmbed provider and Grafana JSON API endpoints#89
avrabe wants to merge 7 commits intomainfrom
feat/oembed-grafana-api-clean

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Mar 29, 2026

Summary

  • Add /oembed?url=... endpoint returning rich-type oEmbed responses with iframe to /embed/artifacts/{id} for embedding artifact cards in Notion/Confluence
  • Add 5 REST JSON endpoints under /api/v1/ for Grafana Infinity plugin: health, stats, artifacts, diagnostics, coverage
  • CORS via tower_http::CorsLayer on /api/v1/*, CSP frame-ancestors * for iframe embedding
  • oEmbed discovery <link> tag on artifact detail pages
  • Federation-ready: all responses carry origin field (local / external:{prefix}) and stats include by_origin breakdown
  • Fix flaky reload_returns_hx_location test (5s → 30s read timeout)
  • 21 integration tests covering all endpoints, filters, pagination, error cases

New endpoints

Endpoint Purpose
GET /oembed?url=... Rich oEmbed for Notion/Confluence
GET /api/v1/health Health check with version/uptime
GET /api/v1/stats Artifact counts, validation, coverage
GET /api/v1/artifacts?type=...&q=... Filterable artifact list
GET /api/v1/diagnostics?severity=... Validation diagnostics
GET /api/v1/coverage Per-rule traceability coverage

Test plan

  • 21 integration tests in serve_integration.rs
  • cargo clippy --all-targets -- -D warnings clean
  • cargo fmt --all -- --check clean
  • rivet validate passes (0 warnings)
  • All pre-commit hooks pass

🤖 Generated with Claude Code

Test and others added 4 commits March 28, 2026 16:49
- A* with Manhattan heuristic replacing pure Dijkstra
- Port stub support for clean edge departure from nodes
- Channel waypoints between obstacles for better routing
- Path simplification removing collinear redundant waypoints
- Batch routing with parallel segment nudging (edge_separation)
- Waypoint margin (4px) for obstacle clearance
- Strict obstacle intersection (boundary-exclusive)
- Precise coordinate tracking via rounding
- 15 new tests (66 total + 3 doctests)

Trace: skip
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add /oembed endpoint for rich-type artifact embedding in
Notion/Confluence, and /api/v1/ REST endpoints (health, stats,
artifacts, diagnostics, coverage) for Grafana Infinity plugin.

- oEmbed: rich iframe response, dimension clamping, XML 501
- Stats: by_type, by_status, validation severity, coverage rules
- Artifacts: type/status/origin/search filters, pagination
- Diagnostics: severity/rule/artifact_id filters, pagination
- Coverage: per-rule traceability breakdown with uncovered IDs
- CORS on /api/v1/ via tower-http CorsLayer
- CSP frame-ancestors * for iframe embedding
- oEmbed discovery <link> tag on artifact detail pages
- 21 integration tests

Implements: FEAT-073
The reload handler re-reads the entire project from disk, which can
take longer than 5s under coverage/proptest instrumentation. Also
fail explicitly on read error instead of silently ignoring it.

Fixes: FEAT-073
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Test added 2 commits March 29, 2026 07:25
31 end-to-end tests verifying API responses from a real consumer
perspective: JSON shapes, CORS headers, oEmbed iframe rendering,
Grafana-compatible data structures, and cross-checks between API
responses and the dashboard UI.

Verifies: FEAT-073
The mutation testing job was getting cancelled by the runner without
a configured timeout. As rivet-core grows, cargo-mutants needs more
wall time. 20 minutes gives sufficient headroom.

Refs: FEAT-073
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: edf4356 Previous: ba47683 Ratio
store_insert/10000 14532961 ns/iter (± 855839) 10942076 ns/iter (± 467715) 1.33
link_graph_build/10000 32929782 ns/iter (± 1582806) 25228541 ns/iter (± 1215205) 1.31

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

Under proptest's heavier load, the server can briefly refuse
connections between the health check and the first request.
Add a retry loop to fetch() to handle transient connection refused.

Fixes: FEAT-073
avrabe pushed a commit that referenced this pull request Mar 30, 2026
Specs:
- Document query embeds ({{stats}}, {{coverage}}, snapshots, delta, STPA)
- Spec-driven development (schema packages, bridges, guide API, CRUD CLI)
- oEmbed + Grafana API design (already implemented in PR #89)

Plans:
- Document embeds Phase 1 implementation plan (6 tasks, 26 tests)
- oEmbed + Grafana API plan (already executed)

Refs: FEAT-073, FEAT-074
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