Skip to content

Run the whole utopia-server crate against Postgres in CI instead of a filter list - #869

Merged
WaylandYang merged 1 commit into
devfrom
ci/server-crate-against-postgres
Sep 23, 2026
Merged

WaylandYang merged 1 commit into
devfrom
ci/server-crate-against-postgres

Conversation

@WaylandYang

Copy link
Copy Markdown
Contributor

Follow-up to #868 (stacked on it; GitHub retargets this PR to dev once #868 merges).

Why

#868 added one more filter to the migrations job's list of utopia-server test namespaces run against Postgres. That list is the problem: every module gated on test_db::url() that nobody remembered to add keeps skipping silently in CI (#248). Still outside the list after #868: api::jobs_routes::tests, api::rule_metadata_tests, api::rule_expression_tests, pipeline::pipeline_tests, ingest_sources::{source_checkpoint_tests, rss_sync_contract_tests, source_filename_tests}, type_alignment::tests, extraction::tests, query_engine::postgres::tests.

What

The four filter steps (api::mcp::tests, api::chat::, api::documents_routes::, retrieval::) are replaced by a single step that runs the whole crate, the same way utopia-store already is in this job:

- name: utopia-server against Postgres
  run: cargo test -p utopia-server
  env:
    UTOPIA_DATABASE_URL: postgres://utopia:utopia@localhost:5432/utopia
    UTOPIA_TEST_REQUIRE_DB: "1"

New database-backed modules no longer need registering. The workflow-level permissions: contents: read is untouched.

Does this slow CI down?

No. Step timings from the #868 run of the migrations job:

step duration
MCP structured reads against Postgres 152s (this is the compile of the test binary)
Chat module against Postgres 19s
Documents routes against Postgres 3s
Hybrid retrieval against Postgres 2s

The compile is paid once whichever filter runs first. The whole crate (385 tests) runs in about 8s locally, so one whole-crate step costs roughly the same ~150–160s the four steps cost together. The backend job is unchanged and remains the critical path (434s vs 574s for migrations today, dominated by sqlx-cli install and the store tests).

Verification

Local, against a fresh database in the docker compose Postgres (host port 1517, #866), UTOPIA_TEST_REQUIRE_DB=1, migrated first (as the job's earlier sqlx migrate run step does), three consecutive runs:

running 385 tests
test result: ok. 384 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 7.99s
test result: ok. 384 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 7.95s
test result: ok. 384 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 8.15s

The 1 ignored test is the opt-in live-network RSS acceptance test in rss_full_content.rs.

One ordering caveat, recorded in the step comment: the chat and jobs-route fixtures do not run migrations themselves. Starting the whole crate against a completely empty database fails 32 tests with relation "organizations" does not exist (concurrent tests racing a first migration). In this job the database is already migrated by the earlier 全新库上跑一遍 step, so the whole-crate step is safe; the caveat only matters for anyone running cargo test -p utopia-server locally against a brand-new database.

cargo fmt --all --check passes.

🤖 Generated with Claude Code

@WaylandYang
WaylandYang force-pushed the ci/documents-routes-against-postgres branch from e221787 to 6c68aba Compare September 23, 2026 06:57
Base automatically changed from ci/documents-routes-against-postgres to dev September 23, 2026 07:06
… filter list

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: WaylandYang <145302500+WaylandYang@users.noreply.github.com>
@WaylandYang
WaylandYang force-pushed the ci/server-crate-against-postgres branch from 1620ab2 to 085a15c Compare September 23, 2026 07:07
@WaylandYang
WaylandYang merged commit 6684ade into dev Sep 23, 2026
@WaylandYang
WaylandYang deleted the ci/server-crate-against-postgres branch September 23, 2026 07:16
@WaylandYang WaylandYang mentioned this pull request Sep 25, 2026
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.

1 participant