ci: add cargo fmt/clippy/test workflow with test-modification detector#3
Merged
Conversation
Adds a PR-triggered GitHub Actions workflow with four jobs running in parallel: - fmt: cargo fmt --all --check - clippy: cargo clippy --all-targets --locked -- -D warnings - test: cargo test --locked against a Postgres 18 service container (sqlx::test provisions per-test DBs and runs migrations) - detect-test-modifications: diffs tests/ against the PR base. Files with removed/changed lines (or test helpers under tests/common/) are surfaced via a self-updating PR comment and a job summary. New tests are excluded by --diff-filter=MDR. Informational only -- never fails the check. The test-modification check exists because adding tests is welcome but silent edits to existing test code can mask regressions; the PR comment makes those edits impossible for a reviewer to miss.
The test harness loads Config from env on every test (tests/common/mod.rs) and both admin_username and admin_credential are required fields with no serde defaults. Without them, every sqlx::test panics with `invalid config: MissingValue("admin_username")` before reaching the database. The credential value is ephemeral CI-only (each sqlx::test gets its own database).
RagingRedRiot
added a commit
that referenced
this pull request
May 25, 2026
This reverts commit e67594a.
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.
Background
There's been no automated check on the repo until now — every PR has been validated by running
cargo testlocally. With the repo public and branch protection requiring PRs tomain, the lack of a green-check signal on the PR view is the next gap worth closing.What this adds
A single
.github/workflows/ci.ymltriggered onpull_requesttomain(and onpushtomain), with four jobs running in parallel:fmtcargo fmt --all --checkclippycargo clippy --all-targets --locked -- -D warningstestcargo test --lockedagainst a Postgres 18 service containersqlx::testprovisions per-test DBs and runs migrations automatically; PG18 is required because the schema uses the built-inuuidv7()functiondetect-test-modificationstests/against the PR base; surfaces edits to existing test code as a self-updating PR commentcargojobs share aSwatinem/rust-cachecache; thefmtjob skips caching since it doesn't compile.Why the test-modification check is informational, not blocking
Adding new tests is always welcome and never triggers the detector:
--diff-filter=MDRexcludes pure additions, so a newtests/rooms.rsor a new#[sqlx::test]appended to an existing file produces no notice.The detector exists for the quiet failure mode: a PR that removes or weakens assertions inside an existing test, or that edits a helper under
tests/common/that other tests transitively depend on. Both are sometimes legitimate (a test needs to evolve with the behavior it's measuring) but they should never slip past review unnoticed.The detector posts a PR comment listing the affected files and line counts, keyed by an HTML marker so subsequent pushes update the same comment in place. If a follow-up push rolls the test changes back, the comment is deleted. The job itself always exits 0 — it's a reviewer aid, not a gate.
Test plan
cargo fmt --all --checkclean against currentmaincargo clippy --all-targets --locked -- -D warningsclean locallyfmt,clippy, andtestjobs all green on this PRdetect-test-modificationsreports ✓ (this PR touches no files undertests/)