Skip to content

test: run the suite on tmpfs and drop sleeps, timing harnesses, and trivial tests - #503

Merged
lg2m merged 19 commits into
mainfrom
test/audit-tests
Oct 29, 2026
Merged

lg2m merged 19 commits into
mainfrom
test/audit-tests

Conversation

@lg2m

@lg2m lg2m commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Change

The workspace test suite runs about 22x faster: cargo nextest run --workspace --profile ci goes from 449 s to 20 s wall, and from 3,512 s to 159 s summed across tests.

  • Tests run on tmpfs. The session store commits SQLite with synchronous = FULL. On a disk-backed TMPDIR, fsync was about 85% of each session test's wall time (strace: 5.7 s of a 6.5 s test). A nextest setup script (.config/nextest-tmpdir.sh) points TMPDIR at /dev/shm/qq-test-$UID on Linux. It falls back to the default TMPDIR when /dev/shm is missing, unwritable, noexec, or has under 2 GiB free. QQ_TEST_DISK_TMPDIR=1 turns it off.
  • Goal-driver soaks: 112 s → 4 s each. The second outage drops from three days to six hours. That still reaches the backoff ceiling, which is what the test checks; the longer outage only replayed about 140 identical wakes.
  • Fixed sleeps replaced with paused time, Notify, waiting for store queue depth, explicit mtimes, or yields. SLEEP_CEILING goes from 66 to 11. Each remaining sleep polls a real process or socket and is marked lint: allow(sleep).
  • Removed: eight timing harnesses that assert nothing (three of them ran in every CI run), five tests of layout or trivial plumbing, and seven wall-clock upper-bound assertions (their tests stay). Five headless budget tests are merged into one table-driven test.
  • Fixed a flaky test: the deadline-during-shell test raced its first write and failed every time on tmpfs. It now waits on a marker file.
  • Scheduling: the nextest priority filter now starts the slowest suites first.

Verification

  • cargo nextest run --workspace --profile ci: 2882 passed, 10 skipped, 20.0 s wall (host load about 2). Baseline on 061420e0: 2894 passed, 15 skipped, 449 s (load 15.7).
  • On tmpfs, a single session test takes 0.4 s, against 5.9 s on disk.
  • The fingerprint test still fails when mtimes are ignored.
  • cargo xtask check: passed after rebasing onto 46db8cf2 (full workspace, 102 s).

Known impact

  • I haven't seen nextest's experimental setup-scripts run on CI runners. If /dev/shm is too small there, the script falls back to disk: the suite is slower but still correct.
  • Remaining tests over 2 s are listed in docs/runbooks/testing.md.

lg2m added 18 commits October 29, 2026 14:29
Session tests commit SQLite with synchronous=FULL; on a disk TMPDIR fsync
was ~85% of their wall time. A nextest setup script points TMPDIR at
/dev/shm on Linux (QQ_TEST_DISK_TMPDIR=1 opts out). The full ci profile
drops from 449 s to 34 s on the shared host.

The deadline-during-shell test expired the run between spawn and the
shell's first write, so on fast storage the captured output was empty.
It now waits for a marker the shell writes after printing.
… cycle

The three-day outage replayed ~140 identical 30-minute ceiling wakes after
the backoff had already been proven bounded; six hours reaches the ceiling
again after the committed-work reset. 112 s -> 4 s each on disk; 23 s -> 4 s
on tmpfs.
Three side-question latency diagnostics ran in every CI run and only
printed percentiles; five ignored harnesses printed timings for one-off
manual comparisons. Benchmarks belong in benches/ or xtask perf. The slow
keyring's delay was always zero after its benchmark went; it is now a
counting keyring with no sleep.
…io's

Upper bounds on elapsed wall time are perf budgets, and they flake under
load. The behavior each test checks (the error, the outcome, the lower
bound) stays. The herdr timeout and the limited-stream deadline tests run
on paused time instead of waiting out real 500 ms deadlines; the MCP
cancellation test cancels once the call is active instead of after a
20 ms sleep.
They pin private structure (a struct's byte size, a private field's
setter), restate a format! string, or call a pure function twice. The
behaviors they touch are asserted with literal values elsewhere.
The group-commit tests slept 20-50 ms so jobs would reach the worker's
queues before release. They now wait until the bounded channels hold the
expected messages; the saturated-submission check yields a fixed number of
times on its current-thread runtime instead of sleeping 10 ms.
Nothing the twelve users assert depends on the provider being slow; each
waits on run events. Ran each 15 times on tmpfs with 8 threads: no
failures.
- fingerprint and plan-cache tests set the file mtime a second ahead
  instead of sleeping 20 ms for timestamp granularity
- the concurrent-miss test holds its compile until all 16 callers have
  asked, rather than sleeping 10 ms inside it
- poll loops in side-question, auth, host, and TUI tests yield instead of
  sleeping 2-20 ms per iteration
- the host observer test no longer asserts a 250 ms median ack
- the paused-time retry sleep and the client's drip rate are marked as
  allowed sleeps (one is virtual, the other is the behavior under test)
Each of these loops waits on observable state (a counter, a request list,
a snapshot); the sleep only added latency per iteration.
It samples RSS and polls a real child process; it is the documented R4
procedure in benchmarks/perf/README.md, run on demand in release mode.
Process-kill soak workers, /proc checks for killed process groups, and
the non-blocking loopback accept poll real OS state with no wake signal;
they are now allowed sleeps with reasons. Two in-process soak waits yield
instead.
The 1 ms pause between response chunks guaranteed nothing a reader can
observe over TCP; provider, host, auth, and xtask suites pass five runs
in a row without it. The scripted stall, the MCP slow tool, the dispatch
test tool's blocking delay, and the /proc poll for a killed shell are the
behavior under test and are marked as allowed sleeps.
With fsync gone the slow tests are the goal-driver soaks, deadline and
compaction suites, the soak binary, and the perf fixtures. Starting them
first moves the ci profile from ~25 s to ~20 s at 8 threads.
Each built the same fixture, ran to the end, and asserted the same
budget_exhausted outcome with one case-specific check; they are now rows.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T21:52:24.563044Z d6f458d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m

lg2m commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: daaef58344

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/headless.rs Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m

lg2m commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: d6f458d90d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lg2m
lg2m merged commit a41ba3f into main Oct 29, 2026
8 checks passed
@lg2m
lg2m deleted the test/audit-tests branch October 29, 2026 21:52
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