← Back to Pull requests

test: stop seven tests from depending on ZFS timestamps and the caller's environment #853

Closed
unknown closed this pull request without merging on Oct 27, 2026 21:41 UTC
View on GitHub
unknown unknown commented on Oct 27, 2026 20:28 UTC
Author

Seven tests failed, several of them most of the time, when the suite ran on ZFS, with NO_COLOR set, or with CARGO_TARGET_DIR set. None of them found a product problem. Each one assumed something about the machine it ran on. This PR changes only those tests, so the suite gives the same result on these setups.

ZFS stamps files from a 1 ms tick and, unlike tmpfs or ext4 on recent kernels, does not hand out fine-grained times after a timestamp has been read. A file rewritten microseconds after it was captured can therefore keep the same length, mtime, ctime and inode.

| Test | Cause | Failure rate before | After |
|---|---|---|---|
| mbx-cache-rustc dep_info::tests::a_disguised_rewrite_is_not_answered_from_the_ledger | rewrite in the same ZFS tick | 48/50 on ZFS (0/50 on tmpfs) | 0/50 |
| mbx-cache-rustc dep_info::tests::precompile_snapshot_does_not_depend_on_the_host_clock | same | 30/50 on ZFS | 0/50 |
| mbx-cache-cc depfile::tests::precompile_snapshot_does_not_depend_on_the_host_clock | same | 34/50 on ZFS | 0/50 |
| materialize::materialization_tests::a_filesystem_without_clones_links_the_object_instead_of_copying_it | restore and creation in the same ZFS tick | 37/50 on ZFS | 0/50 |
| util::tests::measures_the_disk_holding_a_path | a ZFS pool's capacity can change between two readings under load | 1 of 6 full-suite runs | 0/50 |
| cli::pretty::tests::mascot_keeps_progress_readable_and_leaves_successful_builds | looked for an ANSI escape that NO_COLOR=1 suppresses | 50/50 with NO_COLOR=1 | 0/50 |
| build::standalone_adopt_refuses_a_busy_target | inherited CARGO_TARGET_DIR, so mbx adopt skipped before checking the lease | fails whenever it is set | passes |

Changes:

  • The four timestamp tests wait 20 ms before the rewrite or restore, as the test above a_disguised_rewrite_is_not_answered_from_the_ledger already did. 20 ms matches FINE_TIMESTAMP_RACE_WINDOW in mbx-cache-core. Their assertions are unchanged.

  • The disk-size test still requires an exact match, but only between two equal readings of the parent directory, with a bounded retry.

  • The mascot test checks the rendered cell colours instead of searching the text for an escape sequence.

  • The adopt test removes CARGO_TARGET_DIR from both mbx adopt commands.
  • Validation, on Linux 7.0 / 96 cores, with /tmp on ZFS and other builds loading the host: each of the seven tests passed 50 of 50 runs, and the mascot and adopt tests also pass with NO_COLOR=1 and with CARGO_TARGET_DIR set. cargo fmt --check and cargo clippy --workspace --all-targets -- -D warnings pass. In two full cargo nextest run --workspace runs, the seven passed. The failures in those runs were in tests this PR does not touch and came from the test environment: one test fails when RUSTC is set, and two failed once under heavy load and passed in the second run. Not checked: macOS and Windows locally (left to CI).

    The two precompile-snapshot fixtures also pointed at a real gap in the pre-compile check on coarse-timestamp filesystems. The wait fixes the fixtures' assumption, not that gap. It is reported separately in jbellis/mr-boxington#39.

    AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5-5; version: 2.1.306.

    🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Tests
    Improved reliability of filesystem-related checks on systems with coarse timestamp resolution and fluctuating capacity measurements by allowing timestamp updates to register and retrying capacity comparisons.
    Made build adoption tests independent of inherited target-directory settings, so they consistently check lease behavior.
    Updated terminal output checks to verify rendered foreground and background colors directly, while continuing to check when the mascot appears.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 503 lines (+377 / -126) across 6 files Reviewer: jbellis Review duration: 72m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 503 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.372
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #853"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.5% (MEDIUM) · Higher = larger blast radius
    47.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.8% · Safe to merge
    18.8%