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
inspect.jsonis the single source of truth. Every profile run writes to it. Every dashboard reads from it. The flow is always: profile → save toinspect.json→ render frominspect.json.-
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.
-
Server
/inspect/model/route is cache-aware: renders frominspect.jsonon hit, returns a user prompt on miss. - IDE panel shows "Profile this table" button on cache miss instead of
?placeholders or auto-querying. - IDE panel shows "Refresh" button on cache hit for intentional re-profiling.
- Dashboards render a clear call-to-action when referenced table isn't in
inspect.json. - All paths (CLI, server, MCP) write to
inspect.jsonbefore rendering — no rendering directly from in-memory profile objects. -
Shared cache-then-query function extracted from MCP tool for reuse by server and CLI.
-
Opening a SQL file in the IDE with a cached table shows the profile instantly (no DB query).
- Opening a SQL file with an uncached table shows a prompt, not an auto-profile or empty dashboard.
- Clicking "Profile this table" runs the inspect, saves to
inspect.json, and renders from the file. - MCP tool returns
cached: trueon cache hit and a "not profiled yet" response on miss (no auto-profile). -
No surface ever triggers a database query without explicit user action.
-
Existing MCP cache logic (
dataface/ai/mcp/tools.pylines 489-492) as reference implementation. - IDE extension (
apps/ide/vscode-extension/src/inspector/inspector-panel.ts). -
Server handler (
dataface/core/serve/server.py). -
GitHub issue: #489
Review Feedback¶
- Review cleared