Skip to content

Add observable query diagnostics page#11

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-query-diagnostics-page
Draft

Add observable query diagnostics page#11
Copilot wants to merge 2 commits into
mainfrom
copilot/add-query-diagnostics-page

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 27, 2026

Adds a live Query Diagnostics tab to the Lens popup that surfaces real-time observable query state from the inspected Arc application via ArcContext.observableQueryDiagnostics.

Approach

The diagnostics object lives inside the Arc application's React fiber tree. Rather than a WebSocket bridge, the extension injects a page-world script (same technique as Arc context detection) that traverses the fiber, finds the ArcContext provider node, and calls observableQueryDiagnostics.getSnapshot() — returning a plain serializable object over the structured-clone boundary.

// Injected into page world via chrome.scripting.executeScript
if (isArcContextValue(contextValue)) {
    const diag = contextValue.observableQueryDiagnostics;
    if (diag && typeof diag.getSnapshot === 'function') {
        return diag.getSnapshot();   // ObservableQueryDiagnosticsSnapshot
    }
}

The popup polls this every 2 seconds for live updates.

Changes

  • @cratis/arc.react — bumped to ^20.28.0
  • arc-context.ts — adds captureObservableQueryDiagnosticsFromPage (page-world injected fn) and captureObservableQueryDiagnosticsForActiveTab (extension-side async API); re-exports all snapshot sub-types from @cratis/arc/queries
  • storage.ts — adds 'observable-query-diagnostics' to PopupTab
  • ObservableQueryDiagnosticsView.tsx (new) — polls every 2 s; renders Health, Transport, Multiplexer (with per-connection breakdown), Cache (with per-entry subscriber/listener/size detail), and Ownership sections; tab is disabled when the active page is not an Arc application
  • lens-popup.cssoqd-* styles for the diagnostics layout
  • LensPopup.tsx — registers the new pi-chart-line tab, disabled when !hasArcContext

- Upgrade @cratis/arc.react to ^20.28.0
- Add captureObservableQueryDiagnosticsForActiveTab() to arc-context.ts:
  injects a page-world script that traverses the React fiber tree to find
  the ArcContext value and calls observableQueryDiagnostics.getSnapshot()
- Export ObservableQueryDiagnosticsSnapshot and related types
- Add 'observable-query-diagnostics' to PopupTab union type
- Create ObservableQueryDiagnosticsView with 2-second live polling showing
  health, transport, multiplexer, cache, and ownership diagnostics sections
- Add CSS styles for the diagnostics view
- Add new tab in LensPopup (disabled when not an Arc application)
Copilot AI changed the title [WIP] Add a page for real time observable query diagnostics Add observable query diagnostics page May 27, 2026
Copilot finished work on behalf of einari May 27, 2026 17:43
Copilot AI requested a review from einari May 27, 2026 17:43
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.

Add a page for real time observable query diagnostics

2 participants