Repository navigation
fix(tests): the nightly live tier seeds its rows in the database the stack runs on, and the job can finish (#4620) - #4788
Merged
Conversation
…stack runs on, and the job can finish (#4620) Two of the seven causes behind the red Tier 3 night. Fixtures wrote to a SQLite file. Every compose file boots the stack on PostgreSQL since #4175. Four live-tier modules still seeded their rows by opening a SQLite file inside the backend container, so the fixtures failed with "no such table: users" and 52 tests never ran (51 errors, 1 failure, of 73 failing rows on 2026-11-24). tests/testing_utils/backend_db.py runs a statement through the backend's own engine inside the container, so it lands in whichever database the stack booted on. test_access_control, test_ops_clear_all, test_operator_queue and test_watchdog now use it. The rows are real now, so the helper checks its target: the API has to be local, and the default container has to publish the port of TRINITY_API_URL (or be named in TRINITY_BACKEND_CONTAINER). The three fixtures that create a login remove it also when their setup fails. The job could not finish. Nights that completed took 39.5 to 44.8 minutes against a limit of 45, and the job was cancelled at the limit on 5 of 10 nights; a cancelled job writes no JUnit file. The limit is now 90. tests/unit/test_4620_live_tier_db_seam.py runs the helper's script against a real schema on SQLite and PostgreSQL, pins the transport and the target check, keeps raw SQLite reads of the stack's database out of the live tier (four modules still to move are listed, shrink-only), and bounds the limit. schema-parity.yml runs its PostgreSQL tier when the helper or that test changes. Refs #4620 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Regression details (head_sha: `1ac8240f912aa50f2ac9c5fefc90f4f1251f018b`)Seed Backend unit-suite regression diffPer-XML totals
❌ New failures introduced by HEAD (1)Tests failing under HEAD that did not fail under BASE in any seed:
Legend: [F] = assertion failure, [E] = collection or fixture error. Reproduce locally: |
obasilakis
approved these changes
Nov 27, 2026
obasilakis
left a comment
Contributor
There was a problem hiding this comment.
/review + /validate-pr — APPROVE
Lane C (.github/workflows/ touched). Scope clean: two of the seven #4620 causes, the other five listed as out of scope.
Execution coverage
| changed symbol / test file | executed by | live consumer | verdict |
|---|---|---|---|
backend_db.RUNNER / create_user / execute / rows / scalar / admin_user_id |
test_4620_live_tier_db_seam.py seam tests, against the real schema on SQLite (locally) and PostgreSQL (schema-parity arm) |
the four live-tier modules' fixtures | ✅ executed |
_backend_container target check |
test_a_second_stack_on_another_port_is_refused, ..._remote_target_..., ..._named_container_... (docker mocked) |
every _exec call |
✅ executed |
no-raw-sqlite3 scan + shrink-only ALLOWED |
itself | CI | 🛡 guard |
timeout-minutes: 90 bound (90–120) |
test_the_nightly_live_job_limit_covers_a_measured_night_with_headroom |
dev-nightly.yml |
🛡 guard |
Mutations re-run here, on the PR head:
tests/test_watchdog.pyreverted to base:test_no_live_tier_module_opens_the_stack_database_with_sqlite3goes red.- Limit set back to 45: the limit test goes red.
- Unmodified: 17 passed on SQLite.
Checks
- Security greps (keys, emails, IPs, host paths, file modes): clean.
- Values are bound parameters sent as JSON on stdin. None are formatted into the script. The old fixtures used f-string interpolation; this removes it.
userscolumns are allTextintables.py, so theutc_now()ISO-Z binds match the column types on both backends.- Tier 1 green, including
pytest (head),regression diffandschema-parity.journey-smokegreen.
Informational (non-blocking)
- I1
test_operator_queue.pyandtest_ops_clear_all.py: thefinallyteardown callsbackend_db.executewithout a guard. If setup failed because the target check refused, teardown raises the sameRuntimeErroragain. The error is chained, so the cause stays visible, and nothing is written to the wrong stack.test_access_control.pywraps its delete in try/except. The difference is cosmetic. - I2
Refs #4620with no closing keyword. This is deliberate and fine: the nightly closes its own issue. #4620 staysstatus-in-progressafter merge, so set it by hand if you want it tracked. - I3 The 90-minute limit reaches the scheduled night only after the next release cut. The PR body states this.
- I4
frontend-e2ewas skipped. The diff has no UI surface, so it is not relevant.
7 of 14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The nightly Tier 3 run on
devis red (#4620). The run of 2026-11-24 had 73 failing rows in the live tier, from seven causes. This PR fixes two of them.1. Fixtures wrote to a SQLite file (52 of the 73).
Every compose file boots the stack on PostgreSQL since #4175. Four live-tier modules still seeded their rows by opening a SQLite file inside the backend container. On a PostgreSQL stack that file has no tables, so the fixtures failed with
sqlite3.OperationalError: no such table: usersand the tests never ran: 51 errors and 1 failure.tests/testing_utils/backend_db.py: one statement, sent as JSON on stdin to the backend container and run through the backend's own SQLAlchemy engine, so it lands in whichever database the stack booted on. Values are bound, never formatted into the script or the command line.test_access_control.py,test_ops_clear_all.py,test_operator_queue.py,test_watchdog.pyuse it. Their assertions are unchanged.TRINITY_API_URL, or be named inTRINITY_BACKEND_CONTAINER. A second stack on the same machine is refused instead of written to.2. The job could not finish.
Nights that completed took 39.5 to 44.8 minutes against
timeout-minutes: 45. The job was cancelled at the limit on 5 of the last 10 nights, and a cancelled job writes no JUnit file, so those nights had no failure list. The limit is now 90; the arithmetic is in the workflow comment.Also in this PR
tests/unit/test_4620_live_tier_db_seam.py: runs the helper's script against the real schema on SQLite and PostgreSQL, pins the transport and the target check, keeps raw SQLite reads of the stack's database out of the live tier, and bounds the job limit (90 to 120).schema-parity.yml: the PostgreSQL tier also runs when the helper or its test changes. Without that, this PR's own CI would skip the PostgreSQL arm of the new test, and the next schema PR would run it for the first time. The workflow's header already names this limit; the two paths are the stated exception.Not in this PR
test_cb_probe_execution_close.py(7), a 500 where 409 is expected intest_event_subscriptions.py(1), three assertions that no longer match the product, and an order-dependent unit test.test_public_links.py,test_public_user_memory.py,test_slack_integration.pyskip on a PostgreSQL stack (13 tests on 2026-11-24);test_whatsapp_integration.pyis in the slow tier.integration-nightly.ymlruns the same suite twice per PR under the same 45-minute limit. On 2026-11-24 every leg that really ran was cancelled. It needs its own change (test_1896holds that limit at 60 on purpose).Two things a reviewer should know
main. A scheduled run takes the workflow file from the default branch. The test fixes take effect right after the merge todev, because every job checks outdev. Until the next release cut the scheduled night keeps the 45-minute limit; a run started by hand fromdevuses 90.Related Issue
Refs #4620
No closing keyword on purpose. #4620 is the nightly's own tracking issue:
dev-nightly.ymlcloses it on the first green night, and this PR fixes two of its seven causes.Journey Impact
Journey Impact: none: test fixtures, a test helper and two CI workflow settings; no product code and no journey promise changes
Type of Change
Testing
Live, on a fresh stack booted the way
dev-nightly.ymlboots it (PostgreSQL, placeholder model key):no such table: users. The same 52 as the nightly.-m "not slow" --ignore=unit)Compared test by test with the nightly of 2026-11-24: 52 went from red to pass, none went from pass to red, none went from red to skipped. The 21 that stay red are the five causes listed above.
Two of the 7 errors are mine, not the suite's:
test_cli_admin_login.pyandtest_cli_profiles.pydid not collect because my environment lackedpip install -e ./src/cli, which the nightly installs. The whole-selection run was made before the review corrections (target check, fixture cleanup); the four modules were rerun after them, which is the second row.Unit:
tests/unit/test_4620_live_tier_db_seam.py: 17 passed on SQLite; 23 passed withTEST_POSTGRES_URLset to apostgres:16-alpine(6 on PostgreSQL). Passes in four shuffled orders."All existing tests pass" is left unticked: the full unit suite was not rerun for this change, which touches no product code.
Mutation: each of these, made in a scratch copy, turns
test_4620_live_tier_db_seam.pyred: one module back to raw SQLite; the helper's script not committing; the script opening another database;INSERT OR IGNOREback in a module; the job limit back to 45; the limit raised to 180; the port check removed; the local-target check removed;docker execwithout-i; only the last output line read; a missing admin not reported; a named container ignored. With the fix reverted in the four modules, the live run above is the 51 errors + 1 failure.Checklist
git commit -s) — required for contributors outside the core teamWritten with Claude Code.
🤖 Generated with Claude Code