Skip to content

MVP: push verdicts to Loki or configured sink (#77) - #89

Open
kuyacarlo wants to merge 9 commits into
devfrom
mvp/77-loki-sink
Open

MVP: push verdicts to Loki or configured sink (#77)#89
kuyacarlo wants to merge 9 commits into
devfrom
mvp/77-loki-sink

Conversation

@kuyacarlo

Copy link
Copy Markdown
Contributor

Summary

  • Push structured verdict_event to Grafana Loki when LOKI_URL is set; optional JSONL via VERDICT_SINK_PATH; no-op when unset (stdout structured log still emits)
  • Emit on POST /validate completion and PATCH /validate/{id} HITL resolve (hitl_resolve)
  • Config: LOKI_URL, LOKI_JOB, VERDICT_SINK_PATH (documented in .env.example + handoff)

Depends on / stacks with: foundation PR #86 (mvp/75-76-81-foundation — verdict_event schema #76)

Test plan

  • cd backend && DATABASE_URL=sqlite:///./test.db uv run pytest — 23 passed
  • Mock Loki success + failure (tests/test_verdict_sink.py)
  • Spot-check with a real Loki: set LOKI_URL=http://localhost:3100, hit /validate, confirm stream in Explore

Closes #77

Made with Cursor

kuyacarlo and others added 9 commits July 24, 2026 12:44
Add red fixture tests and handoff stubs for #81/#76/#75.
Ensure pytest resolves the backend package via pythonpath.

Signed-off-by: kuyacarlo <106532351+kuyacarlo@users.noreply.github.com>
Two Markdown policies with Controls sections for ingest/E2E demos.

Signed-off-by: kuyacarlo <106532351+kuyacarlo@users.noreply.github.com>
Red tests for REQUIRED_VERDICT_KEYS and build_verdict_event.

Signed-off-by: kuyacarlo <106532351+kuyacarlo@users.noreply.github.com>
Add build_verdict_event helpers, wire validate responses, and fix
ActivityLog detached-instance returns after commit.

Signed-off-by: kuyacarlo <106532351+kuyacarlo@users.noreply.github.com>
Red integration tests for Policy model, ingest version rows, and GET /policies.

Signed-off-by: kuyacarlo <106532351+kuyacarlo@users.noreply.github.com>
Ingest upserts Policy rows by content hash/name and exposes list/get APIs.

Signed-off-by: kuyacarlo <106532351+kuyacarlo@users.noreply.github.com>
Keep project AGENTS.md aligned with #75/#76/#81 contracts for the next agent.

Signed-off-by: kuyacarlo <106532351+kuyacarlo@users.noreply.github.com>
Ship structured verdict_event to Grafana Loki when LOKI_URL is set;
optional JSONL via VERDICT_SINK_PATH; no-op otherwise. Emit on validate
completion and HITL resolve.

Signed-off-by: kuyacarlo <106532351+kuyacarlo@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: kuyacarlo <106532351+kuyacarlo@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.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.

MVP: Push verdicts to Loki (or configured sink)

1 participant