Skip to content

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

Open
RealDiligent wants to merge 1 commit 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 1 commit 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

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.

@RealDiligent
RealDiligent force-pushed the fix/critical-issue-ensure-schema-fresh-db-v2 branch from f843b50 to 633821e Compare July 30, 2026 15:34
@RealDiligent

Copy link
Copy Markdown
Contributor Author

Rebased onto current main. The lock-timeout helpers still treated missing legacy columns as NOT NULL and ALTERed them, and the team_name/benchmark UPDATEs were unguarded — both still crash a fresh DB. Fix requires _column_exists before DROP NOT NULL / back-fill. Watching CI.

@RealDiligent

Copy link
Copy Markdown
Contributor Author

CI green + MERGEABLE after rebase. Ready for maintainer merge.

…uter#120)

_drop_not_null_if_needed treated absent columns as NOT NULL and still ALTERed
them; legacy team_name/benchmark UPDATEs were also unguarded. Gate both on
_column_exists so fresh-DB startup works.

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