Repository navigation
test(a2a): make rename-save watcher timing deterministic - #3
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused test changes address the Windows timing failure while preserving production behavior.
0 open findings
What changed in this PR
Makes A2A rename-save watcher testing deterministic without changing production behavior.
Changes:
- Uses paused Tokio time for the missing-file window.
- Adds consecutive-missing-observation coverage.
- Enables Tokio test utilities for development only.
| File | Description |
|---|---|
basis/tests/a2a/watching.rs |
Controls watcher timing deterministically. |
basis/src/a2a/watch/tests.rs |
Tests confirmed file deletion behavior. |
basis/Cargo.toml |
Enables Tokio test-util for tests. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
test-utilonly for the SDK's development dependency.Root cause
The Windows job in https://github.com/oops-rs/basis/actions/runs/38199789951 failed at the rename-save assertion. The test alternated a nominal 20 ms missing window and 50 ms restored window five times while the watcher polled every 100 ms. Two consecutive polls could therefore see different missing windows without observing the intervening restoration; scheduler delays could also stretch a short sleep beyond a complete poll interval. In either case the watcher correctly treated two matching observations as a deletion.
The revised test exercises one explicit missing observation and restores the file before the second poll using Tokio's paused clock. Workspace opening and card refreshes retain real I/O and real time.
Validation
cargo fmt --all --checkcargo test -p basis --test a2a --all-features --locked: 19 passedcargo test -p basis --lib a2a::watch --all-features --locked: 6 passedcargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passedcargo test --workspace --all-features --locked: 1,737 passed (2 pre-existing ignored)The final commit was independently validated on macOS with Rust 1.97.1, using the normal development/test profiles. The installed Rust 1.95.0 toolchain also passed
cargo +1.95.0 check --workspace --all-targets --all-features --locked;cargo deny checkpassed all four policy groups. Windows and other platforms are validated by the PR checks.GitHub CI run 38223055892 passed all six jobs on head
9c84117d2c69bcc56e905d22babc7550679de491: Windows, macOS, Linux, Rust 1.95, no-default features, and cargo-deny. The Windows log confirms both the rename-save regression and permanent-deletion test passed.