feat(onboarding): add GET /api/onboarding/ingest-status (#5680) - #5730
feat(onboarding): add GET /api/onboarding/ingest-status (#5680)#5730vivekchand wants to merge 1 commit into
Conversation
The onboarding flow had no way to tell a user "your data is arriving" vs "nothing is broken". This lands the data layer for that signal: - clawmetry/local_store.py: new query_ingest_status() method — two lightweight DuckDB passes (one aggregate, one GROUP BY agent_type) that answer connected/total/recent/sources without touching data blobs. Designed to complete in << 50 ms even on 100k+ event stores. - routes/local_query.py: add "query_ingest_status" to _DAEMON_METHODS so the daemon proxy serves it (lint guard confirms allowlist is clean). - routes/onboarding.py: add GET /api/onboarding/ingest-status on bp_onboarding. Follows the local_store_via_daemon → direct-store fallback pattern; already exempt from the trial-enforcement gate via the /api/onboarding/ prefix. Degrades to an empty stub on any store error rather than breaking the onboarding overlay. Parts B + C (the "Send your data" wizard step and polling strip in onboarding.js / overlays.html) are left for a follow-up so this backend change can be reviewed and landed independently. Closes #5680 Co-Authored-By: ClawMetry Autofix Bot <bot-autofix@clawmetry.dev> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RrNPn1HPwk6jecJBxSMvP6
Visual diffComparing 40 of 72 comparison(s) flagged (>1% pixel diff).
Folder: 0acba42ab034. Full PNGs also attached as a workflow artefact. Generated by visual-diff bot. Pixel diffs >1% flagged; eyeball the table before merging. This check is non-blocking — fail = bot bug, not a code problem. |
|
E2E Gate failure — root cause resolved, no code change needed. The The new CI run has all completed jobs green; several legs (ubuntu pip install, API tests, MOAT Verifier, E2E Browser, etc.) are still queued. The E2E Gate will re-evaluate once all legs finish — no push required. Generated by Claude Code |
Summary
No-PRD: backend-only endpoint addition under the existing onboarding blueprint; no new product surface, schema change, or billing behaviour introduced.
Adds the backend data layer for the onboarding ingest-status strip described in #5680. An empty dashboard after install is indistinguishable from a broken one — this endpoint gives the frontend something to poll to confirm data is actually flowing.
This is Part A only (the backend endpoint). Parts B and C (the "Send your data" wizard step + polling strip in
onboarding.js/templates/partials/overlays.html) are intentionally left for a follow-up so this backend change can land and be reviewed independently.Changes
clawmetry/local_store.py— newquery_ingest_status(*, recent_window_secs=86400) -> dict. Two lightweight DuckDB passes: one aggregate (total count, 24 h bucket, first/last timestamps) and oneGROUP BY agent_typefor the per-source breakdown. Usescreated_at(epoch-ms BIGINT) for the time window — the same column used byquery_events_by_ingest. Thekindfield ("filesystem"/"otlp") is derived fromentitlements.ALL_RUNTIMESvia a lazy import; no circular dependency. Never raises.routes/local_query.py— adds"query_ingest_status"to_DAEMON_METHODSso the daemon proxy serves it.make lint-daemon-allowlistconfirms the allowlist is clean (65 distinctquery_*callers, all listed).routes/onboarding.py—GET /api/onboarding/ingest-statusonbp_onboarding. Follows thelocal_store_via_daemon→ direct-store fallback pattern used acrossroutes/alerts.pyand others. Already exempt from trial enforcement via the/api/onboarding/prefix inclawmetry/trial_enforcement.py. Degrades to an empty stub (never 500s) so a store error doesn't break the overlay.Test plan
python3 scripts/lint_daemon_allowlist.py— passes (verified locally: 65 callers, 180 allowlist entries, all green)python3 -c 'import ast; ast.parse(open("clawmetry/local_store.py").read())'— passescurl http://localhost:8900/api/onboarding/ingest-statusshould return"connected": truewith non-zeroevents_totaland at least one entry insources"connected": false,"events_total": 0Bot meta
Draft PR opened autonomously based on the plan in #5680. Marked draft for human review — mark Ready for Review once happy. Parts B and C (frontend wizard step + polling strip) are left for a follow-up.
Closes #5680
🤖 Generated with Claude Code
https://claude.ai/code/session_01RrNPn1HPwk6jecJBxSMvP6
Generated by Claude Code