Skip to content

refactor(tests): share primitives trybuild runner setup - #1997

Merged
Sinity merged 2 commits into
masterfrom
feature/refactor/compile-fail-runner-1981
Jun 20, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/refactor/compile-fail-runner-1981

Conversation

@Sinity

@Sinity Sinity commented Jun 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Compresses the sinex-primitives trybuild runner setup without collapsing fixture files or nextest-visible test names, and clarifies the affected-gate cadence that this run exposed. The source-contract, ID-type, and EventBuilder typestate compile-fail runners now share one tiny trybuild helper, while their individual tests and diagnostic fixtures remain intact.

Problem

#1981 asks to reduce repeated test harness code while preserving affected-test and nextest observability. The primitives compile-fail suite repeated direct trybuild::TestCases::new() setup in multiple runner files. Running the heavy slice also showed stale compiler-output baselines and made the trybuild cadence rule concrete: edited compile-fail runners/stderr need a heavy/debug focused run, while ordinary PR evidence should stay on changed-strict plus focused behavior tests rather than the full gate every time.

Solution

Added tests/support/trybuild.rs with a shared cases() helper and routed the three primitives trybuild runners through it. The public test function names did not change. Each .rs and .stderr fixture remains individual.

The trybuild stderr baselines were refreshed to current Rust output where the compiler now prints fully qualified sinex_primitives::Event and one-line method-found notes. The expected error kinds and typestate guarantees are unchanged.

Updated .github/ci-policy.md and xtask/docs/verification.md to describe the current PR/default cadence: xtask check --changed-strict origin/master --allow-contended-host as the default affected Rust/API gate, focused xtask test ... for behavior evidence, docs/schema gates when those surfaces are touched, full/all tests at phase boundaries, and heavy/debug focused trybuild runs for edited compile-fail suites.

Verification

  • xtask test --allow-contended-host --debug --heavy -p sinex-primitives -E 'test(source_contract_compile_failures) or test(id_type_mismatch_is_compile_error) or test(event_builder_requires_provenance_before_build)' --format human — 3 passed.
  • xtask check --changed-strict origin/master --allow-contended-host --format human — 4 changed Rust files, affected package sinex-primitives, passed before opening the PR.
  • xtask check --changed-strict origin/master --allow-contended-host --format human — rerun after the documentation commit, affected package sinex-primitives, passed.
  • Pre-push drift guard reran xtask check --changed-strict origin/master --allow-contended-host and passed.

Note: the same heavy trybuild filter without --debug timed out under parallel nextest execution at 120s before the successful serial debug run. That is now recorded in the verification docs as cadence guidance, not treated as a product failure.

Ref #1981

Problem
#1981 asks to compress compile-fail runner repetition while keeping each fixture file and nextest-visible test name intact. The primitives crate had three separate trybuild runner files repeating the setup directly.

What changed
Added a small shared trybuild helper for sinex-primitives integration-test runners and routed the source-contract, ID-type, and EventBuilder typestate runner tests through it. The fixture files remain individual. The existing public test names remain unchanged.

The heavy verification also exposed stale Rust diagnostic baselines for the same trybuild suite, so the expected stderr fixtures were refreshed to the current compiler output without changing the underlying invariants.

Verification
xtask test --allow-contended-host --debug --heavy -p sinex-primitives -E 'test(source_contract_compile_failures) or test(id_type_mismatch_is_compile_error) or test(event_builder_requires_provenance_before_build)' --format human

Ref #1981
@coderabbitai

coderabbitai Bot commented Jun 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

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 3 minutes and 26 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: 4d7d4ef4-7388-4593-acd4-6204ac3965df

📥 Commits

Reviewing files that changed from the base of the PR and between e59cb27 and a143ea3.

📒 Files selected for processing (2)
  • .github/ci-policy.md
  • xtask/docs/verification.md
📝 Walkthrough

Walkthrough

Adds a shared tests/support/trybuild.rs helper exporting a cases() function that returns trybuild::TestCases. Three compile-fail test files are updated to import this helper and call trybuild_support::cases() instead of constructing TestCases directly. Five .stderr fixture files are updated to match reformatted single-line compiler diagnostic notes.

Test infrastructure and fixture updates

Layer / File(s) Summary
Shared trybuild helper and test wiring
crate/sinex-primitives/tests/support/trybuild.rs, crate/sinex-primitives/tests/source_contract_compile_fail_test.rs, crate/sinex-primitives/tests/id_type_system_test.rs, crate/sinex-primitives/tests/event_builder_typestate_test.rs
New support/trybuild.rs adds pub fn cases() -> trybuild::TestCases with module-level docs. All three test files add a #[path = "support/trybuild.rs"] module import and replace inline trybuild::TestCases::new() with trybuild_support::cases().
stderr fixture reformatting
crate/sinex-primitives/tests/compile_errors/id_type_mismatch.stderr, crate/sinex-primitives/tests/source_contract_compile_fail/*.stderr
Five source_contract_compile_fail fixtures condense multi-line = note: messages to single-line SourceRuntimeBindingBuilder type specializations. id_type_mismatch.stderr updates the expected found-type from Id<Event> to Id<sinex_primitives::Event>.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐇 Hop hop, I tidied the test den today,
One helper for cases — the old way swept away!
Stderr snapshots trimmed to a single neat line,
The compiler speaks clearly, the fixtures align.
Less boilerplate scattered, more carrots to find! 🥕


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.

Problem
#1981 also asks for PR/scheduled gate cadence visibility. The existing CI policy still implied every PR should run full/docs/schema gates, while the active PR template and devshell pre-push path enforce changed-strict plus focused verification by default.

What changed
Updated the CI policy to make changed-strict the required Rust/API PR guard, focused xtask tests the behavior evidence, and docs/schema/full workspace gates conditional or phase-boundary checks. Added the trybuild-specific heavy-debug command to the verification map after the compile-fail runner work showed parallel heavy trybuild nodes can hit nextest's default timeout even when the same tests pass serially.

Verification
Documentation-only change; will be covered by changed-strict on this branch.

Ref #1981
@Sinity
Sinity merged commit f7dbc28 into master Jun 20, 2026
2 checks passed
@Sinity
Sinity deleted the feature/refactor/compile-fail-runner-1981 branch June 20, 2026 05:46
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 the `sinex-primitives` trybuild runner setup without collapsing fixture files or nextest-visible test names, and clarifies the affected-gate cadence that this run exposed. The source-contract, ID-type, and EventBuilder typestate compile-fail runners now share one tiny trybuild helper, while their individual tests and diagnostic fixtures remain intact.

Problem

#1981 asks to reduce repeated test harness code while preserving affected-test and nextest observability. The primitives compile-fail suite repeated direct `trybuild::TestCases::new()` setup in multiple runner files. Running the heavy slice also showed stale compiler-output baselines and made the trybuild cadence rule concrete: edited compile-fail runners/stderr need a heavy/debug focused run, while ordinary PR evidence should stay on changed-strict plus focused behavior tests rather than the full gate every time.

Solution

Added `tests/support/trybuild.rs` with a shared `cases()` helper and routed the three primitives trybuild runners through it. The public test function names did not change. Each `.rs` and `.stderr` fixture remains individual.

The trybuild stderr baselines were refreshed to current Rust output where the compiler now prints fully qualified `sinex_primitives::Event` and one-line method-found notes. The expected error kinds and typestate guarantees are unchanged.

Updated `.github/ci-policy.md` and `xtask/docs/verification.md` to describe the current PR/default cadence: `xtask check --changed-strict origin/master --allow-contended-host` as the default affected Rust/API gate, focused `xtask test ...` for behavior evidence, docs/schema gates when those surfaces are touched, full/all tests at phase boundaries, and heavy/debug focused trybuild runs for edited compile-fail suites.

Verification

- `xtask test --allow-contended-host --debug --heavy -p sinex-primitives -E 'test(source_contract_compile_failures) or test(id_type_mismatch_is_compile_error) or test(event_builder_requires_provenance_before_build)' --format human` — 3 passed.
- `xtask check --changed-strict origin/master --allow-contended-host --format human` — 4 changed Rust files, affected package `sinex-primitives`, passed before opening the PR.
- `xtask check --changed-strict origin/master --allow-contended-host --format human` — rerun after the documentation commit, affected package `sinex-primitives`, passed.
- Pre-push drift guard reran `xtask check --changed-strict origin/master --allow-contended-host` and passed.

Note: the same heavy trybuild filter without `--debug` timed out under parallel nextest execution at 120s before the successful serial debug run. That is now recorded in the verification docs as cadence guidance, not treated as a product failure.

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

Compresses the `sinex-primitives` trybuild runner setup without collapsing fixture files or nextest-visible test names, and clarifies the affected-gate cadence that this run exposed. The source-contract, ID-type, and EventBuilder typestate compile-fail runners now share one tiny trybuild helper, while their individual tests and diagnostic fixtures remain intact.

Problem

#1981 asks to reduce repeated test harness code while preserving affected-test and nextest observability. The primitives compile-fail suite repeated direct `trybuild::TestCases::new()` setup in multiple runner files. Running the heavy slice also showed stale compiler-output baselines and made the trybuild cadence rule concrete: edited compile-fail runners/stderr need a heavy/debug focused run, while ordinary PR evidence should stay on changed-strict plus focused behavior tests rather than the full gate every time.

Solution

Added `tests/support/trybuild.rs` with a shared `cases()` helper and routed the three primitives trybuild runners through it. The public test function names did not change. Each `.rs` and `.stderr` fixture remains individual.

The trybuild stderr baselines were refreshed to current Rust output where the compiler now prints fully qualified `sinex_primitives::Event` and one-line method-found notes. The expected error kinds and typestate guarantees are unchanged.

Updated `.github/ci-policy.md` and `xtask/docs/verification.md` to describe the current PR/default cadence: `xtask check --changed-strict origin/master --allow-contended-host` as the default affected Rust/API gate, focused `xtask test ...` for behavior evidence, docs/schema gates when those surfaces are touched, full/all tests at phase boundaries, and heavy/debug focused trybuild runs for edited compile-fail suites.

Verification

- `xtask test --allow-contended-host --debug --heavy -p sinex-primitives -E 'test(source_contract_compile_failures) or test(id_type_mismatch_is_compile_error) or test(event_builder_requires_provenance_before_build)' --format human` — 3 passed.
- `xtask check --changed-strict origin/master --allow-contended-host --format human` — 4 changed Rust files, affected package `sinex-primitives`, passed before opening the PR.
- `xtask check --changed-strict origin/master --allow-contended-host --format human` — rerun after the documentation commit, affected package `sinex-primitives`, passed.
- Pre-push drift guard reran `xtask check --changed-strict origin/master --allow-contended-host` and passed.

Note: the same heavy trybuild filter without `--debug` timed out under parallel nextest execution at 120s before the successful serial debug run. That is now recorded in the verification docs as cadence guidance, not treated as a product failure.

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