fix(selfhost): fix Grafana reporting exporter's Postgres connection and manual-review classification - #2740
Conversation
…nd manual-review classification PGDATABASE="$PG_DB" psql treats PGDATABASE as a literal database name, not a connection URL -- libpq does not URI-expand it the way it does a positional dbname argument, so every Postgres-backed reporting export was silently falling back to a local Unix-socket connection attempt and failing. Fix: split the postgres:// URL into PGHOST/PGPORT/PGUSER/ PGPASSWORD/PGDATABASE/PGSSLMODE and export them, so psql connects over the intended TCP host while the credential never appears on argv (preserving the process-listing leak protection from #2461). Also broadens the manual-review classification: a 'neutral' gate conclusion is now counted as 'manual' (matching gateHeld's held-for- review definition), not silently bucketed as 'commented'/'comment'.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2740 +/- ##
=======================================
Coverage 96.03% 96.03%
=======================================
Files 245 245
Lines 27340 27340
Branches 9930 9930
=======================================
Hits 26255 26255
Misses 460 460
Partials 625 625 🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-03 09:58:31 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
postgres://u:p@[::1]:5432/db split host:port on the first colon, which cuts a bracketed IPv6 literal apart (PGHOST='[', PGPORT=':1]:5432') since the address itself contains colons. Handle the bracketed forms (with and without a trailing port) before falling back to plain first-colon splitting for an ordinary hostname/IPv4 host.
Summary
Scope
Validation
Safety
Notes