Skip to content

feat(app-preview): answer appData() from the newest successful run - #620

Draft
tkislan wants to merge 4 commits into
tomaskislan/app-preview-runsfrom
tomaskislan/app-preview-app-data
Draft

tkislan wants to merge 4 commits into
tomaskislan/app-preview-runsfrom
tomaskislan/app-preview-app-data

Conversation

@tkislan

@tkislan tkislan commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

@coderabbitai ignore

Summary

In the app preview, a page's appData() answers from that notebook's newest successful run() in the preview, instead of "not supported". Pages can then show the last results on load without running anything.

Changes

  • GET /v2/notebooks/:notebookId/app-data reads the run store and picks the notebook's newest successful run, by createdAt. It answers Deepnote's body:
    • appData: the first application/json output that is a JSON object (not an array, not null), across blocks and their outputs in order.
    • agentBlockSummary: the first agent block's markdown output; else its stream text, which is how runtime-core emits an agent's answer; else null.
    • runCreatedAt: the run's creation time.
  • Errors, using Deepnote's 404 messages:
    • no successful run: You have no run results for this notebook yet. Run the notebook to load them.;
    • no JSON object: Your latest run has no JSON output.;
    • an unknown notebook ID: Notebook not found.
  • Results live as long as the preview session. Reloading the window clears them.
  • README.

Testing

  • Unit tests for the route:
    • no run, failed runs only, the newest of two successful runs;
    • a run still in flight and overlapping runs;
    • arrays and null skipped;
    • no JSON object;
    • the agent summary from markdown, from stream text, and null;
    • an unknown notebook.
  • E2E, in the appPreview group: appData() rejects before a run. After a successful run(), it returns the run's JSON object and runCreatedAt.
  • The E2E tests no longer check for "not supported" warnings. The one stub left is dataframe()'s route, which the bundled copy of Deepnote's client never calls, so no page can reach it. The warning stays covered by unit tests.

Notes

  • There is no E2E for the agent summary. Preview runs read the model key from VS Code's own environment, and setting it would change it for the whole E2E group.
  • runtime-core ignores clear_output and update_display_data, so a block that redraws its JSON answers with its first version.

Stacked on #619.

@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.36842% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 39%. Comparing base (8fb1292) to head (bdaf545).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...otebooks/deepnote/appPreview/appPreviewApi.node.ts 97% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                     Coverage Diff                      @@
##           tomaskislan/app-preview-runs    #620   +/-   ##
============================================================
  Coverage                            39%     39%           
============================================================
  Files                               834     834           
  Lines                             42110   42147   +37     
  Branches                           9246    9255    +9     
============================================================
+ Hits                              16581   16618   +37     
  Misses                            23431   23431           
  Partials                           2098    2098           
Files with missing lines Coverage Δ
...otebooks/deepnote/appPreview/appPreviewApi.node.ts 97% <97%> (-1%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

GET /notebooks/:notebookId/app-data now answers from the newest successful
preview run of the notebook, with Deepnote's body { appData,
agentBlockSummary, runCreatedAt } and its two 404 messages. appData is the
first application/json output that is an object. The agent summary is the
first agent block's markdown, or its stream text, since runtime-core emits an
agent's answer as stream output.

dataframe() is now the only stub that warns.
A new test previews a page that calls appData() before a run, which rejects
with Deepnote's no-results message, then run(), then appData() again, which
answers the run's JSON output and its createdAt.

The shared fixture page now calls dataframe() twice instead of appData(), so
the warn-once checks use the only stub left. The apps those checks preview
hold a project, so dataframe() reaches the preview; the inputs test checks the
in-page rejection of an app without one.
Pin how appData() picks its run with a test that drives runs through POST
/runs: it answers the newest started successful run, not the one that
finished last, and skips a run still in flight.

Wrap isObject in a guard typed as Record<string, unknown>. Its own
`obj is any` guard turned off type checking in the functions that build the
appData() body.
@tkislan
tkislan force-pushed the tomaskislan/app-preview-app-data branch from 8752d8a to bdaf545 Compare November 18, 2026 15:52
@tkislan
tkislan force-pushed the tomaskislan/app-preview-runs branch from b8f166d to 8fb1292 Compare November 18, 2026 15:52
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.

1 participant