feat(calibration): self-host Postgres parity for every calibration surface + pg-capable maintainer CLIs - #8191
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
loopover-ui | 6ada01a | Commit Preview URL Branch Preview URL |
Jul 23 2026, 10:51 AM |
Bundle ReportChanges will increase total bundle size by 5.69kB (0.08%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: loopover-uiAssets Changed:
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8191 +/- ##
=======================================
Coverage 92.07% 92.07%
=======================================
Files 771 771
Lines 77942 77943 +1
Branches 23545 23546 +1
=======================================
+ Hits 71767 71768 +1
Misses 5062 5062
Partials 1113 1113
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-23 10:13:53 UTC
Review summary Nits — 7 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. Scroll preview
A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
c67337e to
294d343
Compare
…rface + pg-capable maintainer CLIs Pins #8082's calibration system against real Postgres (#8171): a PG_TEST_URL-gated integration suite exercises the capture writers (incl. raw-context metadata), threshold-backtest persistence, the calibration trend, the satisfaction-floor status surface, and the loosening loop's system_flags write path through the selfhost shim — asserting non-empty results, since every one of these paths degrades silently on a dialect gap. The suite caught two real self-host bugs, both fixed in pg-dialect: - date(<expr>) reached Postgres as a date-typed value node-pg parses into a JS Date, so every day-bucketed trend read bucketed nothing; now translated to a TEXT day like SQLite returns. - nested json_extract paths ($.comparison.verdict) were untranslated hard errors swallowed by fail-safe reads; now translated to jsonb #>>. The three maintainer CLIs (corpus export, track record, backfill) accept --pg (bare --pg falls back to DATABASE_URL, mirroring the selfhost stack's own driver pick) and reuse createPgAdapter — same dialect translation as the deployed Worker, pure cores untouched. The backfill wrapper's confidence projection now coerces the text ->> returns instead of type-gating it. Verified end-to-end against a real Postgres: dry-run report, idempotent apply, checksummed export (manifest names the database, never credentials), track-record read. Closes #8171
…waway password The scanner flagged the literal in the test step. It is deliberately not a repository secret — the service container is job-scoped, localhost-only, and holds synthetic rows — but the credential now lives in ONE documented job-level env var consumed by both the service definition and the test step, so the two can never drift and the intent is explicit at the definition site.
294d343 to
6ada01a
Compare


What
Pins the #8082 calibration system against real Postgres (#8171): a
PG_TEST_URL-gated integration suite (now part of the selfhost CI job) exercises every calibration surface through the selfhost shim, and the three maintainer CLIs gain a--pgdriver.The suite caught two real self-host bugs (fixed in
pg-dialect.ts)date(<expr>)reached Postgres untranslated: it 'works' via an implicit cast but returns a date-typed value node-pg parses into a JSDate, so every day-bucketed trend read (calibration trend, public accuracy/volume/reuse trends, stats) silently bucketed nothing on self-host. Now translated to a TEXTYYYY-MM-DDday, exactly what D1 returns.json_extractpaths ($.comparison.verdict) were untranslated hard errors swallowed by the fail-safe reads — the persisted backtest runs were invisible to the trend. Now translated tojsonb #>>.Because every one of these paths degrades silently, the suite asserts non-empty results, never just "didn't throw": capture writers (incl. raw-context metadata round-trip), threshold-backtest persistence, the calibration trend, the satisfaction-floor status surface, and the loosening loop's
system_flagswrite path — all against a real Postgres 16.CLI parity
backtest-corpus-export,backtest-track-record, andbackfill-calibration-corpusaccept--pg <conn>(bare--pgfalls back toDATABASE_URL, mirroring the selfhost stack's own driver pick; without--pg, D1 stays the default — the env var never silently switches drivers). The pg path reusescreatePgAdapter, so the SQL and the idempotency contracts are byte-identical to the Worker's; pure cores untouched. The backfill's confidence projection now coerces the TEXT that->>returns instead of type-gating it. Corpus manifests name the database only, never connection-string credentials.Verified end-to-end against a live Postgres: dry-run report → idempotent apply → checksummed corpus export → track-record read. Docs page gains a self-hosting section.
Validation
Full
npm run test:cigreen locally with PG_TEST_URL set (both pg suites ran for real, 1118 test files); 100% branch coverage on the touchedsrc/selfhost/pg-dialect.tslines.Closes #8171