Repository navigation
feat(cron): durable run-report observability + logging cleanup - #51
Merged
Merged
Conversation
Each daily-digest run now emits one complete, versioned RunReport
('pulse.run.v1') and persists it to public.pipeline_runs — a durable,
queryable cost/health record. Previously the structured run object was only
appended to an ephemeral JSONL file on the Actions runner and discarded.
Run report:
- runReport.ts: buildRunReport (pure aggregation), formatRunReportSummary
(one readable summary line), persistRunReport (service-role insert; swallows
errors so observability never breaks the pipeline).
- Captures ALL cost: fetch + per-region ranking + the global-ranking pass,
whose usage was previously dropped — rankGlobalHeadlines now returns
{ headlines, usage } and accumulates usage across passes.
- Folds in notify outcome (devicesTargeted/sent/failed) and run status.
- public.pipeline_runs: promoted scalar cost columns + full report jsonb,
RLS-enabled with no policy (service-role only). Mirrored in supabase/schema.sql.
Logging cleanup across cron/:
- formatError() preserves Error stack traces; both job entrypoints and the
region-failure log previously used String(err), dropping the stack.
- Colorize only on a TTY — keeps GitHub Actions logs free of ANSI noise.
- Run-lifecycle start brackets in both jobs; per-headline slug-duplicate log
demoted info -> debug.
Also: fix stale 'api' dir reference in the cron lint script and the root
lint-staged config (the dir was removed earlier); drop completed todo items.
Tests: runReport (build/format/persist) + updated rankHeadlines for the new
return shape. cron suite green (184 tests).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…artifacts READMEs: - root: Vercel→GitHub Actions, Claude ranking, pipeline_runs observability row, device RLS-via-RPC lockdown, shared/ subsystem link. - cron: ranking + run-report observability section, ANTHROPIC_API_KEY, the two GHA cron jobs and the notify catch-up window, updated pipeline diagram. - supabase: pipeline_runs and notify_state tables, full RLS matrix (incl. the service-role-only cron tables), SECURITY DEFINER RPC table + anon auto-grant gotcha, UNIQUE/ON DELETE details. - app: expo-linking deep-link handling (reset-password + signup-confirm), publishable-key env var, navigation model, trimmed stale WSL setup. Also removes the docs/superpowers/specs design-spec artifacts (planning byproducts) from the tree. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GJanos
force-pushed
the
feat/cron-run-report
branch
from
June 18, 2026 07:57
0f376b2 to
c57dea9
Compare
app/README listed EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY, but the client reads EXPO_PUBLIC_SUPABASE_KEY (app/src/supabase/client.ts). Fix the name. Also remove the docs/superpowers/plans planning artifacts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Phase 2 — Observability: cost logging refactor from
todo.md.What
Each
daily-digestrun now produces one complete, versionedRunReport(pulse.run.v1) and persists it to a newpublic.pipeline_runstable — a durable, queryable cost/health record. Until now the structured run object was only appended to a JSONL file on the ephemeral GitHub Actions runner and thrown away.Run report (
cron/src/runReport.ts)buildRunReport(...)— pure aggregation: fetch cost + per-region ranking + the global-ranking pass (whose usage was previously dropped entirely), region partition (requested/succeeded/failed), run status (ok/partial), headline counts, and notify outcome.formatRunReportSummary(...)— one dense, human-readable summary line:persistRunReport(...)— inserts via the service-role client; swallows any error (logs a warning) so observability can never break the digest pipeline.rankGlobalHeadlinesnow returns{ headlines, usage }and accumulates usage across all passes (the only non-trivial signature change; callers + e2e runners updated).Database
public.pipeline_runs— promoted scalar columns (run_at,status,total_cost_usd,total_tokens,regions_*) for cheap cost-over-time queries, plus the full structuredreportasjsonb. RLS enabled, no policy → service-role-only (matches the existing privatedevices/notify_statepattern; advisor confirms only the expectedrls_enabled_no_policyINFO, no new warnings). No sensitive data at rest (no tokens / user IDs / secrets).create_pipeline_runs).supabase/schema.sql.Logging cleanup across
cron/formatError(); both job entrypoints and the region-failure log usedString(err), which dropped the stack.info→debug.Docs
pipeline_runs/notify_statetables + full RLS matrix + SECURITY DEFINER RPC reference (supabase), ranking + GHA cron jobs + catch-up window (cron/root), expo-linking deep-link handling + publishable-key env (app), Vercel→GitHub Actions corrections.docs/superpowers/specsdesign-spec artifacts (planning byproducts).Drive-by
apidir reference (removed in an earlier PR) in both the cronlintscript and the rootlint-stagedconfig — the latter was failing every cron pre-commit. Now lintssrc jobs e2e.todo.md.Verification
npx tsc --noEmit(cron) — clean ·eslint— 0 errors ·npx jest(cron) — 184 tests pass ·prettier --check— clean.🤖 Generated with Claude Code