Skip to content

fix(ci): set PGDATABASE=te_mgmt_dev, add Tier E/X evals, fix step order - #62

Closed
amar-python wants to merge 1 commit into
mainfrom
claude/csv-loading-postgres-migration-qvkl4l
Closed

amar-python wants to merge 1 commit into
mainfrom
claude/csv-loading-postgres-migration-qvkl4l

Conversation

@amar-python

Copy link
Copy Markdown
Owner

Summary

  • Root cause fix: PGDATABASE was set to postgres instead of te_mgmt_dev in the CI workflow. The \c metacommand in te_core_schema.sql switches psql to the correct target database during deploy, so tables land in the right place — but the API, pytest, and Tier E evals connect via PGDATABASE, which pointed at postgres where te_dev.* tables don't exist.
  • Step ordering: Deploy now runs before evals (was reversed).
  • Missing env var: Added API_ALLOW_DESTRUCTIVE: "true" so DELETE-endpoint tests pass.
  • Tier E (cross-env parity) and Tier X (CSV round-trip) evals ported from the upstream repo, including a negative control (02_empty_schema_is_detected) that verifies the fingerprint query returns 0 tables for an empty schema — so the parity eval cannot false-positive on a silent deploy failure.

Changes

File What changed
.github/workflows/quality-gate.yml PGDATABASE: te_mgmt_dev, API_ALLOW_DESTRUCTIVE, deploy-before-evals, Tier X/E step
evals/runner.py +407 lines: Tier X and Tier E scenario handlers, negative control
evals/expected/tier_e/*.json Expected-value files for both Tier E scenarios
evals/expected/tier_x/*.json Expected-value file for CSV round-trip
evals/datasets/tier_e/*/NOTES.txt Dataset notes
evals/datasets/tier_x/*/NOTES.txt Dataset notes

Test plan

  • integration (postgres service) CI job passes — all 19 previously-failing API tests should now resolve te_dev.organisations
  • Tier E 01_all_envs_same_tables reports 12+ tables across 4 envs (was reporting 0)
  • Tier E 02_empty_schema_is_detected negative control passes (0 tables in empty schema)
  • Tier X CSV round-trip eval passes
  • free-tier job unaffected

Generated by Claude Code

Root cause: PGDATABASE was set to 'postgres' instead of 'te_mgmt_dev'.
deploy_all.sh runs psql without -d, so it falls back to PGDATABASE.
The \c in te_core_schema.sql then switches to the target database, so
tables deploy correctly — but the API and Tier E evals connect to
PGDATABASE (postgres), where the te_dev schema does not exist.

Fixes:
- PGDATABASE: te_mgmt_dev (was: postgres)
- API_ALLOW_DESTRUCTIVE: "true" (DeleteEndpoint tests need it)
- Deploy step now runs before evals (was: after)
- Added Tier X (CSV round-trip) and Tier E (cross-env parity) evals
- Added Tier E negative control (02_empty_schema_is_detected) that
  verifies the fingerprint query returns 0 tables for an empty schema,
  so the parity eval cannot false-positive on a silent deploy failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VBrxqChRJtxdvSpFhiUWUy
@amar-python
amar-python deleted the claude/csv-loading-postgres-migration-qvkl4l branch October 25, 2026 10:57
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