Skip to content

refactor(tests): type production-path obligations - #2011

Merged
Sinity merged 2 commits into
masterfrom
feature/refactor/xtask-test-patterns-1981
Jun 20, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/refactor/xtask-test-patterns-1981

Conversation

@Sinity

@Sinity Sinity commented Jun 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Types the production-path obligation harness, shares summarizer UTC bucket helpers, and makes gate cadence explicit in the verification docs. The shared harness still expands into the existing per-source nextest names, but obligation identity is no longer passed through raw strings.

Problem

#1981 asks Sinex to compress repeated test patterns without weakening affected-test observability. The required-input-key slice already landed, but the production-path harness still used string obligation names internally, hourly/daily summarizer tests repeated UTC bucket-boundary setup, and gate cadence guidance was scattered across prose.

Solution

  • Add ProductionPathObligation and use it in ProductionPathCase, _run_case, and record-fixture variants.
  • Keep the existing per-source production-path tests and case labels intact so nextest/impact history remains useful.
  • Preserve the existing initial-ingestion reuse behavior for privacy checks, now through typed obligation methods.
  • Add shared utc_hour_start and utc_day_start helpers for summarizer tests.
  • Add a Gate Cadence matrix to xtask/docs/verification.md covering focused PR loops, PR publish boundaries, verification-policy PRs, release boundaries, and scheduled broad sweeps.

Verification

  • env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask fix --fmt-only --format human - passed.
  • env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask test --allow-contended-host -p sinexd --test production_path --format human - 54 passed, 0 failed.
  • env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask test --allow-contended-host -p sinexd --test automata -E 'test(daily_summarizer) or test(hourly_summarizer)' --format human - 7 passed, 0 failed.
  • env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask check --changed-strict origin/master --allow-contended-host --format human - 4 changed Rust files, affected package sinexd, passed.
  • Pre-push hook reran xtask check --changed-strict origin/master --allow-contended-host - 1 package checked, passed.

Ref #1981

Summary by CodeRabbit

  • Tests

    • Improved production-path test harness by introducing typed obligation handling, replacing string-based dispatch and strengthening failure reporting.
    • Updated daily/hourly summarizer tests to use new UTC time-alignment helpers for consistent hour/day boundary expectations.
  • Documentation

    • Added a “Gate Cadence” section describing staged verification gates, including default PR-loop checks, publish and release boundaries, and example commands for each gate type.

Problem
#1981 keeps the affected-test architecture but asks for repeated test harness patterns to be compressed without losing nextest-visible case names. The production-path harness still passed obligation identity through raw strings, which made the shared law dispatcher stringly typed and left cadence guidance scattered across verification prose.

What changed
- Replace raw production-path obligation names with a typed ProductionPathObligation enum.
- Keep per-source test functions and case labels intact while the shared runner dispatches typed obligations.
- Add an explicit verification cadence matrix to xtask/docs/verification.md for PR, policy, release, and scheduled broad-sweep gates.

Verification
- env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask fix --fmt-only --format human
- env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask test --allow-contended-host -p sinexd --test production_path --format human — 54 passed, 0 failed

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: 42ef1a44-0f65-4ce1-8403-988d8702a1cf

📥 Commits

Reviewing files that changed from the base of the PR and between e5938ed and 2108223.

📒 Files selected for processing (3)
  • crate/sinexd/tests/automata/daily_summarizer_test.rs
  • crate/sinexd/tests/automata/hourly_summarizer_test.rs
  • crate/sinexd/tests/automata/summarizer_support.rs

📝 Walkthrough

Walkthrough

The production-path test harness replaces all string-based obligation names with a typed ProductionPathObligation enum (variants: InitialIngestion, Replay, Drain, Isolation, Privacy). The enum carries as_str, can_reuse_initial_ingestion, and marks_initial_ingestion_verified predicates. ProductionPathCase, its builder, and all five runner/dispatch functions are updated to accept the enum type. Separately, a Gate Cadence section is added to xtask/docs/verification.md, and two UTC timestamp-boundary helpers are extracted to reduce duplication across summarizer tests.

Changes

Typed ProductionPathObligation enum refactor

Layer / File(s) Summary
Enum definition and ProductionPathCase data shape
crate/sinexd/tests/sources/production_path.rs
Defines ProductionPathObligation enum with as_str, can_reuse_initial_ingestion, and marks_initial_ingestion_verified helpers; replaces ALL_OBLIGATIONS &[&str] with &[ProductionPathObligation]; updates ProductionPathCase.obligations field and its with_obligations const builder.
Runner signature updates and enum dispatch
crate/sinexd/tests/sources/production_path.rs
Updates all five runner functions to accept &[ProductionPathObligation]; switches failure formatting to obligation.as_str() and state tracking to obligation.marks_initial_ingestion_verified(); replaces string-literal match arms in _run_obligation and _run_record_fixture_obligation with typed enum variant matches, removing the "unknown obligation" fallback.

Gate Cadence documentation

Layer / File(s) Summary
Gate Cadence section
xtask/docs/verification.md
Adds a new section defining five recommended gating stages (focused PR loop, publish boundary, verification-policy PRs, release boundary aggregation, broad sweeps) with associated xtask command examples.

Timestamp utility helpers and test refactor

Layer / File(s) Summary
UTC timestamp boundary helpers
crate/sinexd/tests/automata/summarizer_support.rs
Adds utc_hour_start and utc_day_start functions that construct normalized Timestamp values by zeroing sub-hour and sub-day fields via replace_* method chains and expect() panic guards.
Summarizer test updates
crate/sinexd/tests/automata/daily_summarizer_test.rs, crate/sinexd/tests/automata/hourly_summarizer_test.rs
Imports and applies the new timestamp helpers to replace verbose inline Timestamp::from(...) constructions, reducing code duplication and improving readability.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 A string once hopped through the test field bare,
Now dressed in an enum with type-safety flair!
The helpers trim timestamps with surgical care—
No more verbose constructs cluttering there.
With gating cadence mapped and precision in place,
This rabbit celebrates code's refactored grace! 🥕


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 calls out replay, chaos, and summarizer harness repetition. The hourly and daily summarizer tests both normalized UTC bucket boundaries inline, duplicating the same setup/assertion law in each test file.

What changed
- Add shared `utc_hour_start` and `utc_day_start` helpers to summarizer_support.
- Use those helpers in hourly and daily summarizer tests while preserving existing test names and behavior assertions.

Verification
- env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask fix --fmt-only --format human
- env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask test --allow-contended-host -p sinexd --test automata -E 'test(daily_summarizer) or test(hourly_summarizer)' --format human — 7 passed, 0 failed

Ref #1981
@Sinity
Sinity merged commit 98cee0f into master Jun 20, 2026
2 checks passed
@Sinity
Sinity deleted the feature/refactor/xtask-test-patterns-1981 branch June 20, 2026 10:55
Sinity added a commit that referenced this pull request Jul 13, 2026
Summary

Types the production-path obligation harness, shares summarizer UTC bucket helpers, and makes gate cadence explicit in the verification docs. The shared harness still expands into the existing per-source nextest names, but obligation identity is no longer passed through raw strings.

Problem

#1981 asks Sinex to compress repeated test patterns without weakening affected-test observability. The required-input-key slice already landed, but the production-path harness still used string obligation names internally, hourly/daily summarizer tests repeated UTC bucket-boundary setup, and gate cadence guidance was scattered across prose.

Solution

- Add `ProductionPathObligation` and use it in `ProductionPathCase`, `_run_case`, and record-fixture variants.
- Keep the existing per-source production-path tests and case labels intact so nextest/impact history remains useful.
- Preserve the existing initial-ingestion reuse behavior for privacy checks, now through typed obligation methods.
- Add shared `utc_hour_start` and `utc_day_start` helpers for summarizer tests.
- Add a `Gate Cadence` matrix to `xtask/docs/verification.md` covering focused PR loops, PR publish boundaries, verification-policy PRs, release boundaries, and scheduled broad sweeps.

Verification

- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask fix --fmt-only --format human` - passed.
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask test --allow-contended-host -p sinexd --test production_path --format human` - 54 passed, 0 failed.
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask test --allow-contended-host -p sinexd --test automata -E 'test(daily_summarizer) or test(hourly_summarizer)' --format human` - 7 passed, 0 failed.
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask check --changed-strict origin/master --allow-contended-host --format human` - 4 changed Rust files, affected package `sinexd`, passed.
- Pre-push hook reran `xtask check --changed-strict origin/master --allow-contended-host` - 1 package checked, passed.

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

Types the production-path obligation harness, shares summarizer UTC bucket helpers, and makes gate cadence explicit in the verification docs. The shared harness still expands into the existing per-source nextest names, but obligation identity is no longer passed through raw strings.

Problem

#1981 asks Sinex to compress repeated test patterns without weakening affected-test observability. The required-input-key slice already landed, but the production-path harness still used string obligation names internally, hourly/daily summarizer tests repeated UTC bucket-boundary setup, and gate cadence guidance was scattered across prose.

Solution

- Add `ProductionPathObligation` and use it in `ProductionPathCase`, `_run_case`, and record-fixture variants.
- Keep the existing per-source production-path tests and case labels intact so nextest/impact history remains useful.
- Preserve the existing initial-ingestion reuse behavior for privacy checks, now through typed obligation methods.
- Add shared `utc_hour_start` and `utc_day_start` helpers for summarizer tests.
- Add a `Gate Cadence` matrix to `xtask/docs/verification.md` covering focused PR loops, PR publish boundaries, verification-policy PRs, release boundaries, and scheduled broad sweeps.

Verification

- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask fix --fmt-only --format human` - passed.
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask test --allow-contended-host -p sinexd --test production_path --format human` - 54 passed, 0 failed.
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask test --allow-contended-host -p sinexd --test automata -E 'test(daily_summarizer) or test(hourly_summarizer)' --format human` - 7 passed, 0 failed.
- `env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-test-patterns --command xtask check --changed-strict origin/master --allow-contended-host --format human` - 4 changed Rust files, affected package `sinexd`, passed.
- Pre-push hook reran `xtask check --changed-strict origin/master --allow-contended-host` - 1 package checked, passed.

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