Skip to content

IDE inspector: use cached inspect.json before querying database

Problem

The IDE inspector panel, server routes, and MCP tools each independently query the database when a user opens a table profile, even when a valid inspect.json cache already exists. This creates two issues: unnecessary warehouse costs (BigQuery inspect queries run $145+ per table scan), and inconsistent behavior where different surfaces may show stale or divergent profile data depending on their own caching logic. Worse, some surfaces auto-profile on cache miss without user consent, turning a passive "view profile" action into an expensive query the analyst didn't ask for. All profiler surfaces need to treat inspect.json as the single source of truth — reading from cache on hit, and prompting the user on miss instead of silently querying.

Context

Possible Solutions

Plan

Implementation Progress

Design principles

  1. inspect.json is the single source of truth. Every profile run writes to it. Every dashboard reads from it. The flow is always: profile → save to inspect.json → render from inspect.json.
  2. Profiling is always opt-in. No surface should auto-profile. Inspect queries are expensive ($145+ per table scan on BigQuery). On cache miss, prompt the user — don't silently run a query.

  3. Server /inspect/model/ route is cache-aware: renders from inspect.json on hit, returns a user prompt on miss.

  4. IDE panel shows "Profile this table" button on cache miss instead of ? placeholders or auto-querying.
  5. IDE panel shows "Refresh" button on cache hit for intentional re-profiling.
  6. Dashboards render a clear call-to-action when referenced table isn't in inspect.json.
  7. All paths (CLI, server, MCP) write to inspect.json before rendering — no rendering directly from in-memory profile objects.
  8. Shared cache-then-query function extracted from MCP tool for reuse by server and CLI.

  9. Opening a SQL file in the IDE with a cached table shows the profile instantly (no DB query).

  10. Opening a SQL file with an uncached table shows a prompt, not an auto-profile or empty dashboard.
  11. Clicking "Profile this table" runs the inspect, saves to inspect.json, and renders from the file.
  12. MCP tool returns cached: true on cache hit and a "not profiled yet" response on miss (no auto-profile).
  13. No surface ever triggers a database query without explicit user action.

  14. Existing MCP cache logic (dataface/ai/mcp/tools.py lines 489-492) as reference implementation.

  15. IDE extension (apps/ide/vscode-extension/src/inspector/inspector-panel.ts).
  16. Server handler (dataface/core/serve/server.py).

  17. GitHub issue: #489

Review Feedback

  • Review cleared