tests: fix nanosecond-vs-microsecond timestamp assertions (CI red since Aug 5) - #24
Merged
Merged
Conversation
…memory Five tests (three seq_tail_tests + bitemporal::supersession_lifecycle in both storage profiles) asserted a chunk/fact's valid_from/valid_to read back from Postgres equals an in-memory Utc::now() value. Postgres timestamptz stores microseconds; on Linux Utc::now() carries nanoseconds, so .913180133 never equals the .913180 that survives the round-trip and the equality assertions fail. It passed on macOS (this dev box's Utc::now() returns µs-granular values) which masked it, so CI has been red on Linux since these tests landed (2026-08-05) while local runs looked green. Fix truncates each test's reference timestamp to microseconds at the source (SubsecRound::trunc_subsecs(6)), so the value the test writes equals the value it reads back on every platform. The behavior under test was always correct (closes written, scoping right); only the assertions' precision was wrong. No production code touched. Reported by a community member who ran the full suite on Linux and read the failure diffs. Thank you. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…job) The rust job ran SpiceDB as a service container and relied on the authzed/spicedb image defaulting to `serve`, passing the flags via env. GitHub Actions can't override a service image's command, and the unpinned `:latest` image drifted to one that no longer defaults to `serve`, so it printed help and the container died at "Initialize containers" before any test ran. That, not only the timestamp assertions, is why the job was red. SpiceDB now starts as an explicit `docker run ... serve --grpc-preshared-key verity-dev-key --http-enabled` step (mirroring deploy/docker-compose.yml, which always worked), with an HTTP-gateway readiness gate before the tests. This is also immune to future `:latest` command-default drift, since the command is now explicit rather than inherited. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CI runs `cargo clippy --all-targets -- -D warnings`, which lints test code; local runs this session used default-target clippy, so 14 test-only lints went unseen and failed CI. All mechanical: 10x `.err().expect()` -> `.expect_err()`, one `repeat().take()` -> `repeat_n()` (clippy --fix), and three `assert!` over compile-time constants get a justified allow (the test deliberately pins constant relationships so it breaks if the floor/default change). Behavior-identical; test code only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The clippy-autofix rewrites left two test lines formatted the way the pinned 1.97.0 rustfmt accepts but CI's stable rustfmt (a different 1.9.0 build) reformats, so `cargo fmt --all --check` failed on CI while passing locally. Reformatted with the stable toolchain so both agree. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…check drop_file_ingests_under_visibility_and_wrong_scope_is_blind asserted the folder:<name> connector_status row exists immediately after recall succeeds, but that row is bumped per-file inside the async ingest task and can lag chunk visibility. On CI's timing the chunk was recallable before the status row landed, so the single-shot assertion failed while the behavior was correct. Polls for the row (10s deadline, 150ms interval), mirroring the recall_until the same test already uses. No production change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Five tests compared an in-memory nanosecond
Utc::now()against a Postgres read-back (microsecond), so they failed on Linux/CI while passing on macOS, masking a week of red CI. Truncates the reference timestamps to microseconds at the source. Behavior under test was always correct; only assertion precision was wrong. No production code touched. Reported by a community member who ran the suite on Linux.🤖 Generated with Claude Code