Skip to content

refactor(tests): share replay scan source harness - #2000

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

Sinity merged 1 commit into
masterfrom
feature/refactor/replay-harness-1981

Conversation

@Sinity

@Sinity Sinity commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

Extracts the duplicated fake replay scan-source runtime used by the deterministic replay and HTTP replay tests into the existing API test common module. The named tests remain separate and nextest-visible; only the repeated NATS ack/progress/reemit harness code moves.

Problem

#1981 asks to streamline repeated test patterns while preserving affected-test evidence. Replay tests had two nearly identical fake scan-source implementations. They both subscribed to the replay scan subject, acknowledged the command, inserted emitted events with created_by_operation_id, and published replay progress. The only meaningful difference was how the material id was selected: deterministic replay pins a material id up front, while the HTTP replay test derives it from the replay command.

Solution

Adds FakeReplayScanSource and spawn_fake_replay_scan_source to crate/sinexd/tests/api/common/mod.rs.

  • FakeReplayScanSource::with_material(...) preserves the deterministic replay behavior.
  • FakeReplayScanSource::from_replay_command(...) preserves the HTTP replay behavior.
  • replay_determinism_test.rs and replay_rpc_live_test.rs now share the harness without collapsing their named scenarios.
  • replay_lifecycle_test.rs is intentionally left alone because its helper returns the received scan command for assertions; that is a different test contract, not the same duplication.

Verification

  • env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-replay-harness --command xtask test --allow-contended-host -p sinexd -E 'test(material_replay_archives_preserve_content) or test(double_replay_idempotent) or test(replay_full_lifecycle_over_http_rpc)' --format human
    • passed: 3 tests
  • env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-replay-harness --command xtask check --changed-strict origin/master --allow-contended-host --format human
    • passed: affected package sinexd; changed files crate/sinexd/tests/api/common/mod.rs, crate/sinexd/tests/api/replay_determinism_test.rs, crate/sinexd/tests/api/replay_rpc_live_test.rs
  • pre-push hook repeated xtask check --changed-strict origin/master --allow-contended-host
    • passed with the same affected package and files

Ref #1981

Problem
#1981 calls out replay harness duplication as part of the verifiability cleanup. replay_determinism_test and replay_rpc_live_test both carried local fake NATS scan-source runtimes with the same ack/progress/reemit behavior, which made replay setup drift-prone while preserving identical named tests.

What changed
Moved the common fake replay scan-source runtime into the existing API test common module. Call sites now choose whether the fake source uses an explicit material id or derives it from the replay command, preserving the two test semantics without duplicated NATS ack/progress code.

Verification
Focused replay tests passed before this commit with the same helper body: material_replay_archives_preserve_content, double_replay_idempotent, and replay_full_lifecycle_over_http_rpc. The follow-up gate runs after commit so changed-strict sees the branch diff.

Ref #1981
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 35 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Free

Run ID: 25405644-a29d-458f-8f96-b7c4e3c1bb88

📥 Commits

Reviewing files that changed from the base of the PR and between 36a81dd and 1797b46.

📒 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

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 2ed4a9c into master Jun 20, 2026
2 checks passed
@Sinity
Sinity deleted the feature/refactor/replay-harness-1981 branch June 20, 2026 06:30
Sinity added a commit that referenced this pull request Jun 20, 2026
Summary

Finishes the two #1981 closure gaps found after the replay-harness PR: the last direct trybuild runner setup now uses a shared support helper, and the verification policy now names when sampled impact audits are required instead of only mentioning impact explain output.

Problem

The #1981 false-close pass found that prior work had compressed the primitives compile-fail runner and documented selected-test evidence, but sinex-macros still owned a one-off trybuild setup and the policy did not tell future agents when to run `xtask impact audit --sample-skips N`. That left the verification cleanup issue almost closed but not exhausted.

Solution

- Add `crate/sinex-macros/tests/support/trybuild.rs` and route the macros compile-fail test through it while keeping the individual fixtures and stderr outputs explicit.
- Extend `.github/ci-policy.md` with impact explain/audit cadence for disputed test-scope claims, impact-planner changes, verification-policy changes, and false-close audits.
- Extend `xtask/docs/verification.md` with an impact-plan coverage audit row and concrete command pattern.

Acceptance matrix

- Required-input-key suite compression: satisfied by #1983.
- Production-path source/common source-path laws: satisfied by #1988.
- Replay/chaos/summarizer harness compression: satisfied by #1992, #1994, #1998, and #2000.
- Compile-fail runner compression: satisfied by #1997 for `sinex-primitives` and by this PR for `sinex-macros`.
- Gate visibility/cadence: satisfied by #1988 for changed-strict guidance and by this PR for impact explain/audit cadence.

Verification

- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-final --command xtask test --debug --heavy --include-ignored -p sinex-macros -E 'test(compile_fail_tests)' --format human`  
  Passed: 1, Ignored: 0.
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-final --command xtask check --changed-strict origin/master --allow-contended-host --format human`  
  Passed locally.
- Pre-push `xtask check --changed-strict origin/master --allow-contended-host`  
  Passed: changed-strict checked `sinex-macros`.

Closes #1981
Sinity added a commit that referenced this pull request Jul 13, 2026
Summary

Extracts the duplicated fake replay scan-source runtime used by the deterministic replay and HTTP replay tests into the existing API test common module. The named tests remain separate and nextest-visible; only the repeated NATS ack/progress/reemit harness code moves.

Problem

#1981 asks to streamline repeated test patterns while preserving affected-test evidence. Replay tests had two nearly identical fake scan-source implementations. They both subscribed to the replay scan subject, acknowledged the command, inserted emitted events with `created_by_operation_id`, and published replay progress. The only meaningful difference was how the material id was selected: deterministic replay pins a material id up front, while the HTTP replay test derives it from the replay command.

Solution

Adds `FakeReplayScanSource` and `spawn_fake_replay_scan_source` to `crate/sinexd/tests/api/common/mod.rs`.

- `FakeReplayScanSource::with_material(...)` preserves the deterministic replay behavior.
- `FakeReplayScanSource::from_replay_command(...)` preserves the HTTP replay behavior.
- `replay_determinism_test.rs` and `replay_rpc_live_test.rs` now share the harness without collapsing their named scenarios.
- `replay_lifecycle_test.rs` is intentionally left alone because its helper returns the received scan command for assertions; that is a different test contract, not the same duplication.

Verification

- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-replay-harness --command xtask test --allow-contended-host -p sinexd -E 'test(material_replay_archives_preserve_content) or test(double_replay_idempotent) or test(replay_full_lifecycle_over_http_rpc)' --format human`
  - passed: 3 tests
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-replay-harness --command xtask check --changed-strict origin/master --allow-contended-host --format human`
  - passed: affected package `sinexd`; changed files `crate/sinexd/tests/api/common/mod.rs`, `crate/sinexd/tests/api/replay_determinism_test.rs`, `crate/sinexd/tests/api/replay_rpc_live_test.rs`
- pre-push hook repeated `xtask check --changed-strict origin/master --allow-contended-host`
  - passed with the same affected package and files

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

Finishes the two #1981 closure gaps found after the replay-harness PR: the last direct trybuild runner setup now uses a shared support helper, and the verification policy now names when sampled impact audits are required instead of only mentioning impact explain output.

Problem

The #1981 false-close pass found that prior work had compressed the primitives compile-fail runner and documented selected-test evidence, but sinex-macros still owned a one-off trybuild setup and the policy did not tell future agents when to run `xtask impact audit --sample-skips N`. That left the verification cleanup issue almost closed but not exhausted.

Solution

- Add `crate/sinex-macros/tests/support/trybuild.rs` and route the macros compile-fail test through it while keeping the individual fixtures and stderr outputs explicit.
- Extend `.github/ci-policy.md` with impact explain/audit cadence for disputed test-scope claims, impact-planner changes, verification-policy changes, and false-close audits.
- Extend `xtask/docs/verification.md` with an impact-plan coverage audit row and concrete command pattern.

Acceptance matrix

- Required-input-key suite compression: satisfied by #1983.
- Production-path source/common source-path laws: satisfied by #1988.
- Replay/chaos/summarizer harness compression: satisfied by #1992, #1994, #1998, and #2000.
- Compile-fail runner compression: satisfied by #1997 for `sinex-primitives` and by this PR for `sinex-macros`.
- Gate visibility/cadence: satisfied by #1988 for changed-strict guidance and by this PR for impact explain/audit cadence.

Verification

- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-final --command xtask test --debug --heavy --include-ignored -p sinex-macros -E 'test(compile_fail_tests)' --format human`  
  Passed: 1, Ignored: 0.
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-final --command xtask check --changed-strict origin/master --allow-contended-host --format human`  
  Passed locally.
- Pre-push `xtask check --changed-strict origin/master --allow-contended-host`  
  Passed: changed-strict checked `sinex-macros`.

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

Extracts the duplicated fake replay scan-source runtime used by the deterministic replay and HTTP replay tests into the existing API test common module. The named tests remain separate and nextest-visible; only the repeated NATS ack/progress/reemit harness code moves.

Problem

#1981 asks to streamline repeated test patterns while preserving affected-test evidence. Replay tests had two nearly identical fake scan-source implementations. They both subscribed to the replay scan subject, acknowledged the command, inserted emitted events with `created_by_operation_id`, and published replay progress. The only meaningful difference was how the material id was selected: deterministic replay pins a material id up front, while the HTTP replay test derives it from the replay command.

Solution

Adds `FakeReplayScanSource` and `spawn_fake_replay_scan_source` to `crate/sinexd/tests/api/common/mod.rs`.

- `FakeReplayScanSource::with_material(...)` preserves the deterministic replay behavior.
- `FakeReplayScanSource::from_replay_command(...)` preserves the HTTP replay behavior.
- `replay_determinism_test.rs` and `replay_rpc_live_test.rs` now share the harness without collapsing their named scenarios.
- `replay_lifecycle_test.rs` is intentionally left alone because its helper returns the received scan command for assertions; that is a different test contract, not the same duplication.

Verification

- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-replay-harness --command xtask test --allow-contended-host -p sinexd -E 'test(material_replay_archives_preserve_content) or test(double_replay_idempotent) or test(replay_full_lifecycle_over_http_rpc)' --format human`
  - passed: 3 tests
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-replay-harness --command xtask check --changed-strict origin/master --allow-contended-host --format human`
  - passed: affected package `sinexd`; changed files `crate/sinexd/tests/api/common/mod.rs`, `crate/sinexd/tests/api/replay_determinism_test.rs`, `crate/sinexd/tests/api/replay_rpc_live_test.rs`
- pre-push hook repeated `xtask check --changed-strict origin/master --allow-contended-host`
  - passed with the same affected package and files

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

Finishes the two #1981 closure gaps found after the replay-harness PR: the last direct trybuild runner setup now uses a shared support helper, and the verification policy now names when sampled impact audits are required instead of only mentioning impact explain output.

Problem

The #1981 false-close pass found that prior work had compressed the primitives compile-fail runner and documented selected-test evidence, but sinex-macros still owned a one-off trybuild setup and the policy did not tell future agents when to run `xtask impact audit --sample-skips N`. That left the verification cleanup issue almost closed but not exhausted.

Solution

- Add `crate/sinex-macros/tests/support/trybuild.rs` and route the macros compile-fail test through it while keeping the individual fixtures and stderr outputs explicit.
- Extend `.github/ci-policy.md` with impact explain/audit cadence for disputed test-scope claims, impact-planner changes, verification-policy changes, and false-close audits.
- Extend `xtask/docs/verification.md` with an impact-plan coverage audit row and concrete command pattern.

Acceptance matrix

- Required-input-key suite compression: satisfied by #1983.
- Production-path source/common source-path laws: satisfied by #1988.
- Replay/chaos/summarizer harness compression: satisfied by #1992, #1994, #1998, and #2000.
- Compile-fail runner compression: satisfied by #1997 for `sinex-primitives` and by this PR for `sinex-macros`.
- Gate visibility/cadence: satisfied by #1988 for changed-strict guidance and by this PR for impact explain/audit cadence.

Verification

- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-final --command xtask test --debug --heavy --include-ignored -p sinex-macros -E 'test(compile_fail_tests)' --format human`  
  Passed: 1, Ignored: 0.
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-final --command xtask check --changed-strict origin/master --allow-contended-host --format human`  
  Passed locally.
- Pre-push `xtask check --changed-strict origin/master --allow-contended-host`  
  Passed: changed-strict checked `sinex-macros`.

Closes #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