Skip to content

tests: fix nanosecond-vs-microsecond timestamp assertions (CI red since Aug 5) - #24

Merged
athenanewsapi merged 5 commits into
mainfrom
fix-timestamp-precision-tests
Aug 13, 2026
Merged

athenanewsapi merged 5 commits into
mainfrom
fix-timestamp-precision-tests

Conversation

@athenanewsapi

Copy link
Copy Markdown
Contributor

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

athenanewsapi and others added 5 commits August 13, 2026 12:01
…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>
@athenanewsapi
athenanewsapi merged commit 02010ed into main Aug 13, 2026
8 checks passed
@athenanewsapi
athenanewsapi deleted the fix-timestamp-precision-tests branch August 13, 2026 16:41
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