Skip to content

Revert PR #116 — restore /analytics page (v1.15.3 broke prod)#117

Merged
jpr5 merged 1 commit into
mainfrom
revert/v1.15.3-pr116
Jun 17, 2026
Merged

Revert PR #116 — restore /analytics page (v1.15.3 broke prod)#117
jpr5 merged 1 commit into
mainfrom
revert/v1.15.3-pr116

Conversation

@jpr5

@jpr5 jpr5 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Reverts PR #116. The v1.15.3 getBlockedQueries SQL throws against real Postgres, and the client-side Promise.all rejection blanks the entire /analytics page with 'Failed to load analytics: Failed to fetch blocked queries'.

Restoring v1.15.2 immediately to get the page working again. The three v1.15.3 changes (blocked filter, Blocked Queries panel, Pacific timestamps) will re-ship as v1.15.4 after explicit local verification against the real Postgres schema.

…eries panel + Pacific timestamps (#116)"

This reverts commit f8f7ab7, reversing
changes made to d501cae.
@jpr5 jpr5 merged commit 420c308 into main Jun 17, 2026
@jpr5 jpr5 deleted the revert/v1.15.3-pr116 branch June 17, 2026 18:20
jpr5 added a commit that referenced this pull request Jun 17, 2026
…defensive Promise.allSettled (#118)

## Summary

Re-ships the three reverted v1.15.3 changes (blocked filter on
empty-results, new Blocked Queries panel, Pacific timestamps) with the
two defects fixed that took v1.15.3 down within minutes of deploy
(reverted via PR #117):

1. **`getBlockedQueries` SQL — rewrote as a CTE-backed correlated
subquery.** v1.15.3 grouped the outer query on `COALESCE(block_reason,
'<unknown>')` but the correlated subquery referenced raw
`query_log.block_reason`, which Postgres rejects as an ungrouped column
reference (`subquery uses ungrouped column "query_log.block_reason" from
outer query`). The CTE (`blocked_rows.block_reason_key`) pre-projects
the COALESCEd expression so the outer `GROUP BY` and the inner
correlated reference operate on the same column.
2. **`Promise.all` → `Promise.allSettled` in `docs/analytics.html`.** A
single panel's fetch failure used to throw out of `Promise.all` and
blank the entire `/analytics` page (which is what made v1.15.3's SQL bug
catastrophic instead of merely cosmetic). Each panel now renders
independently. Auth (401) still bubbles to the outer catch since a bad
token fails every endpoint identically; a failed summary still surfaces
via the top-level banner. Per-panel failures degrade to an empty state
with `console.error`.

## Local verification (the discipline that was missing on v1.15.3)

Booted Pathfinder locally against the real prod `DATABASE_URL`:

- `/api/analytics/blocked-queries?days=7` returned **HTTP 200** + valid
JSON. Verified with three test rows inserted into prod: response
correctly grouped one bucket by `block_reason='hotfix-test'` (2 hits, 2
sample_queries) and one `<unknown>` bucket for the NULL row (1 hit, 1
sample_query). Test rows then deleted; prod has zero blocked rows in the
7-day window (current state).
- `/api/analytics/empty-queries?days=7` returned HTTP 200, no abuse
strings (toy story / box office / kalshi / scotus) leaked into results.
- `/analytics` page returned HTTP 200 with no rendered error banner.

Pre-fix SQL was directly verified to fail against prod psql with the
exact error above. Post-fix SQL was directly verified to return real
grouped rows when run against prod psql with a wider window (`days=30`
returns ~13k legacy `<unknown>` rows). Both pre-fix and post-fix were
observed end-to-end against the actual production schema before push.

## Test plan

- [ ] CI green
- [ ] Post-deploy: `/analytics` renders all sections, no error banner
- [ ] `/api/analytics/blocked-queries?days=7` returns 200 + grouped JSON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant