Skip to content

improvement(db): finish workspace file size cutover - #7112

Merged
waleedlatif1 merged 4 commits into
stagingfrom
codex/workspace-file-size-cutover
Aug 26, 2026
Merged

improvement(db): finish workspace file size cutover#7112
waleedlatif1 merged 4 commits into
stagingfrom
codex/workspace-file-size-cutover

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Backfill workspace_files.size_bytes in bounded, resumable batches and keep old/new writers compatible during rollout
  • Cut application reads and writes over to the canonical bigint size column
  • Leave the legacy int4 column behind a contract marker for removal after this release is fully deployed

Type of Change

  • Improvement

Testing

Tested with lint, the full audit suite, migration safety checks, app/database type-checks, targeted app and migration tests, and an isolated PostgreSQL 17 migration run.

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)

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 26, 2026 7:18pm

Request Review

@waleedlatif1
waleedlatif1 force-pushed the codex/workspace-file-size-cutover branch from faf3980 to c3960be Compare August 26, 2026 18:59
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR completes the workspace-file size cutover from the legacy integer field to the canonical bigint field.

  • Adds compatible rollout SQL, a bounded resumable backfill, and a dev-specific cutover path.
  • Moves application storage accounting, copying, cleanup, metadata, and quota paths to size_bytes.
  • Retains the legacy column and synchronization trigger for rolling-deployment compatibility.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/db/migrations/0308_workspace_file_size_cutover.sql Adds rolling-deployment compatibility between the legacy integer size and canonical bigint size.
packages/db/script-migrations/0008_backfill_workspace_file_size_bytes.ts Implements an idempotent, keyset-paginated backfill with independently committed batches.
packages/db/scripts/apply-dev-workspace-file-size-cutover.ts Applies compatibility SQL and the canonical-size backfill to existing dev databases before recording completion.
.github/workflows/migrations.yml Runs the temporary cutover after the dev schema push.
packages/db/schema.ts Makes size_bytes the canonical application field while retaining the legacy size column for rollout compatibility.
apps/sim/lib/billing/storage/payer-transfer.ts Recomputes payer-transfer storage totals from the canonical bigint size column.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Apply schema changes] --> B[Install size synchronization trigger]
  B --> C[Backfill null size_bytes rows in bounded batches]
  C --> D[Record script migration completion]
  D --> E[Deploy canonical size_bytes readers and writers]
  E --> F[Remove compatibility artifacts after rollout]
Loading

Reviews (4): Last reviewed commit: "fix(db): fail closed on missing file siz..." | Re-trigger Greptile

Comment thread packages/db/script-migrations/0008_backfill_workspace_file_size_bytes.ts Outdated
Comment thread packages/db/schema.ts Outdated

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread apps/sim/background/cleanup-soft-deletes.ts Outdated
Comment thread apps/sim/ee/workspace-forking/lib/copy/storage-quota.ts Outdated
Comment thread apps/sim/ee/workspace-forking/lib/copy/storage-quota.ts Outdated
@waleedlatif1
waleedlatif1 requested a review from a team as a code owner August 26, 2026 19:10
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 26, 2026

Copy link
Copy Markdown

@cubic review

@waleedlatif1 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

Choose a reason for hiding this comment

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

No issues found across 35 files

Confidence score: 5/5

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

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 32fbcdc into staging Aug 26, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the codex/workspace-file-size-cutover branch August 26, 2026 19:27
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