Skip to content

refactor(tests): collapse production-path case boilerplate - #2008

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/verify-test-patterns-1981
Jun 20, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/verify-test-patterns-1981

Conversation

@Sinity

@Sinity Sinity commented Jun 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Collapse repeated production-path source test wrappers into one shared harness macro while preserving the existing per-source fixture assertions.

Problem

#1981 tracks verifiability cleanup where tests should keep affected-source evidence but stop repeating identical harness ceremony. The production-path source tests had many copies of the same #[sinex_test] async fn ... { run_production_path_case(...).await ... } body, making source-family coverage harder to scan and easier to drift.

Solution

Add production_path_case_test! in the production-path test harness and convert the straightforward named ProductionPathCase wrappers for AI sessions, browser history, desktop ActivityWatch/clipboard, documents, export parsers, health exports, and social exports. Special harness tests and parser-specific behavior tests stay explicit.

Verification

  • env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-verify --command xtask test --allow-contended-host -p sinexd -E '<19 production-path case tests>' --format human reused exact proof from invocation 2: passed=19, status=success.
  • env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-verify --command xtask check --changed-strict origin/master --allow-contended-host --format human passed: 8 changed Rust files, 1 affected package, sinexd passed.

Ref #1981.

Summary by CodeRabbit

  • Tests
    • Refactored production-path test infrastructure to improve code consistency and maintainability across multiple test modules.

Problem: #1981 tracks test-harness cleanup where production-path source tests repeated the same run_production_path_case wrapper for ordinary named cases. The repetition made fixture coverage harder to scan and encouraged copy/paste edits across source families.\n\nWhat changed: add a production_path_case_test! macro in the production-path harness and convert the straightforward case-wrapper tests for AI sessions, browser history, desktop ActivityWatch/clipboard, documents, export parsers, health exports, and social exports. Parser-specific and special harness tests stay explicit.\n\nVerification: env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-verify --command xtask test --allow-contended-host -p sinexd -E '<19 production-path case tests>' --format human reused exact proof from invocation 2: passed=19, status=success.
@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: c811753f-5df7-45f8-9f17-520021813ccc

📥 Commits

Reviewing files that changed from the base of the PR and between 3ad7e65 and 4961c6f.

📒 Files selected for processing (8)
  • crate/sinexd/tests/sources/production_path.rs
  • crate/sinexd/tests/sources/production_path/ai_session.rs
  • crate/sinexd/tests/sources/production_path/browser.rs
  • crate/sinexd/tests/sources/production_path/desktop.rs
  • crate/sinexd/tests/sources/production_path/document.rs
  • crate/sinexd/tests/sources/production_path/export_parsers.rs
  • crate/sinexd/tests/sources/production_path/health_exports.rs
  • crate/sinexd/tests/sources/production_path/social_exports.rs

📝 Walkthrough

Walkthrough

A new #[macro_export] macro production_path_case_test! is added to production_path.rs. It generates a sinex_test async test function that calls run_production_path_case, maps errors via color_eyre, and returns TestResult<()>. All 15 hand-written boilerplate async test wrappers across 7 test modules are replaced with invocations of this macro, and the now-redundant xtask::sandbox::prelude::* imports are removed.

Changes

Test macro introduction and adoption

Layer / File(s) Summary
production_path_case_test! macro definition
crate/sinexd/tests/sources/production_path.rs
Exports the production_path_case_test! macro that generates a sinex_test async wrapper calling run_production_path_case, mapping errors with color_eyre, and returning TestResult<()>.
Macro adoption across all test modules
crate/sinexd/tests/sources/production_path/ai_session.rs, browser.rs, desktop.rs, document.rs, export_parsers.rs, health_exports.rs, social_exports.rs
Removes xtask::sandbox::prelude::* imports and replaces all explicit #[sinex_test] async fn test bodies with crate::production_path_case_test! invocations referencing the existing *_CASE constants.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A macro hops in, ears tall and bright,
No more repeated boilerplate to write!
production_path_case_test! — one call to rule,
Seven files now share a single tool.
The warren is tidy, the burrow is clean,
The tidiest test hop a rabbit has seen! 🐇✨


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 328220a into master Jun 20, 2026
2 checks passed
@Sinity
Sinity deleted the feature/refactor/verify-test-patterns-1981 branch June 20, 2026 09:41
Sinity added a commit that referenced this pull request Jul 13, 2026
Summary

Collapse repeated production-path source test wrappers into one shared harness macro while preserving the existing per-source fixture assertions.

Problem

#1981 tracks verifiability cleanup where tests should keep affected-source evidence but stop repeating identical harness ceremony. The production-path source tests had many copies of the same run_production_path_case wrapper body, making source-family coverage harder to scan and easier to drift.

Solution

Add production_path_case_test! in the production-path test harness and convert the straightforward named ProductionPathCase wrappers for AI sessions, browser history, desktop ActivityWatch/clipboard, documents, export parsers, health exports, and social exports. Special harness tests and parser-specific behavior tests stay explicit.

Verification

- env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-verify --command xtask test --allow-contended-host -p sinexd -E '<19 production-path case tests>' --format human reused exact proof from invocation 2: passed=19, status=success.
- env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-verify --command xtask check --changed-strict origin/master --allow-contended-host --format human passed: 8 changed Rust files, 1 affected package, sinexd passed.

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

Collapse repeated production-path source test wrappers into one shared harness macro while preserving the existing per-source fixture assertions.

Problem

#1981 tracks verifiability cleanup where tests should keep affected-source evidence but stop repeating identical harness ceremony. The production-path source tests had many copies of the same run_production_path_case wrapper body, making source-family coverage harder to scan and easier to drift.

Solution

Add production_path_case_test! in the production-path test harness and convert the straightforward named ProductionPathCase wrappers for AI sessions, browser history, desktop ActivityWatch/clipboard, documents, export parsers, health exports, and social exports. Special harness tests and parser-specific behavior tests stay explicit.

Verification

- env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-verify --command xtask test --allow-contended-host -p sinexd -E '<19 production-path case tests>' --format human reused exact proof from invocation 2: passed=19, status=success.
- env -u SINEX_ROOT nix develop /realm/tmp/worktrees/sinex-1981-verify --command xtask check --changed-strict origin/master --allow-contended-host --format human passed: 8 changed Rust files, 1 affected package, sinexd 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