Skip to content

feat(data-inspector): copy query results with context - #485

Open
SaKaNa-Y wants to merge 1 commit into
devframes:mainfrom
SaKaNa-Y:feat/data-inspector-query-context
Open

SaKaNa-Y wants to merge 1 commit into
devframes:mainfrom
SaKaNa-Y:feat/data-inspector-query-context

Conversation

@SaKaNa-Y

@SaKaNa-Y SaKaNa-Y commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Closes #473

Summary

Sharing a Data Inspector result currently requires copying the JSON and separately recording its source, query, filters and time. A shared query link runs against current data, so a teammate can miss the original observation if that data changes.

Add a document icon beside JSON copy that copies one successful result with its context as Markdown. Capture the query conditions with the request and show when the retained result predates edits, a pending query or a failure. Include the browser receipt time and known conversion and truncation limits.

successful response + executed conditions
  → result-only JSON
  → Markdown with context and data limits

Switching sources clears the previous result and rejects late responses from the old source. Both copy actions wait for clipboard success and offer the complete text for manual copying if the write fails.

Evidence

  • Before: JSON copy includes only the result, so its query context needs to be added separately.
    After: Markdown includes the matching source, query, filters, receipt time, result and limits; JSON copy remains available.
  • pnpm lint, pnpm knip, pnpm typecheck and pnpm build passed.
  • pnpm test --run: 1,857 passed, 14 skipped.
  • 18 Chrome acceptance scenarios passed, including source changes, late responses, empty results, clipboard failures, auto-refresh during copying and lazy expansion.

Merge Danger

Door: Two-way. No storage migration or RPC contract changes.

Blast Radius: Data Inspector. Source-switch clearing and reliable clipboard feedback apply to the existing JSON action as well as the new Markdown action.

@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
devframe Skipped Skipped Nov 5, 2026 7:38am UTC

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

👁️‍🗨️ Review this pull request with grouped, summarized diffs at:
👉 https://pulls.review/gh/devframes/devframe/485?from=github-actions[bot]

raw result

💭 analyzed by vercel-ai-gateway/anthropic/claude-sonnet-5
🕰️ 2026-11-05 07:38 UTC
🔗 head 234632b
🤖 automated by pulls.review

{
  "headSha": "234632b71166cf0470fe6212dbbe8dde57180a18",
  "result": {
    "overallSummary": "Adds a \"copy with context\" action to the Data Inspector's result viewer: a successful query's result is now captured together with the exact source, query, filters and receipt time that produced it, exportable as Markdown (with staleness notices and documented truncation limits) alongside the existing JSON copy. Both copy actions now wait for clipboard success and fall back to a manual-copy dialog on failure, and switching sources clears the retained result and discards late responses from the old source.",
    "groups": [
      {
        "key": "core-observation",
        "label": "Query observation logic",
        "summary": "Introduces a `QueryObservation` that pins the result to the query, filters, source and receipt time at the moment of success, renders it as Markdown with explicit data limits, and clears/guards it on source switches and late (stale) responses.",
        "category": "core",
        "filePaths": [
          "plugins/data-inspector/app/composables/query-observation.ts",
          "plugins/data-inspector/app/composables/workbench.ts"
        ],
        "critical": true,
        "lineNotes": [
          {
            "path": "plugins/data-inspector/app/composables/workbench.ts",
            "side": "additions",
            "line": 298,
            "text": "Request (source/query/filters) is captured before the await so a later edit or source switch can't change what gets attributed to this response."
          }
        ]
      },
      {
        "key": "ui-copy-actions",
        "label": "Copy result UI",
        "summary": "Adds a second copy action (Markdown with context) beside the existing JSON copy, surfaces staleness notices, and adds a manual-copy fallback modal when the clipboard write fails for either action.",
        "category": "ui",
        "filePaths": [
          "plugins/data-inspector/app/components/ResultViewer.vue",
          "plugins/data-inspector/app/App.vue"
        ],
        "lineNotes": [
          {
            "path": "plugins/data-inspector/app/components/ResultViewer.vue",
            "side": "additions",
            "line": 90,
            "text": "Result is serialized synchronously at click time from `props.observation`, not from `props.result`, so a refresh landing mid-copy can't change the copied text."
          }
        ]
      },
      {
        "key": "tests",
        "label": "Tests",
        "summary": "Unit tests for Markdown rendering edge cases (backtick fencing, truncation reporting) and workbench behavior around source switches, stale responses, and conditions-changed notices.",
        "category": "tests",
        "filePaths": [
          "plugins/data-inspector/test/query-observation.test.ts",
          "plugins/data-inspector/test/workbench-observation.test.ts"
        ],
        "fileNotes": [
          {
            "path": "plugins/data-inspector/test/workbench-observation.test.ts",
            "text": "Covers the race conditions between source switches and in-flight queries (old-source and old-filter responses must be dropped)."
          }
        ]
      }
    ],
    "schemaVersion": 1,
    "source": "llm",
    "generatedAt": "2026-11-05T07:38:32.834Z",
    "model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
    "locale": "en"
  }
}

Sharing a query result requires its source and executed conditions to make
sense of the observation. Capture them with the successful response and
copy the result, receipt time and data limits as Markdown.

Preserve result-only JSON copying. Explain retained results, clear them on
source changes, reject late responses and provide complete manual text when
clipboard writes fail.
@SaKaNa-Y
SaKaNa-Y force-pushed the feat/data-inspector-query-context branch from d561c8a to 234632b Compare November 5, 2026 07:37
@SaKaNa-Y

SaKaNa-Y commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

This PR focus on copying a query result with its context as Markdown.

I also have some other ideas, but they still need more thought. I plan to discuss them after this PR merges.

@SaKaNa-Y
SaKaNa-Y requested a review from antfu November 5, 2026 14:04

This branch was previously deployed

1 inactive deployment
Preview — 234632b7 Deployed Nov 5, 2026 by vercel[bot]
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.

Feature request: copy Data Inspector query results with context

1 participant