Skip to content

Query history is never persisted — user counter increments but History panel stays empty #45

Description

@AttiR

Summary

After a successful query, the per-user rate-limit counter (users.total_queries) increments correctly ("1 of 2 remaining" in the top nav), but the History panel keeps showing "No queries yet" and the cached-replay endpoint GET /api/history/:id cannot find the row.
Net effect: every query a user pays for (Claude call + their rate-limit budget) is lost from the audit log and unreplayable from cache.

Steps to reproduce

  1. Sign in with Google on https://insightiq-frontend.orangemeadow-25c8b891.westeurope.azurecontainerapps.io
  2. Ask any question (e.g. "What is our MRR?")
  3. Wait for the chart + insight to render.
  4. Top nav shows the budget badge has decremented (e.g. 1 of 2 remaining).
  5. History panel still shows 0 queries — click to load free / No queries yet.
  6. SELECT COUNT(*) FROM query_history WHERE user_id = <me> returns 0.

Expected

After step 4, the History panel should list the question with a cached-result indicator, and clicking it should replay from result_json without a Claude call.

Actual

The row is never inserted. The user's rate-limit budget is consumed for nothing.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdatabaseSchema, migrations, seed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions