submit mutation rejects current ccusage output: daily entries now use period instead of date (Invalid date format: undefined)#50
Conversation
Recent ccusage `--json` emits each daily entry keyed by `period` (plus `agent`/`metadata`) instead of `date`. The submit mutation reads `day.date`, which is now undefined, so every submission fails with "Invalid date format: undefined. Expected YYYY-MM-DD". Widen the daily args validator to accept the new optional fields, and coalesce `day.date ?? day.period` at every incoming-date read and at both stored-write paths, so submissions are accepted and `dailyBreakdown.date` is always a valid YYYY-MM-DD string. Type-neutral (introduces no new tsc errors); verified end-to-end against a real failing cc.json (32 daily entries, all keyed by `period`). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@dprvda is attempting to deploy a commit to the sculpt Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for this β your diagnosis of the The one catch: production runs on Supabase, not the Convex backend this PR patches (Convex was a dormant fallback in the tree). So the real submission path never hit Closing as superseded by #51 β but genuinely appreciate you surfacing the root cause. π |
Convex was dead code behind a feature flag (production has always run on Supabase). It's also what misled PR sculptdotfun#50 into patching the wrong backend. Removing it makes the data layer single-backend and removes the confusion. - delete convex/, convex.json, src/lib/data/convex/ - strip Convex branches from the data-layer factory and the submission/ profile/stats hooks; Supabase is the only path - providers.tsx: drop ConvexProvider; env/turbo: drop CONVEX_* vars - drop convex + @convex-dev/rate-limiter deps (Supabase rate-limiter already replaced the latter) - DatabaseBackend type narrowed to "supabase" Build green, tests pass, no live convex references remain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes #49.
Problem
Current
ccusage --jsonemits each daily entry keyed byperiod(plusagent/metadata) instead ofdate. Thesubmitmutation readsday.date, which is nowundefined, so submissions fail withInvalid date format: undefined. Expected YYYY-MM-DD. None of the ingestion paths (packages/viberank-cli/cli.js,src/app/api/submit/route.ts,submit-to-viberank.sh) normalize this, so the fix lives at the single chokepoint they all funnel through:convex/submissions.ts.Change (
convex/submissions.ts, +19/β7)datebecomes optional andperiod/agent/metadataare accepted as optional. Convexv.objectis strict, so without this it rejects the real payload before the handler runs.day.date ?? day.periodin the validation loop and at every incoming-date read plus both stored-write paths (merge + insert), sodailyBreakdown.dateis always a validYYYY-MM-DD.convex/schema.ts(storeddate: v.string(), required) is intentionally left unchanged βperiodis normalized todateat ingestion.Verification
convex/sources before and after the patch yields the same result; it introduces no new type errors. Please confirm with your usualconvex deploy/tsc.cc.json(32 daily entries, all keyed byperiod): pre-change throws the exact reported error; post-change all 32 pass and store valid dates (range 2026-05-01..2026-06-01).Coordination notes
datecrash and the samedate = periodfix; consider deduping.convex/submissions.ts; flagging for potential merge-conflict coordination.π€ Generated with Claude Code