Skip to content

refactor(dashboard): group run/db/artifact/hook lib modules into folders#63

Merged
joefairburn merged 4 commits into
mainfrom
refactor/runs-lib-folder
Jul 23, 2026
Merged

refactor(dashboard): group run/db/artifact/hook lib modules into folders#63
joefairburn merged 4 commits into
mainfrom
refactor/runs-lib-folder

Conversation

@joefairburn

@joefairburn joefairburn commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

Pure file-reorganization refactor of apps/dashboard/src/lib/ — moves + import-specifier rewrites only, no logic changes. Follows the same playbook as #61 (github-* modules -> lib/github/).

File mapping

Old New
run-columns.ts runs/columns.ts
run-diff.ts runs/diff.ts
run-outcome.ts runs/outcome.ts
run-read-model.ts runs/read-model.ts
run-groups-page.ts runs/groups-page.ts
run-results-page.ts runs/results-page.ts
runs-filters.ts runs/filters.ts
runs-filters-where.ts runs/filters-where.ts
db-run.ts runs/db.ts
db-batch.ts db/batch.ts
artifact-tokens.ts artifacts/tokens.ts
trace-artifacts.ts artifacts/trace.ts
artifacts.ts artifacts/store.ts
use-search-param.ts hooks/use-search-param.ts
use-copied-flag.ts hooks/use-copied-flag.ts

All moves done via git mv so rename detection stays clean. No index.ts barrel files were added — runs/, db/, artifacts/, and hooks/ all deliberately stay barrel-free, matching the existing repo convention (and the same call made in #61).

Every @/lib/<old> specifier was rewritten repo-wide to the new path (routes/, pages/, packages/reporter, packages/e2e, etc.), plus a handful of relative imports and doc-comment references (AGENTS.md, docs/ARCHITECTURE.md, db/schema.ts, a few src/lib/*.ts doc comments, and the reporter's cross-package contract test import of trace.ts). Test files under src/__tests__/ were not renamed.

Verification

  • grep -rn '@/lib/run-\|@/lib/runs-\|@/lib/db-run\|@/lib/db-batch\|@/lib/artifact-tokens\|@/lib/trace-artifacts\|@/lib/use-search-param\|@/lib/use-copied-flag' --include='*.ts' --include='*.tsx' . -> zero hits
  • Bare @/lib/artifacts" / @/lib/artifacts' specifiers -> zero hits (only the intended @/lib/artifacts/{presign,serve,store,tokens,trace} subpaths remain)
  • Diff sanity-checked line by line: every changed line in non-moved files is a path rewrite (or the one relative-import depth fix in schemas.ts / artifacts/trace.ts), nothing else
  • pnpm test — dashboard: 116 files / 1360 tests passed; reporter: 17 files / 300 tests passed
  • pnpm check — exit 0, 0 errors, 141 warnings (pre-existing, in untouched files)

Notes for reviewers

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

Summary by CodeRabbit

  • New Features
    • Added run-to-run comparison with newly failed/passed, persistent, flaky, added, and removed tests.
    • Improved run filtering with validated URL-backed filter and pagination state.
    • Added clearer outcome totals, including pending counts.
    • Added trace availability indicators on test results.
    • Added transient “copied” UI feedback for copy actions.
  • Refactor
    • Consolidated shared run, artifact, and database helpers while preserving existing behavior.
  • Documentation
    • Updated architecture/developer guidance to match current conventions.
  • Tests
    • Updated test wiring to reflect the new shared helper locations.

Pure move: git mv the run-*, db-run, db-batch, artifact-tokens,
trace-artifacts, artifacts, use-search-param, and use-copied-flag modules
in apps/dashboard/src/lib/ into runs/, db/, artifacts/, and hooks/
folders, and rewrite every @/lib/<old> specifier (plus the handful of
relative imports and doc-comment references) to match. No logic changes.

- run-columns.ts, run-diff.ts, run-outcome.ts, run-read-model.ts,
  run-groups-page.ts, run-results-page.ts, runs-filters.ts,
  runs-filters-where.ts, db-run.ts -> runs/{columns,diff,outcome,
  read-model,groups-page,results-page,filters,filters-where,db}.ts
- db-batch.ts -> db/batch.ts
- artifact-tokens.ts, trace-artifacts.ts, artifacts.ts ->
  artifacts/{tokens,trace,store}.ts
- use-search-param.ts, use-copied-flag.ts -> hooks/use-{search-param,
  copied-flag}.ts

Deliberately no index.ts barrel files in runs/, db/, artifacts/, or
hooks/, matching the repo's existing no-barrel convention.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
wrightful 285b525 Jul 23 2026, 11:26 AM

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4466a890-5c3d-4f70-b982-fa3d23d24b3d

📥 Commits

Reviewing files that changed from the base of the PR and between 3c4c99b and 285b525.

📒 Files selected for processing (3)
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/tests.server.ts
  • apps/dashboard/src/components/run/history-branch-filter.tsx
  • apps/dashboard/src/lib/page-window.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/tests.server.ts
  • apps/dashboard/src/components/run/history-branch-filter.tsx
  • apps/dashboard/src/lib/page-window.ts

📝 Walkthrough

Walkthrough

The PR adds shared database, run-query, filtering, run-diff, outcome, URL-state, copy-feedback, and trace-presence helpers. It updates dashboard consumers, tests, comments, schema references, and documentation to use canonical module paths.

Changes

Dashboard helpers and module paths

Layer / File(s) Summary
Shared helper implementations
apps/dashboard/src/lib/db/batch.ts, apps/dashboard/src/lib/runs/*, apps/dashboard/src/lib/hooks/*, apps/dashboard/src/lib/trace-presence.ts
Adds shared database, run-query, filtering, outcome, URL-state, copy-feedback, run-diff, and trace-presence helpers.
Application consumers use canonical modules
apps/dashboard/pages/*, apps/dashboard/routes/*, apps/dashboard/src/lib/*, apps/dashboard/src/components/*, apps/dashboard/src/realtime/*
Redirects existing imports to canonical database, run, artifact, trace, and hook modules without changing surrounding logic.
Tests and source references
apps/dashboard/src/__tests__/*, docs/ARCHITECTURE.md, AGENTS.md, packages/e2e/*, packages/reporter/*, apps/dashboard/db/schema.ts
Updates test imports and mocks plus documentation, schema comments, and cross-package references to match canonical module locations.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • joefairburn/wrightful#60: Updates the same github-pr-comment.ts dependencies while implementing sticky GitHub PR comments.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main refactor of dashboard lib modules into folders.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/runs-lib-folder

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/dashboard/src/lib/hooks/use-copied-flag.ts`:
- Around line 26-33: Update the useCopiedFlag hook’s flash callback and cleanup
to track whether the component is mounted, and return immediately when flash is
invoked after unmount. Ensure asynchronous callers such as artifacts-rail.tsx
and errors-tab.tsx cannot schedule a timer or call setCopied after cleanup.

In `@apps/dashboard/src/lib/runs/filters.ts`:
- Around line 90-94: Update parsePage to validate that raw is a complete numeric
token before conversion, rejecting values such as “2oops” and falling back to 1.
Apply the same full-token validation to the PR filter parsing logic around the
corresponding lines, preserving the documented invalid-input fallback and exact
PR filter behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b0837e9-253f-4c15-a5de-aa8037a04365

📥 Commits

Reviewing files that changed from the base of the PR and between 482ba9b and 67a3749.

📒 Files selected for processing (122)
  • AGENTS.md
  • apps/dashboard/db/schema.ts
  • apps/dashboard/middleware/00.cache.ts
  • apps/dashboard/pages/invite/[token]/index.server.ts
  • apps/dashboard/pages/oauth/consent.server.ts
  • apps/dashboard/pages/settings/teams/[teamSlug]/audit.server.ts
  • apps/dashboard/pages/settings/teams/[teamSlug]/general.server.ts
  • apps/dashboard/pages/settings/teams/[teamSlug]/members.tsx
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/flaky.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/index.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/index.tsx
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/run-duration.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/slowest-tests.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/suite-size.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/runs/[runId]/diff.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/runs/[runId]/diff.tsx
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/runs/[runId]/index.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/runs/[runId]/tests/[testResultId]/index.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/tests.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/tests/[testId]/index.server.ts
  • apps/dashboard/routes/api/artifacts/[id]/download.ts
  • apps/dashboard/routes/api/artifacts/[id]/upload.ts
  • apps/dashboard/routes/api/artifacts/register.ts
  • apps/dashboard/routes/api/github/setup.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/export/runs.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/runs/[runId]/diff.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/runs/[runId]/groups.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/runs/[runId]/results.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/runs/[runId]/summary.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/runs/[runId]/tests/[testResultId]/replay.ts
  • apps/dashboard/routes/api/v1/runs/[runId]/index.ts
  • apps/dashboard/routes/api/v1/runs/[runId]/tests.ts
  • apps/dashboard/routes/api/v1/runs/index.ts
  • apps/dashboard/src/__tests__/artifact-origin-safety.workers.test.ts
  • apps/dashboard/src/__tests__/artifact-response.workers.test.ts
  • apps/dashboard/src/__tests__/artifact-tokens.workers.test.ts
  • apps/dashboard/src/__tests__/artifacts-pipeline.test.ts
  • apps/dashboard/src/__tests__/db-batch.workers.test.ts
  • apps/dashboard/src/__tests__/download-route.workers.test.ts
  • apps/dashboard/src/__tests__/export-where.workers.test.ts
  • apps/dashboard/src/__tests__/github-pr-comment.workers.test.ts
  • apps/dashboard/src/__tests__/mcp-server.workers.test.ts
  • apps/dashboard/src/__tests__/pg-integration/analytics-numeric.test.ts
  • apps/dashboard/src/__tests__/pg-integration/ingest.test.ts
  • apps/dashboard/src/__tests__/pg-integration/pagination.test.ts
  • apps/dashboard/src/__tests__/r2-live.test.ts
  • apps/dashboard/src/__tests__/run-columns.test.ts
  • apps/dashboard/src/__tests__/run-diff-resolve.workers.test.ts
  • apps/dashboard/src/__tests__/run-diff.workers.test.ts
  • apps/dashboard/src/__tests__/run-outcome-totals.workers.test.ts
  • apps/dashboard/src/__tests__/run-read-model.workers.test.ts
  • apps/dashboard/src/__tests__/run-results-page.workers.test.ts
  • apps/dashboard/src/__tests__/runs-filters-pr-commit.workers.test.ts
  • apps/dashboard/src/__tests__/runs-filters-where.workers.test.ts
  • apps/dashboard/src/__tests__/scope-where.workers.test.ts
  • apps/dashboard/src/__tests__/test-artifact-actions-signing.test.ts
  • apps/dashboard/src/__tests__/trace-artifacts.test.ts
  • apps/dashboard/src/__tests__/trace-viewer-dialog.test.tsx
  • apps/dashboard/src/__tests__/usage.workers.test.ts
  • apps/dashboard/src/__tests__/user-teardown.workers.test.ts
  • apps/dashboard/src/components/artifacts-rail.tsx
  • apps/dashboard/src/components/attempt-tabs.tsx
  • apps/dashboard/src/components/run-history-branch-filter.tsx
  • apps/dashboard/src/components/run-list-row.tsx
  • apps/dashboard/src/components/run-progress-group.tsx
  • apps/dashboard/src/components/run-progress.tsx
  • apps/dashboard/src/components/runs-filter-bar.tsx
  • apps/dashboard/src/components/trace-viewer-dialog.tsx
  • apps/dashboard/src/components/visual-diff-dialog.tsx
  • apps/dashboard/src/lib/action-errors.ts
  • apps/dashboard/src/lib/analytics/filters.ts
  • apps/dashboard/src/lib/api-response-types.ts
  • apps/dashboard/src/lib/artifacts/serve.ts
  • apps/dashboard/src/lib/artifacts/store.ts
  • apps/dashboard/src/lib/artifacts/tokens.ts
  • apps/dashboard/src/lib/artifacts/trace.ts
  • apps/dashboard/src/lib/billing/polar-webhook.ts
  • apps/dashboard/src/lib/command-search.ts
  • apps/dashboard/src/lib/content-types.ts
  • apps/dashboard/src/lib/date-range-presets.ts
  • apps/dashboard/src/lib/db/batch.ts
  • apps/dashboard/src/lib/db/query-tags.ts
  • apps/dashboard/src/lib/db/sql-ops.ts
  • apps/dashboard/src/lib/export.ts
  • apps/dashboard/src/lib/github-checks.ts
  • apps/dashboard/src/lib/github-pr-comment.ts
  • apps/dashboard/src/lib/hooks/use-copied-flag.ts
  • apps/dashboard/src/lib/hooks/use-search-param.ts
  • apps/dashboard/src/lib/ingest.ts
  • apps/dashboard/src/lib/invites.ts
  • apps/dashboard/src/lib/mcp/queries.ts
  • apps/dashboard/src/lib/mcp/server.ts
  • apps/dashboard/src/lib/members-repo.ts
  • apps/dashboard/src/lib/monitors/http/uptime-analytics.ts
  • apps/dashboard/src/lib/monitors/monitors-repo.ts
  • apps/dashboard/src/lib/monitors/scheduler.ts
  • apps/dashboard/src/lib/owners-repo.ts
  • apps/dashboard/src/lib/page-window.ts
  • apps/dashboard/src/lib/project-teardown.ts
  • apps/dashboard/src/lib/provisioning.ts
  • apps/dashboard/src/lib/retention.ts
  • apps/dashboard/src/lib/runs/columns.ts
  • apps/dashboard/src/lib/runs/db.ts
  • apps/dashboard/src/lib/runs/diff.ts
  • apps/dashboard/src/lib/runs/filters-where.ts
  • apps/dashboard/src/lib/runs/filters.ts
  • apps/dashboard/src/lib/runs/groups-page.ts
  • apps/dashboard/src/lib/runs/outcome.ts
  • apps/dashboard/src/lib/runs/read-model.ts
  • apps/dashboard/src/lib/runs/results-page.ts
  • apps/dashboard/src/lib/schemas.ts
  • apps/dashboard/src/lib/test-artifact-actions.ts
  • apps/dashboard/src/lib/trace-presence.ts
  • apps/dashboard/src/lib/usage.ts
  • apps/dashboard/src/lib/user-teardown.ts
  • apps/dashboard/src/realtime/project-feed.ts
  • apps/dashboard/src/realtime/use-project-room.ts
  • apps/dashboard/src/trace-viewer/components/errors-tab.tsx
  • docs/ARCHITECTURE.md
  • packages/e2e/src/e2e.test.ts
  • packages/e2e/tests-dashboard/test-replay.spec.ts
  • packages/reporter/src/__tests__/contract.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/dashboard/src/lib/hooks/use-copied-flag.ts`:
- Around line 26-33: Update the useCopiedFlag hook’s flash callback and cleanup
to track whether the component is mounted, and return immediately when flash is
invoked after unmount. Ensure asynchronous callers such as artifacts-rail.tsx
and errors-tab.tsx cannot schedule a timer or call setCopied after cleanup.

In `@apps/dashboard/src/lib/runs/filters.ts`:
- Around line 90-94: Update parsePage to validate that raw is a complete numeric
token before conversion, rejecting values such as “2oops” and falling back to 1.
Apply the same full-token validation to the PR filter parsing logic around the
corresponding lines, preserving the documented invalid-input fallback and exact
PR filter behavior.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b0837e9-253f-4c15-a5de-aa8037a04365

📥 Commits

Reviewing files that changed from the base of the PR and between 482ba9b and 67a3749.

📒 Files selected for processing (122)
  • AGENTS.md
  • apps/dashboard/db/schema.ts
  • apps/dashboard/middleware/00.cache.ts
  • apps/dashboard/pages/invite/[token]/index.server.ts
  • apps/dashboard/pages/oauth/consent.server.ts
  • apps/dashboard/pages/settings/teams/[teamSlug]/audit.server.ts
  • apps/dashboard/pages/settings/teams/[teamSlug]/general.server.ts
  • apps/dashboard/pages/settings/teams/[teamSlug]/members.tsx
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/flaky.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/index.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/index.tsx
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/run-duration.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/slowest-tests.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/suite-size.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/runs/[runId]/diff.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/runs/[runId]/diff.tsx
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/runs/[runId]/index.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/runs/[runId]/tests/[testResultId]/index.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/tests.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/tests/[testId]/index.server.ts
  • apps/dashboard/routes/api/artifacts/[id]/download.ts
  • apps/dashboard/routes/api/artifacts/[id]/upload.ts
  • apps/dashboard/routes/api/artifacts/register.ts
  • apps/dashboard/routes/api/github/setup.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/export/runs.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/runs/[runId]/diff.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/runs/[runId]/groups.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/runs/[runId]/results.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/runs/[runId]/summary.ts
  • apps/dashboard/routes/api/t/[teamSlug]/p/[projectSlug]/runs/[runId]/tests/[testResultId]/replay.ts
  • apps/dashboard/routes/api/v1/runs/[runId]/index.ts
  • apps/dashboard/routes/api/v1/runs/[runId]/tests.ts
  • apps/dashboard/routes/api/v1/runs/index.ts
  • apps/dashboard/src/__tests__/artifact-origin-safety.workers.test.ts
  • apps/dashboard/src/__tests__/artifact-response.workers.test.ts
  • apps/dashboard/src/__tests__/artifact-tokens.workers.test.ts
  • apps/dashboard/src/__tests__/artifacts-pipeline.test.ts
  • apps/dashboard/src/__tests__/db-batch.workers.test.ts
  • apps/dashboard/src/__tests__/download-route.workers.test.ts
  • apps/dashboard/src/__tests__/export-where.workers.test.ts
  • apps/dashboard/src/__tests__/github-pr-comment.workers.test.ts
  • apps/dashboard/src/__tests__/mcp-server.workers.test.ts
  • apps/dashboard/src/__tests__/pg-integration/analytics-numeric.test.ts
  • apps/dashboard/src/__tests__/pg-integration/ingest.test.ts
  • apps/dashboard/src/__tests__/pg-integration/pagination.test.ts
  • apps/dashboard/src/__tests__/r2-live.test.ts
  • apps/dashboard/src/__tests__/run-columns.test.ts
  • apps/dashboard/src/__tests__/run-diff-resolve.workers.test.ts
  • apps/dashboard/src/__tests__/run-diff.workers.test.ts
  • apps/dashboard/src/__tests__/run-outcome-totals.workers.test.ts
  • apps/dashboard/src/__tests__/run-read-model.workers.test.ts
  • apps/dashboard/src/__tests__/run-results-page.workers.test.ts
  • apps/dashboard/src/__tests__/runs-filters-pr-commit.workers.test.ts
  • apps/dashboard/src/__tests__/runs-filters-where.workers.test.ts
  • apps/dashboard/src/__tests__/scope-where.workers.test.ts
  • apps/dashboard/src/__tests__/test-artifact-actions-signing.test.ts
  • apps/dashboard/src/__tests__/trace-artifacts.test.ts
  • apps/dashboard/src/__tests__/trace-viewer-dialog.test.tsx
  • apps/dashboard/src/__tests__/usage.workers.test.ts
  • apps/dashboard/src/__tests__/user-teardown.workers.test.ts
  • apps/dashboard/src/components/artifacts-rail.tsx
  • apps/dashboard/src/components/attempt-tabs.tsx
  • apps/dashboard/src/components/run-history-branch-filter.tsx
  • apps/dashboard/src/components/run-list-row.tsx
  • apps/dashboard/src/components/run-progress-group.tsx
  • apps/dashboard/src/components/run-progress.tsx
  • apps/dashboard/src/components/runs-filter-bar.tsx
  • apps/dashboard/src/components/trace-viewer-dialog.tsx
  • apps/dashboard/src/components/visual-diff-dialog.tsx
  • apps/dashboard/src/lib/action-errors.ts
  • apps/dashboard/src/lib/analytics/filters.ts
  • apps/dashboard/src/lib/api-response-types.ts
  • apps/dashboard/src/lib/artifacts/serve.ts
  • apps/dashboard/src/lib/artifacts/store.ts
  • apps/dashboard/src/lib/artifacts/tokens.ts
  • apps/dashboard/src/lib/artifacts/trace.ts
  • apps/dashboard/src/lib/billing/polar-webhook.ts
  • apps/dashboard/src/lib/command-search.ts
  • apps/dashboard/src/lib/content-types.ts
  • apps/dashboard/src/lib/date-range-presets.ts
  • apps/dashboard/src/lib/db/batch.ts
  • apps/dashboard/src/lib/db/query-tags.ts
  • apps/dashboard/src/lib/db/sql-ops.ts
  • apps/dashboard/src/lib/export.ts
  • apps/dashboard/src/lib/github-checks.ts
  • apps/dashboard/src/lib/github-pr-comment.ts
  • apps/dashboard/src/lib/hooks/use-copied-flag.ts
  • apps/dashboard/src/lib/hooks/use-search-param.ts
  • apps/dashboard/src/lib/ingest.ts
  • apps/dashboard/src/lib/invites.ts
  • apps/dashboard/src/lib/mcp/queries.ts
  • apps/dashboard/src/lib/mcp/server.ts
  • apps/dashboard/src/lib/members-repo.ts
  • apps/dashboard/src/lib/monitors/http/uptime-analytics.ts
  • apps/dashboard/src/lib/monitors/monitors-repo.ts
  • apps/dashboard/src/lib/monitors/scheduler.ts
  • apps/dashboard/src/lib/owners-repo.ts
  • apps/dashboard/src/lib/page-window.ts
  • apps/dashboard/src/lib/project-teardown.ts
  • apps/dashboard/src/lib/provisioning.ts
  • apps/dashboard/src/lib/retention.ts
  • apps/dashboard/src/lib/runs/columns.ts
  • apps/dashboard/src/lib/runs/db.ts
  • apps/dashboard/src/lib/runs/diff.ts
  • apps/dashboard/src/lib/runs/filters-where.ts
  • apps/dashboard/src/lib/runs/filters.ts
  • apps/dashboard/src/lib/runs/groups-page.ts
  • apps/dashboard/src/lib/runs/outcome.ts
  • apps/dashboard/src/lib/runs/read-model.ts
  • apps/dashboard/src/lib/runs/results-page.ts
  • apps/dashboard/src/lib/schemas.ts
  • apps/dashboard/src/lib/test-artifact-actions.ts
  • apps/dashboard/src/lib/trace-presence.ts
  • apps/dashboard/src/lib/usage.ts
  • apps/dashboard/src/lib/user-teardown.ts
  • apps/dashboard/src/realtime/project-feed.ts
  • apps/dashboard/src/realtime/use-project-room.ts
  • apps/dashboard/src/trace-viewer/components/errors-tab.tsx
  • docs/ARCHITECTURE.md
  • packages/e2e/src/e2e.test.ts
  • packages/e2e/tests-dashboard/test-replay.spec.ts
  • packages/reporter/src/__tests__/contract.test.ts
🛑 Comments failed to post (2)
apps/dashboard/src/lib/hooks/use-copied-flag.ts (1)

26-33: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Guard flash() after unmount.

The cleanup only cancels timers that already exist. artifacts-rail.tsx and errors-tab.tsx call flash() after asynchronous clipboard work; if the component unmounts first, this schedules a new timer and calls setCopied after unmount. Track mounted state or invalidate flash during cleanup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/dashboard/src/lib/hooks/use-copied-flag.ts` around lines 26 - 33, Update
the useCopiedFlag hook’s flash callback and cleanup to track whether the
component is mounted, and return immediately when flash is invoked after
unmount. Ensure asynchronous callers such as artifacts-rail.tsx and
errors-tab.tsx cannot schedule a timer or call setCopied after cleanup.
apps/dashboard/src/lib/runs/filters.ts (1)

90-94: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reject partially numeric query values.

Number.parseInt treats page=2oops as page 2 and pr=123abc as PR 123. This contradicts the documented invalid-input fallback and the exact PR filter contract, allowing malformed public/MCP queries to silently return different results. Validate the complete token before converting.

Suggested validation
 export function parsePage(raw: string | null): number {
   if (!raw) return 1;
-  const n = Number.parseInt(raw, 10);
-  if (!Number.isFinite(n) || n < 1) return 1;
+  if (!/^\d+$/.test(raw)) return 1;
+  const n = Number(raw);
+  if (!Number.isSafeInteger(n) || n < 1) return 1;
   return n;
 }

 function parsePr(raw: string | null): number | null {
   if (!raw) return null;
-  const n = Number.parseInt(raw.replace(/^`#/`, ""), 10);
-  if (!Number.isSafeInteger(n) || n < 1) return null;
+  const value = raw.replace(/^`#/`, "");
+  if (!/^\d+$/.test(value)) return null;
+  const n = Number(value);
+  if (!Number.isSafeInteger(n) || n < 1) return null;
   return n;
 }

Also applies to: 100-105

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/dashboard/src/lib/runs/filters.ts` around lines 90 - 94, Update
parsePage to validate that raw is a complete numeric token before conversion,
rejecting values such as “2oops” and falling back to 1. Apply the same
full-token validation to the PR filter parsing logic around the corresponding
lines, preserving the documented invalid-input fallback and exact PR filter
behavior.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found.

@wrightful

wrightful Bot commented Jul 22, 2026

Copy link
Copy Markdown

✅ Wrightful — 51 passed

Passed Failed Flaky Skipped Duration
51 0 0 1 1m 41s

View run report → · Compare to base →

Commit: 285b525 · Base: 3c4c99b

# Conflicts:
#	apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/run-duration.server.ts
#	apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/slowest-tests.server.ts
#	apps/dashboard/routes/api/artifacts/[id]/download.ts
#	apps/dashboard/src/lib/artifacts/store.ts
#	apps/dashboard/src/lib/ingest.ts
#	apps/dashboard/src/lib/invites.ts
#	apps/dashboard/src/lib/monitors/scheduler.ts
#	apps/dashboard/src/lib/provisioning.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/dashboard/src/__tests__/pg-integration/project-teardown.test.ts (1)

26-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the canonical @schema import.

Line 26 imports projects via ../../../db/schema; dashboard TypeScript files accessing schema tables must use @schema.

Proposed fix
-const { projects } = await import("../../../db/schema");
+const { projects } = await import("`@schema`");

As per coding guidelines, schema tables must be imported from @schema.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/dashboard/src/__tests__/pg-integration/project-teardown.test.ts` at line
26, Update the schema import in the project teardown integration test to use the
canonical `@schema` alias instead of the relative ../../../db/schema path, while
preserving the existing projects usage.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/dashboard/src/__tests__/pg-integration/project-teardown.test.ts`:
- Line 26: Update the schema import in the project teardown integration test to
use the canonical `@schema` alias instead of the relative ../../../db/schema path,
while preserving the existing projects usage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f62da1cd-23b6-4cc9-bc6f-5c6f1d8002f3

📥 Commits

Reviewing files that changed from the base of the PR and between 51cb5cb and 3c4c99b.

📒 Files selected for processing (22)
  • AGENTS.md
  • apps/dashboard/db/schema.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/flaky.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/run-duration.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/slowest-tests.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/suite-size.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/tests.server.ts
  • apps/dashboard/routes/api/artifacts/[id]/download.ts
  • apps/dashboard/src/__tests__/artifacts-pipeline.test.ts
  • apps/dashboard/src/__tests__/download-route.workers.test.ts
  • apps/dashboard/src/__tests__/pg-integration/ingest.test.ts
  • apps/dashboard/src/__tests__/pg-integration/project-teardown.test.ts
  • apps/dashboard/src/lib/artifacts/store.ts
  • apps/dashboard/src/lib/ingest.ts
  • apps/dashboard/src/lib/invites.ts
  • apps/dashboard/src/lib/mcp/server.ts
  • apps/dashboard/src/lib/monitors/monitors-repo.ts
  • apps/dashboard/src/lib/project-teardown.ts
  • apps/dashboard/src/lib/retention.ts
  • apps/dashboard/src/lib/schemas.ts
  • apps/dashboard/src/lib/usage.ts
  • packages/reporter/src/__tests__/contract.test.ts
🚧 Files skipped from review as they are similar to previous changes (19)
  • apps/dashboard/src/lib/invites.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/flaky.server.ts
  • apps/dashboard/src/lib/usage.ts
  • AGENTS.md
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/suite-size.server.ts
  • apps/dashboard/src/tests/artifacts-pipeline.test.ts
  • apps/dashboard/src/lib/artifacts/store.ts
  • apps/dashboard/src/tests/pg-integration/ingest.test.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/slowest-tests.server.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/tests.server.ts
  • packages/reporter/src/tests/contract.test.ts
  • apps/dashboard/src/lib/ingest.ts
  • apps/dashboard/db/schema.ts
  • apps/dashboard/src/lib/schemas.ts
  • apps/dashboard/src/lib/monitors/monitors-repo.ts
  • apps/dashboard/routes/api/artifacts/[id]/download.ts
  • apps/dashboard/src/lib/retention.ts
  • apps/dashboard/pages/t/[teamSlug]/p/[projectSlug]/insights/run-duration.server.ts
  • apps/dashboard/src/tests/download-route.workers.test.ts

# Conflicts:
#	apps/dashboard/src/components/run/history-branch-filter.tsx
@joefairburn
joefairburn merged commit 025941f into main Jul 23, 2026
11 checks passed
@joefairburn
joefairburn deleted the refactor/runs-lib-folder branch July 23, 2026 11:34
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