Skip to content

store dashboard results locally instead of on mothership#229

Merged
vkarpov15 merged 3 commits intomainfrom
vkarpov15/dashboard-result-local-2
Apr 18, 2026
Merged

store dashboard results locally instead of on mothership#229
vkarpov15 merged 3 commits intomainfrom
vkarpov15/dashboard-result-local-2

Conversation

@vkarpov15
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 18, 2026 21:01
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 18, 2026

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

Project Deployment Actions Updated (UTC)
studio Ready Ready Preview, Comment Apr 18, 2026 9:09pm

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae18e38ff7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +41 to 43
const startExec = startDashboardEvaluate(DashboardResult, dashboardId, $workspaceId, userId);
try {
result = await dashboard.evaluate();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add immediate rejection handling for startEval promise

The promise returned by startDashboardEvaluate() is created and left without a rejection handler until after await dashboard.evaluate() completes. If DashboardResult.create() rejects quickly (for example during a transient studioConnection write failure) while evaluation is still in flight, this becomes an unhandled rejection; with modern Node defaults this can terminate the process before the later .then(...) is attached. Attach a catch immediately (or await the start promise before evaluation) to avoid the race.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR changes dashboard evaluation result storage to persist locally (via the studioConnection) instead of relying on the mothership, while still supporting fetching/merging mothership results for backwards compatibility.

Changes:

  • Added a local __Studio_DashboardResult model/schema and wired it into backend initialization.
  • Updated Dashboard actions to use studioConnection and adjusted getDashboard() to persist evaluation status/results locally and merge with remote results when listing.
  • Updated and expanded test coverage to validate local persistence and local+remote merge behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
backend/index.js Registers the new __Studio_DashboardResult model on studioConnection and passes studioConnection into actions.
backend/db/dashboardResultSchema.js Introduces schema/index for locally persisted dashboard evaluation results.
backend/actions/Dashboard/getDashboard.js Persists evaluation results locally, fetches mothership results in parallel, and merges/sorts combined results.
backend/actions/Dashboard/createDashboard.js Switches to studioConnection for dashboard creation.
backend/actions/Dashboard/updateDashboard.js Switches to studioConnection for dashboard updates.
backend/actions/Dashboard/deleteDashboard.js Switches to studioConnection and deletes associated local results on dashboard deletion.
backend/actions/Dashboard/getDashboards.js Switches to studioConnection for listing dashboards.
test/setup.test.js Exports studioConnection for tests that need direct model access on the studio DB.
test/Dashboard.updateDashboard.test.js Uses studioConnection to validate dashboard updates against the correct DB.
test/Dashboard.getDashboard.error.test.js Updates expectations to assert evaluation failures are persisted locally.
test/Dashboard.getDashboard.results.test.js New tests validating local persistence, retrieval, and local+remote merge behavior.
test/Dashboard.evaluate.objectid.test.js Uses studioConnection to define the Dashboard model for evaluation tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +41 to 43
const startExec = startDashboardEvaluate(DashboardResult, dashboardId, $workspaceId, userId);
try {
result = await dashboard.evaluate();
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

startExec is created without any rejection handler until after await dashboard.evaluate(). If DashboardResult.create() rejects before evaluation finishes, Node may emit an unhandled rejection (and potentially terminate the process, depending on runtime settings). Attach a .catch() immediately (or wrap with a helper that always resolves) and then await the handled promise later.

Copilot uses AI. Check for mistakes.
Comment thread backend/actions/Dashboard/getDashboard.js
Comment thread backend/db/dashboardResultSchema.js Outdated
Comment thread backend/actions/Dashboard/updateDashboard.js
@vkarpov15 vkarpov15 merged commit c63b6e4 into main Apr 18, 2026
30 checks passed
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.

2 participants