Skip to content

fix(ci): integration job queries the right place (#45) - #61

Merged
amar-python merged 2 commits into
gap-remediation-2026-09from
fix/issue-45-integration-ci
Oct 25, 2026
Merged

amar-python merged 2 commits into
gap-remediation-2026-09from
fix/issue-45-integration-ci

Conversation

@amar-python

@amar-python amar-python commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Fixes #45. Targets gap-remediation-2026-09 (PR #44), so merging this turns #44's integration check green.

Root causes (both reproduced locally with the job's exact steps, PostgreSQL 16)

  1. Tier E query never ran. _column_signature passed --set=sch=... with -c. psql does not interpolate :'sch' inside -c, so the query was a syntax error, and the function returned {}, which Tier E reported as "0 tables". The query now goes on stdin, and a failed query is reported as a query error.
  2. API tests hit the wrong database. The job sets PGDATABASE=postgres; api/config.py reads PGDATABASE; the schema lives in te_mgmt_dev. The full-suite step now sets PGDATABASE=te_mgmt_dev.

The original hypothesis in #45 (one root cause: deploys landing in the wrong database) was wrong. Deploys were correct; te_core_schema.sql does \c :"db_name".

Harness isolation (second commit, per review)

Once Tier E worked, it found a real difference: te_dev held test_run_results, created by the Tier S SQL harness. Rather than an ignore_tables exception (first commit, now reverted), run_all_tests.sql creates schema te_test_harness and puts it first on search_path, so the harness's tables and functions never land in the schema under test. te_dev now holds exactly the 12 deployed tables.

Existing local databases still hold the old harness objects in te_dev from earlier runs. On a machine that has run the SQL tests before, Tier E will report test_run_results as drift until it is dropped from te_dev.

Evidence (local replay, not CI)

  • Evals P/I/S/E: 26 total, 26 passed, 0 failed, 0 skipped
  • scripts/test_report.py --strict with PGDATABASE=te_mgmt_dev: 238 collected, 238 passed, 0 failed, 0 skipped
  • make lint: clean
  • New negative controls: 2 of 3 fail against the old runner.py; the empty-schema control passes against both, as intended
  • te_dev after a full run: 12 tables; harness objects in te_test_harness

CI on this PR is the independent run.

https://claude.ai/code/session_01AYM3RR8Fmw2pwqFfnJhAo6


Generated by Claude Code

…ght place (#45)

Two independent causes, both reproduced locally against PostgreSQL 16
with the job's exact steps:

1. Tier E bound the schema name with `psql --set ... -c`. psql never
   interpolates :'var' inside -c, so every query was a syntax error,
   which _column_signature turned into an empty result: "0 tables".
   The query now goes on stdin, and a failed query is reported as a
   query error instead of an empty schema. Three negative controls;
   two of them fail against the old code.

2. The job sets PGDATABASE=postgres, and api/config.py reads
   PGDATABASE, so the API looked for te_dev in the wrong database.
   The full-suite step now sets PGDATABASE=te_mgmt_dev.

With Tier E working it found one real difference: dev has
test_run_results, created by the Tier S SQL test harness. It is listed
in the Tier E expectation file as ignored, with the reason, rather
than filtered silently.

Local replay: evals P/I/S/E 26/26, test_report --strict 239/239,
0 skipped; make lint clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AYM3RR8Fmw2pwqFfnJhAo6
Replaces the ignore_tables exception from the previous commit, per
review: Tier E should need no exceptions.

run_all_tests.sql now creates schema te_test_harness and puts it first
on search_path, so test_framework.sql's unqualified CREATEs
(test_run_results, assert_*, report_*) land there instead of in te_dev.
T&E tables still resolve from the env schema, and the suites already
address it through te.schema_name. The four report calls are
qualified with te_test_harness.

Tier S caught the first attempt, which left the report calls
qualified with the env schema.

Local replay on PostgreSQL 16: te_dev holds exactly 12 tables; evals
P/I/S/E 26/26, 0 skipped; test_report --strict 238/238, 0 skipped;
make lint clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AYM3RR8Fmw2pwqFfnJhAo6
@amar-python
amar-python merged commit 25cd0d7 into gap-remediation-2026-09 Oct 25, 2026
3 checks passed
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