Skip to content

refactor(tests): share chaos harness result helpers - #1998

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

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

Conversation

@Sinity

@Sinity Sinity commented Jun 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Compresses repeated VM chaos harness result handling without changing the named chaos checks. Network partition, process restart, and clock skew tests now share helper paths for service-active assertions and event-count increase polling.

Problem

#1981 asks to streamline duplicated test harness patterns while preserving useful per-case observability. The VM chaos categories repeated the same pass/fail wiring around service_is_active and wait_for_event_count_increase, which made the scenario tests noisier without creating distinct behavior.

Solution

Added report_service_active and report_event_count_increase to chaos_support. The helpers record the same TestRunner pass/fail outcomes and keep each existing named chaos check intact. I used the helper only where it owns the whole named outcome; checks that continue into further assertions keep their explicit control flow.

This also confirms the source fixture-helper part of #1981 is already structurally satisfied on current master: append-only/static fixtures share build_file_fixture while retaining semantic wrapper modules, and production-path cases already flow through ProductionPathCase.

Verification

  • env SINEX_ROOT="$PWD" xtask check --allow-contended-host -p sinex-vm-test-suite --format human — cargo check passed for the worktree.
  • Pre-push guard: xtask check --changed-strict origin/master --allow-contended-host with SINEX_ROOT set to the worktree — affected package sinex-vm-test-suite, passed.

Ref #1981

Summary by CodeRabbit

  • Tests
    • Refactored test infrastructure to use centralized reporting helpers for improved maintainability and consistency across chaos scenario tests.

Problem

#1981 still had repeated VM chaos harness pass/fail patterns even after the source and trybuild cleanup slices. The repeated service-active and event-count polling result handling made the chaos categories more verbose while preserving no extra behavior.

What changed

Added shared chaos-support helpers for service-active assertions and event-count increase polling. Network-partition, process-restart, and clock-skew categories now reuse those helpers where the helper owns the whole named test outcome. Tests that continue with additional checks keep their explicit flow.

Verification

env SINEX_ROOT="/realm/tmp/worktrees/sinex-1981-fixtures" xtask check --allow-contended-host -p sinex-vm-test-suite --format human — cargo check passed.

Ref #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: 21fad88f-049b-4708-b6d9-af61d1d42d0c

📥 Commits

Reviewing files that changed from the base of the PR and between f7dbc28 and c62e698.

📒 Files selected for processing (4)
  • tests/vm-suite/src/categories/chaos_clock_skew.rs
  • tests/vm-suite/src/categories/chaos_network_partition.rs
  • tests/vm-suite/src/categories/chaos_process_restart.rs
  • tests/vm-suite/src/categories/chaos_support.rs

📝 Walkthrough

Walkthrough

Two centralized reporting helpers, report_service_active and report_event_count_increase, are added to chaos_support.rs. Three chaos test modules (chaos_clock_skew, chaos_network_partition, chaos_process_restart) are updated to import and call these helpers, removing inline pass/fail branching logic.

Changes

Chaos Test Reporting Refactor

Layer / File(s) Summary
New reporting helpers in chaos_support
tests/vm-suite/src/categories/chaos_support.rs
Imports TestRunner; adds report_service_active (checks SINEXD_SERVICE, calls runner.pass/runner.fail) and async generic report_event_count_increase (polls event count, calls runner.pass/runner.fail via a FnOnce closure, returns Option<i64>).
Call sites updated to use new helpers
tests/vm-suite/src/categories/chaos_clock_skew.rs, tests/vm-suite/src/categories/chaos_network_partition.rs, tests/vm-suite/src/categories/chaos_process_restart.rs
Removes SINEXD_SERVICE, service_is_active, and wait_for_event_count_increase from imports; replaces all inline if service_is_active / runner.pass / runner.fail blocks with report_service_active(...) and all match wait_for_event_count_increase(...).await blocks with report_event_count_increase(...).await.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop, the chaos is tamed at last,
No more copy-paste from test to test so fast,
report_service_active answers the call,
One helper for passing, one helper for all!
The clock skews, partitions, and restarts align—
All reporting through helpers, now tidy and fine. ✨


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 03d5e0d into master Jun 20, 2026
2 checks passed
@Sinity
Sinity deleted the feature/refactor/source-fixture-harness-1981 branch June 20, 2026 05:56
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

Compresses repeated VM chaos harness result handling without changing the named chaos checks. Network partition, process restart, and clock skew tests now share helper paths for service-active assertions and event-count increase polling.

Problem

#1981 asks to streamline duplicated test harness patterns while preserving useful per-case observability. The VM chaos categories repeated the same pass/fail wiring around `service_is_active` and `wait_for_event_count_increase`, which made the scenario tests noisier without creating distinct behavior.

Solution

Added `report_service_active` and `report_event_count_increase` to `chaos_support`. The helpers record the same `TestRunner` pass/fail outcomes and keep each existing named chaos check intact. I used the helper only where it owns the whole named outcome; checks that continue into further assertions keep their explicit control flow.

This also confirms the source fixture-helper part of #1981 is already structurally satisfied on current master: append-only/static fixtures share `build_file_fixture` while retaining semantic wrapper modules, and production-path cases already flow through `ProductionPathCase`.

Verification

- `env SINEX_ROOT="$PWD" xtask check --allow-contended-host -p sinex-vm-test-suite --format human` — cargo check passed for the worktree.
- Pre-push guard: `xtask check --changed-strict origin/master --allow-contended-host` with `SINEX_ROOT` set to the worktree — affected package `sinex-vm-test-suite`, passed.

Ref #1981

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

## Summary by CodeRabbit

* **Tests**
  * Refactored test infrastructure to use centralized reporting helpers for improved maintainability and consistency across chaos scenario tests.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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

Compresses repeated VM chaos harness result handling without changing the named chaos checks. Network partition, process restart, and clock skew tests now share helper paths for service-active assertions and event-count increase polling.

Problem

#1981 asks to streamline duplicated test harness patterns while preserving useful per-case observability. The VM chaos categories repeated the same pass/fail wiring around `service_is_active` and `wait_for_event_count_increase`, which made the scenario tests noisier without creating distinct behavior.

Solution

Added `report_service_active` and `report_event_count_increase` to `chaos_support`. The helpers record the same `TestRunner` pass/fail outcomes and keep each existing named chaos check intact. I used the helper only where it owns the whole named outcome; checks that continue into further assertions keep their explicit control flow.

This also confirms the source fixture-helper part of #1981 is already structurally satisfied on current master: append-only/static fixtures share `build_file_fixture` while retaining semantic wrapper modules, and production-path cases already flow through `ProductionPathCase`.

Verification

- `env SINEX_ROOT="$PWD" xtask check --allow-contended-host -p sinex-vm-test-suite --format human` — cargo check passed for the worktree.
- Pre-push guard: `xtask check --changed-strict origin/master --allow-contended-host` with `SINEX_ROOT` set to the worktree — affected package `sinex-vm-test-suite`, passed.

Ref #1981

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

## Summary by CodeRabbit

* **Tests**
  * Refactored test infrastructure to use centralized reporting helpers for improved maintainability and consistency across chaos scenario tests.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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