Skip to content

test(a2a): make rename-save watcher timing deterministic - #3

Merged
WendellXY merged 1 commit into
mainfrom
fix/windows-a2a-watch-save
Oct 12, 2026
Merged

WendellXY merged 1 commit into
mainfrom
fix/windows-a2a-watch-save

Conversation

@WendellXY

@WendellXY WendellXY commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Make the A2A rename-save integration test use controlled Tokio time during the missing-file window, with real time restored before HTTP card refreshes.
  • Add coverage confirming that two consecutive missing observations still trigger a deletion.
  • Keep production watcher behavior unchanged; enable test-util only 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 --check
  • cargo test -p basis --test a2a --all-features --locked: 19 passed
  • cargo test -p basis --lib a2a::watch --all-features --locked: 6 passed
  • Rename-save regression: 100 consecutive runs passed
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed
  • cargo test --workspace --all-features --locked: 1,737 passed (2 pre-existing ignored)
  • No-default-feature documentation with warnings denied, all-target check, and tests: 992 passed

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 check passed 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.

@WendellXY
WendellXY marked this pull request as ready for review October 12, 2026 08:29
Copilot AI balanced review requested due to automatic review settings October 12, 2026 08:29
@WendellXY WendellXY self-assigned this Oct 12, 2026

Copilot AI 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.

🟢 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.

@WendellXY
WendellXY merged commit e170e38 into main Oct 12, 2026
7 checks passed
@WendellXY
WendellXY deleted the fix/windows-a2a-watch-save branch October 12, 2026 08:37
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.

3 participants