Skip to content

fix(validator): guard legacy ensure_schema alters for fresh DBs (#120)#230

Open
RealDiligent wants to merge 3 commits into
mini-router:mainfrom
RealDiligent:fix/critical-issue-ensure-schema-fresh-db-v2
Open

fix(validator): guard legacy ensure_schema alters for fresh DBs (#120)#230
RealDiligent wants to merge 3 commits into
mini-router:mainfrom
RealDiligent:fix/critical-issue-ensure-schema-fresh-db-v2

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

Fixes #120 (resubmits closed #121).

On a fresh Postgres DB, ensure_schema() crashed with UndefinedColumn because it ran unguarded ALTER COLUMN ... DROP NOT NULL / legacy UPDATEs for columns that are now ORM @property accessors (artifact_name, team_name, etc.).

This PR gates those legacy statements on information_schema.columns so first-run startup works, while legacy DBs still migrate.

Test plan

  • validator/tests/test_ensure_schema.py — fresh path + legacy back-fill
  • CI test-validator green

@github-actions github-actions Bot added docs Documentation changes eval Evaluation changes validator Validator backend changes labels Jul 20, 2026
RealDiligent and others added 2 commits July 20, 2026 22:52
…-router#120)

Postgres has no IF EXISTS for ALTER COLUMN. Gate DROP NOT NULL and legacy
back-fills on information_schema so first-run create_all + ensure_schema works.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@RealDiligent

Copy link
Copy Markdown
Contributor Author

CI green (test-router / test-validator / web) and MERGEABLE. Resubmit of closed #121 for issue #120 — fresh-DB ensure_schema no longer crashes. Ready for maintainer merge.

Leaving NOT NULL team_name/artifact_* columns polluted the shared Postgres
test DB and broke later suite inserts.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation changes eval Evaluation changes validator Validator backend changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validator crashes on first startup: ensure_schema alters columns that no longer exist on a fresh DB

1 participant