Skip to content

feat(dashboards): table-backed dashboards as a gated workspace resource - #8305

Open
TheodoreSpeaks wants to merge 31 commits into
stagingfrom
codex/research-sim-dashboards
Open

TheodoreSpeaks wants to merge 31 commits into
stagingfrom
codex/research-sim-dashboards

Conversation

@TheodoreSpeaks

@TheodoreSpeaks TheodoreSpeaks commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds dashboards as a workspace resource with their own navigation, folders, resource tabs, and Mothership tools. Dashboard YAML selects authorized table queries and lays out metrics, ECharts charts, tables, text, and tabs. Aggregation runs on the server, with bounded results and timeouts.

Companion: https://github.com/simstudioai/mothership/pull/531

  • Controls: shared time-range and timezone controls, drag-to-select ranges, synchronized hover values, floating tooltips, responsive layout, muted EMCN styling, and animated numeric metrics.
  • Horizontal bar charts: each frame grows with its row count and keeps any label column the author set. The row highlight covers both the label and the bar.
  • Conditional percentages: aggregates reuse the existing table filter grammar. The denominator is all rows in the scoped group, and an empty group stays null, so tables no longer need 100/0 helper columns.
  • Storage:
    • Dashboards reuse file storage and versioning, with the backing extension hidden.
    • Updates require an expected revision.
    • Dashboard and folder operations go through the shared authorization boundary.
  • Validation: create and update validate the YAML before saving and return readable path: message errors. They do not check table columns or run queries.
  • File discovery:
    • Files are marked listed or unlisted, separately from their storage and ownership context.
    • Files listings, the Mothership file inventory, pickers, and search filter in SQL before pagination.
    • Chat uploads and dashboard definitions are unlisted; dashboards have their own listing API.
    • Explicit references keep their existing authorization, and copies preserve discovery.
  • Rollout flag: dashboards sit behind a default-off runtime flag that can target all organizations or specific ones. It gates the UI, the APIs, analytics, and authoring. Local development can set DASHBOARDS=true.

Type of Change

  • New feature

Testing

  • 92 focused test files (853 tests) pass across dashboards, charts, Chat context, uploads, folders, and the v2 file routes.
  • Chart layout regression tests use the real renderer. Each one failed before its fix.
  • Real PostgreSQL integration tests cover:
    • the analytics compiler and conditional percentages
    • discovery replay: legacy upload writers, pagination, explicit chat references, and stale search builds
  • Type-check (all workspaces), lint:check, check:test-patterns, and migration checks (check:migrations, drizzle-kit check) pass after merging staging.
  • check:dead-code flags only a local research folder that is not committed.
  • Applied the migrations locally and confirmed the dashboard renders. Mothership's picker lists it under Dashboards and leaves its backing file out of Files.

Reviewers, please focus on:

  • the shared chart renderer
  • table aggregate semantics
  • the discovery lifecycle
  • the rollout gates

Two behaviors to keep in mind:

  • An idle chart summary describes the plotted buckets. An average of bucket percentages is not a weighted overall rate.
  • Independent panels share time bounds, not a database snapshot.

Rollout and scope

This PR targets staging and adds three migrations:

  • 0391_dashboard_folders adds dashboard to the existing folder resource enum. It creates no new table.
  • 0392_file_discovery:
    • adds the defaulted discovery column
    • updates which files the search index includes
    • installs a temporary bridge for old upload writers
  • Script migration 0027_backfill_file_discovery classifies existing non-workspace uploads in idempotent pages of 1,000. It rewrites no content or ownership.

There is no dashboard backfill, because dashboards have not shipped. A documented follow-up removes the bridge once all writers are aware of discovery.

The companion Mothership PR adds dashboard CLI authoring and persists per-turn rollout availability. Apply both repositories' additive migrations and deploy the worker before enabling dashboards.

Not included: no merge or deployment. Public sharing, log queries, and a tool for inspecting the data a user sees on screen are deferred.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

https://claude.ai/code/session_01S6aTRnkiu7PxYZPNPXYEMV

@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 29, 2026 4:13am UTC

Request Review

@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Sep 25, 2026
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

⚠️ Cross-repo companion check

One or more companion PRs aren't merged into staging yet. Merging this without them will leave copilot and sim out of sync — merge them in lockstep.

  • ❌ simstudioai/mothership#531 — OPEN, not merged (targets staging) — feat(dashboards): add gated dashboard resource authoring

TheodoreSpeaks and others added 2 commits September 26, 2026 12:33
Dashboards are now ordinary workspace files, handled like Sim pages, instead
of a separate resource. Creating or uploading `<Name>.dashboard` drops the
suffix and stamps `text/x-sim-dashboard`; the type is sticky across content
writes. The file viewer renders it live behind the `dashboards` flag, and the
public share viewer shows a workspace-only notice.

- Remove the dashboard resource: sidebar page, API routes, hooks, contracts,
  application layer, Mothership dashboards/dashboard_folders tools, resource
  tags, and the per-turn dashboardsEnabled payload.
- Revert the file discovery column (0385) and drop the dashboard folder
  resource enum (0384); dashboards never shipped, so no backfill.
- Chat panel decides previewability and tab/picker icons from the file type,
  not the name, so extensionless dashboards render and get the chart icon.
- Renderer: authored left label columns are kept intact, horizontal bar
  frames grow with row count, and hovered rows get a label-and-bar highlight.
- Simplify the create-dashboard skill around one validated example.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6aTRnkiu7PxYZPNPXYEMV
Resolves conflicts in the feature-flag and skill use-case tests (moved onto
staging's central mocks) and the tab strip widths. Adapts the branch's
dashboard and analytics tests to staging's test-pattern audit, scopes the
table operation delegation invariant to operations that admit delegated
principals, and hides the rollout-gated create-dashboard built-in from the
organization composer when the dashboards flag is off.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6aTRnkiu7PxYZPNPXYEMV
@TheodoreSpeaks TheodoreSpeaks changed the title feat(dashboards): add table-backed dashboard resources feat(dashboards): table-backed dashboard files behind a rollout flag Sep 26, 2026
@TheodoreSpeaks
TheodoreSpeaks marked this pull request as ready for review September 26, 2026 19:45
@TheodoreSpeaks
TheodoreSpeaks requested a review from a team as a code owner September 26, 2026 19:45
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete.

@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Adds new dashboard feature with API routes and database operations.

The PR appears safe to merge based on the changes since the previous review and the current state of earlier findings.

Summary

This PR adds gated, table-backed dashboards with workspace navigation, server-side analytics, file discovery controls, and supporting migrations.

  • Since the previous review, the dashboard page’s inline props type was replaced with a named interface.
  • No new actionable issue was identified in that change.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  UI[Dashboard workspace view] --> API[Dashboard APIs]
  API --> Files[Versioned file storage]
  UI --> Analytics[Authorized table analytics API]
  Analytics --> Tables[Workspace table rows]
Loading

Reviews (19) · Last reviewed commit: "fix(dashboards): name the dashboards pag..."

Comment thread apps/sim/lib/workflows/skills/builtin-skills.ts
Comment thread apps/sim/components/charts/echarts-view.test.tsx Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 86 files

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread apps/sim/lib/charts/option.ts
Comment thread apps/sim/lib/charts/summary.ts Outdated
Comment thread apps/sim/lib/charts/time-series.ts
Comment thread apps/sim/lib/table/analytics/query.ts
Comment thread apps/sim/components/dashboards/dashboard-controls.tsx
Comment thread apps/sim/lib/charts/bar-row-highlight.ts Outdated
- Size horizontal bar `.chart` previews by category count like dashboard panels.
- Keep the ECharts label column for percentage bar widths, resolve percentage
  grid insets for the row highlight, and keep the time axis on the queried range.
- Show small readout values with significant digits instead of rounding to 0.
- Pass the dashboard's timezone-adjusted today to the range calendar.
- Decide the Chat panel's Markdown mode from the file record.
- Replace mock-call assertions in the EChartsView tests with DOM behavior.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6aTRnkiu7PxYZPNPXYEMV
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 86 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/charts/option.ts Outdated
Comment thread apps/sim/lib/charts/bar-row-highlight.ts Outdated
… resizes

Unstacked bar series sit side by side in a category row, so grouped charts keep
the ECharts label column and their rows fit every bar slot. The row highlight
redraws the active row after each render, so a resize moves it with the plot.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6aTRnkiu7PxYZPNPXYEMV
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete.

Comment thread apps/sim/app/workspace/[workspaceId]/dashboards/dashboard-dialog.tsx Outdated
Comment thread apps/sim/lib/dashboards/application/dashboards.ts
Comment thread apps/sim/app/workspace/[workspaceId]/dashboards/[dashboardId]/page.tsx Outdated
Comment thread apps/sim/lib/dashboards/README.md Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 164 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread apps/sim/ee/workspace-forking/lib/copy/copy-files.ts
Comment thread apps/sim/lib/api/contracts/mothership-management-tools.ts
Comment thread apps/sim/app/workspace/[workspaceId]/files/hooks/use-workspace-files-room.ts Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/dashboards/dashboards.tsx Outdated
Comment thread packages/emcn/src/components/tab-strip/tab-strip.tsx Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/dashboards/dashboard-dialog.tsx Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/dashboards/dashboard-dialog.tsx Outdated
Comment thread apps/sim/lib/dashboards/application/dashboards.ts
Comment thread apps/sim/lib/dashboards/application/dashboards.ts Outdated
TheodoreSpeaks and others added 2 commits September 28, 2026 19:44
…-dashboards

# Conflicts:
#	packages/db/script-migrations/index.ts
The dashboard browser now asks for one folder's dashboards instead of
filtering the first 500 across the workspace, folder paths use the shared
segment encoder, and the README names the renumbered migrations.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6aTRnkiu7PxYZPNPXYEMV
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 166 files

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/app/workspace/[workspaceId]/dashboards/dashboards.tsx
Comment thread apps/sim/hooks/queries/dashboards.ts Outdated
Comment thread apps/sim/lib/api/contracts/dashboards.ts Outdated
Fork payloads accept file discovery, dashboard queries are keyed and
invalidated per workspace, dashboard contexts open tabs and resolve in
organization chats, archived dashboard folders keep their paths, and the
folder dialog skips no-op moves and hides the edited subtree.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6aTRnkiu7PxYZPNPXYEMV
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 170 files

Confidence score: 3/5

  • In apps/sim/app/workspace/[workspaceId]/dashboards/dashboard-dialog.tsx, moving a dashboard to a path whose name already exists can silently nest it (for example, /Archive/Reports becomes /Reports/Reports); reject the occupied destination or clearly resolve the name collision.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/app/workspace/[workspaceId]/dashboards/dashboard-dialog.tsx">

<violation number="1" location="apps/sim/app/workspace/[workspaceId]/dashboards/dashboard-dialog.tsx:109">
P2: An occupied destination path is treated as a folder to move into, so moving `/Archive/Reports` to the root while `/Reports` already exists silently nests it at `/Reports/Reports`. Reject or clearly resolve the name collision before submitting this move.</violation>
</file>

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/dashboards/application/folders.ts Outdated
Comment thread apps/sim/lib/api/contracts/dashboards.ts
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6aTRnkiu7PxYZPNPXYEMV
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 170 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Re-trigger cubic

Comment thread apps/sim/app/workspace/[workspaceId]/dashboards/page.tsx Outdated
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6aTRnkiu7PxYZPNPXYEMV
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 170 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — 2e5d6dc3 Deployed Sep 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant