Skip to content

feat(db): add ai_analyzed flag to build_requests#2285

Merged
riderx merged 1 commit into
mainfrom
db/add-ai-analyzed-column
May 18, 2026
Merged

feat(db): add ai_analyzed flag to build_requests#2285
riderx merged 1 commit into
mainfrom
db/add-ai-analyzed-column

Conversation

@WcaleNieWolny
Copy link
Copy Markdown
Contributor

@WcaleNieWolny WcaleNieWolny commented May 18, 2026

Summary

Adds a single boolean column ai_analyzed (NOT NULL, DEFAULT FALSE) on public.build_requests. Used by the upcoming AI build analytics feature for one-analysis-per-job idempotency.

ALTER TABLE public.build_requests
  ADD COLUMN ai_analyzed BOOLEAN NOT NULL DEFAULT FALSE;

Why split out

This migration was originally part of PR #2284 (AI build analytics — adds CLI flag, edge function, and worker endpoint). It's split into its own PR so the DB schema change can be reviewed and applied independently from the feature code.

The feature PR will still merge after this one — the edge function in #2284 reads/writes the column, but no application code on `main` references it yet, so applying this migration ahead of feature code is safe.

Safety properties

  • Additive: only ADDs a column; doesn't drop, rename, or modify existing schema
  • NOT NULL with DEFAULT: existing rows get `false` automatically — no backfill needed
  • No RLS change: existing `build_requests` policies already restrict by org/app membership
  • No code on `main` reads this column, so applying it before feat: AI analysis for failed builds (migration + edge fn + CLI) #2284 merges has no behavioral effect

Test plan

  • CI passes (`supabase db push` step in `build_and_deploy.yml` succeeds)
  • Manual: verify column exists on preprod with the expected default
  • After merge, PR #2284 can rebase and drop its own copy of this migration file

Summary by CodeRabbit

  • Chores
    • Added database infrastructure to track AI analysis status for build requests.

Review Change Stack

Adds a boolean column with default FALSE used by the upcoming AI build
analytics feature for one-analysis-per-job idempotency. Backward-compatible
schema change — existing rows get the default; no app code on main reads
or writes this column yet.

The application code that consumes this column lands in PR #2284 (AI build
analytics feature). This migration ships separately so the schema change
can be reviewed and applied independently from the larger feature.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c3459a3-1ee8-4053-9ebe-602081b40196

📥 Commits

Reviewing files that changed from the base of the PR and between f1779cc and db09665.

📒 Files selected for processing (1)
  • supabase/migrations/20260518120000_add_ai_analyzed_to_build_requests.sql

📝 Walkthrough

Walkthrough

This PR adds a single database migration that introduces the ai_analyzed boolean column to the build_requests table. The column defaults to false, is non-nullable, and includes a comment documenting its purpose for tracking AI analysis of failed builds with one-analysis-per-job cost control.

Database Schema Update

Layer / File(s) Summary
Add AI analysis tracking column
supabase/migrations/20260518120000_add_ai_analyzed_to_build_requests.sql
Migration adds ai_analyzed column to build_requests with default false, non-null constraint, and a column comment explaining its use for tracking completed AI analysis and enforcing single analysis per job.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A column takes flight, ai_analyzed born,
To track when the bots have debugged through the morn.
One check per request, the costs stay in line,
A schema so simple, yet perfectly fine! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the primary change: adding an ai_analyzed flag column to the build_requests table.
Description check ✅ Passed The PR description includes a comprehensive summary, clear rationale for splitting out the migration, detailed safety properties, and a test plan—exceeding the template requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch db/add-ai-analyzed-column

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 SQLFluff (4.1.0)
supabase/migrations/20260518120000_add_ai_analyzed_to_build_requests.sql

User Error: No dialect was specified. You must configure a dialect or specify one on the command line using --dialect after the command. Available dialects:
ansi, athena, bigquery, clickhouse, databricks, db2, doris, duckdb, exasol, flink, greenplum, hive, impala, mariadb, materialize, mysql, oracle, postgres, redshift, snowflake, soql, sparksql, sqlite, starrocks, teradata, trino, tsql, vertica


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

WcaleNieWolny added a commit that referenced this pull request May 18, 2026
The ai_analyzed column migration is now in its own PR so the DB schema
change can be reviewed and applied independently. This PR keeps the
types update (supabase.types.ts) since edge function tests reference
the new field name; the actual column is created by the migration in
the standalone migration PR.

Depends on #2285 being merged + the migration applied to
the shared DB before this PR's runtime path works.
@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 18, 2026

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing db/add-ai-analyzed-column (db09665) with main (f1779cc)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@sonarqubecloud
Copy link
Copy Markdown

@riderx riderx merged commit 3f19039 into main May 18, 2026
52 of 53 checks passed
@riderx riderx deleted the db/add-ai-analyzed-column branch May 18, 2026 09:30
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