Skip to content

fix(db): exclude pending-drop columns from inserts - #7774

Merged
icecrasher321 merged 2 commits into
stagingfrom
codex/pending-drop-insert-compat
Sep 11, 2026
Merged

icecrasher321 merged 2 commits into
stagingfrom
codex/pending-drop-insert-compat

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

  • Stop Drizzle INSERTs from naming retired columns as DEFAULT by applying the existing live-column maps through a shared, typed insert helper. Preserve normal defaults, conflict handling, parameter encoding, and returned-row decoding.
  • Update inserts for user_stats, organization, workflow_execution_logs, and workspace_files; reject unprojected inserts and unverified column maps in the pending-drop audit.
  • Keep the physical schema intact and require this compatibility release to reach every writer before a later column-drop migration.

Type of Change

  • Bug fix

Testing

  • 191 focused application tests, 9 insert-helper tests, and 21 audit tests passed.
  • Verified INSERT and RETURNING against disposable local PostgreSQL before and after dropping the retired columns on all four tables. The original insert form fails after the drop with 42703.
  • Lint, all 46 repository audits (including strict API boundary validation), app/database type checks, and migration safety passed. Drizzle schema generation produced no migration.

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)

@icecrasher321
icecrasher321 requested a review from a team as a code owner September 11, 2026 18:07
@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Sep 11, 2026 6:27pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the previous audit-bypass finding is resolved and no new actionable defect remains.

Summary

  • Adds a typed withInsertColumns table proxy that preserves table metadata, defaults, codecs, conflict handling, and returned-row decoding.
  • Applies the helper to writers for user_stats, organization, workflow_execution_logs, and workspace_files.
  • Extends the pending-drop audit to reject unprojected inserts, mismatched column maps, and shadowed helper or map imports.
  • Adds focused helper and audit regression tests.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Writer[Application writer] --> Helper[withInsertColumns]
  Table[Full Drizzle table schema] --> Helper
  LiveMap[Validated live-column map] --> Helper
  Helper --> Projected[Projected insert target]
  Projected --> SQL[INSERT naming only live columns]
  Audit[Pending-drop audit] -->|validates helper and map imports| Writer
  SQL --> Database[(PostgreSQL before or after retired-column drop)]
Loading

Reviews (2) · Last reviewed commit: "fix(audit): resolve pending-drop insert ..."

Comment thread scripts/check-pending-drop-tables.ts Outdated
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

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

@icecrasher321
icecrasher321 merged commit 52c68b2 into staging Sep 11, 2026
33 checks passed
@icecrasher321
icecrasher321 deleted the codex/pending-drop-insert-compat branch September 11, 2026 18:33
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