Skip to content

refactor(tests): share replay RPC lifecycle helpers - #2013

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/verifiability-harnesses-1981
Jun 20, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/verifiability-harnesses-1981

Conversation

@Sinity

@Sinity Sinity commented Jun 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Refactors the replay HTTP API tests to use shared LiveGateway replay lifecycle helpers while preserving the named replay determinism and live-RPC behavior checks.

Problem

#1981 still had repeated replay-operation choreography in multiple API tests: create, extract operation id, preview, approve or submit, poll status, cancel, and list. That duplication made the tests longer without adding scenario-specific evidence, and it made future replay API changes harder to update consistently.

Solution

crate/sinexd/tests/api/common/mod.rs now owns replay helper methods for create, preview, approve, execute, submit, cancel, status, list, operation-id extraction, and completion polling. replay_determinism_test.rs and replay_rpc_live_test.rs use those helpers while keeping their local assertions about actor overriding, preview semantics, archive replacement, cancellation state, and list visibility.

Acceptance Matrix

Verification

  • xtask fix --fmt-only -> formatted packages.
  • xtask test --allow-contended-host -p sinexd -E 'binary(replay_determinism_test) or binary(replay_rpc_live_test)' --format human -> 5 tests passed, 0 failed.
  • nix develop /realm/tmp/worktrees/sinex-1981-harnesses --command xtask check --changed-strict origin/master --allow-contended-host --format human -> changed-strict passed for affected package sinexd, changed files were the three replay API test files.

Ref #1981

Summary by CodeRabbit

  • Tests
    • Enhanced test infrastructure with improved replay operation helper utilities.
    • Refactored test suite to use higher-level testing APIs, improving test maintainability and reliability.

Problem: #1981 still had repeated replay API choreography across deterministic and live RPC tests, which made the tests longer without adding scenario-specific evidence.\n\nWhat changed: add shared LiveGateway helpers for replay create, preview, approve, execute, submit, cancel, status, list, and completion polling; refactor the replay determinism and live RPC tests to use those helpers while keeping their behavior assertions local.\n\nVerification: xtask fix --fmt-only; xtask test --allow-contended-host -p sinexd -E 'binary(replay_determinism_test) or binary(replay_rpc_live_test)' --format human.\n\nRef #1981
@coderabbitai

coderabbitai Bot commented Jun 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Free

Run ID: a2aba0fc-b7a7-45f6-ad05-d1de7bcebd7d

📥 Commits

Reviewing files that changed from the base of the PR and between 3318aa7 and 69e2198.

📒 Files selected for processing (3)
  • crate/sinexd/tests/api/common/mod.rs
  • crate/sinexd/tests/api/replay_determinism_test.rs
  • crate/sinexd/tests/api/replay_rpc_live_test.rs

📝 Walkthrough

Walkthrough

Replay operation helper methods are added to LiveGateway in the test common module, covering the full lifecycle (create, preview, approve, execute, submit, cancel, status, list) plus a polling wait_for_replay_completed. Both replay_rpc_live_test.rs and replay_determinism_test.rs are refactored to call these helpers instead of issuing raw JSON-RPC requests and manual polling loops.

Changes

Replay Operation Helper Methods and Test Migration

Layer / File(s) Summary
LiveGateway replay helpers
crate/sinexd/tests/api/common/mod.rs
Adds Value to serde_json imports. Implements replay_operation_id extractor and nine async LiveGateway methods covering the full replay lifecycle, plus wait_for_replay_completed which polls operation.state, returns on "Completed", fails on "Failed", and times out after the specified number of attempts.
Replay tests migrated to helpers
crate/sinexd/tests/api/replay_rpc_live_test.rs, crate/sinexd/tests/api/replay_determinism_test.rs
Removes the sinex_primitives::rpc::methods import and all manual gw.rpc(...) call sites and inline polling loops; replaces them with LiveGateway helper method invocations across the full lifecycle and cancel lifecycle tests, and in run_replay.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hoppity-hop through the replay lane,
No more raw RPC calls in the rain!
Each method wrapped up, neat and bright,
wait_for_replay_completed — pure delight.
The polling loop is gone, hooray,
A tidier test harness hops today! 🎉


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity merged commit 6d66119 into master Jun 20, 2026
2 checks passed
@Sinity
Sinity deleted the feature/refactor/verifiability-harnesses-1981 branch June 20, 2026 11:30
Sinity added a commit that referenced this pull request Jul 13, 2026
Summary

Refactors the replay HTTP API tests to use shared `LiveGateway` replay lifecycle helpers while preserving the named replay determinism and live-RPC behavior checks.

Problem

#1981 still had repeated replay-operation choreography in multiple API tests: create, extract operation id, preview, approve or submit, poll status, cancel, and list. That duplication made the tests longer without adding scenario-specific evidence, and it made future replay API changes harder to update consistently.

Solution

`crate/sinexd/tests/api/common/mod.rs` now owns replay helper methods for create, preview, approve, execute, submit, cancel, status, list, operation-id extraction, and completion polling. `replay_determinism_test.rs` and `replay_rpc_live_test.rs` use those helpers while keeping their local assertions about actor overriding, preview semantics, archive replacement, cancellation state, and list visibility.

Acceptance Matrix

- Replay harness compression: satisfied for the HTTP replay lifecycle tests covered by this PR.
- Nextest-visible per-case failures: preserved; no tests were collapsed or renamed.
- Behavior evidence: preserved through the existing five replay determinism/live-RPC tests.
- Remaining #1981 work: fixture helper cleanup and any additional non-replay harness compression remain open on #1981.

Verification

- `xtask fix --fmt-only` -> formatted packages.
- `xtask test --allow-contended-host -p sinexd -E 'binary(replay_determinism_test) or binary(replay_rpc_live_test)' --format human` -> 5 tests passed, 0 failed.
- `nix develop /realm/tmp/worktrees/sinex-1981-harnesses --command xtask check --changed-strict origin/master --allow-contended-host --format human` -> changed-strict passed for affected package `sinexd`, changed files were the three replay API test files.

Ref #1981
Sinity added a commit that referenced this pull request Jul 16, 2026
Summary

Refactors the replay HTTP API tests to use shared `LiveGateway` replay lifecycle helpers while preserving the named replay determinism and live-RPC behavior checks.

Problem

#1981 still had repeated replay-operation choreography in multiple API tests: create, extract operation id, preview, approve or submit, poll status, cancel, and list. That duplication made the tests longer without adding scenario-specific evidence, and it made future replay API changes harder to update consistently.

Solution

`crate/sinexd/tests/api/common/mod.rs` now owns replay helper methods for create, preview, approve, execute, submit, cancel, status, list, operation-id extraction, and completion polling. `replay_determinism_test.rs` and `replay_rpc_live_test.rs` use those helpers while keeping their local assertions about actor overriding, preview semantics, archive replacement, cancellation state, and list visibility.

Acceptance Matrix

- Replay harness compression: satisfied for the HTTP replay lifecycle tests covered by this PR.
- Nextest-visible per-case failures: preserved; no tests were collapsed or renamed.
- Behavior evidence: preserved through the existing five replay determinism/live-RPC tests.
- Remaining #1981 work: fixture helper cleanup and any additional non-replay harness compression remain open on #1981.

Verification

- `xtask fix --fmt-only` -> formatted packages.
- `xtask test --allow-contended-host -p sinexd -E 'binary(replay_determinism_test) or binary(replay_rpc_live_test)' --format human` -> 5 tests passed, 0 failed.
- `nix develop /realm/tmp/worktrees/sinex-1981-harnesses --command xtask check --changed-strict origin/master --allow-contended-host --format human` -> changed-strict passed for affected package `sinexd`, changed files were the three replay API test files.

Ref #1981
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