test(intune): record Store reducer Phase 2 semantic RED tests - #529
Conversation
Reducer Framework v1 Store pilot, PR 2 / Phase 2 slice: three ignored integration tests that assert the ADR contracts and record the current reducer's real failing behavior verbatim. No production code changes. - typed intent authority (ADR-001 / design): caller-writable named_data overrides a typed Required assignment into NotTargeted; - input order and chronology (ADR-003): reversing equivalent event input flips the terminal state between InstallCompleted and RegistrationFailure; - identity and correlation (ADR-002): an app_id-only match lets a package-identity-free installer failure drive a High-confidence package-specific InstallerFailure. Refs #358 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdded ignored RED tests for Microsoft Store reducer behavior. The tests cover typed assignment intent precedence, deterministic reduction of equivalent AppX events, and rejection of app-ID-only correlation when installer failures lack package identity. ChangesMicrosoft Store semantic coverage
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rs`:
- Around line 350-363: Strengthen the assertion around false_story so it
verifies the installer outcome was not strongly correlated to PRODUCT_ID via
app_id alone, rather than only rejecting InstallerFailure. Assert that the
outcome remains unkeyed or weakly correlated, or that the product transaction
lacks its evidence reference, while preserving valid package correlation
behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 7f758529-b0d7-44aa-9ce5-1dd17cc6b412
📒 Files selected for processing (1)
crates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rs
| let false_story = analysis.transactions.iter().find(|transaction| { | ||
| transaction.identity.store_product_id.as_deref() == Some(PRODUCT_ID) | ||
| && transaction.state == StoreTransactionState::InstallerFailure | ||
| }); | ||
| assert!( | ||
| false_story.is_none(), | ||
| "ADR-002 contract violated: a package-identity-free installer failure \ | ||
| was correlated onto package {PRODUCT_ID} through an app_id match alone \ | ||
| and produced the package-specific terminal state {:?} (confidence {:?})", | ||
| false_story.map(|transaction| transaction.state).unwrap(), | ||
| false_story | ||
| .map(|transaction| transaction.confidence.clone()) | ||
| .unwrap(), | ||
| ); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Assert the correlation boundary directly.
This predicate only rejects a package transaction in InstallerFailure. A future reducer can still strongly correlate the identity-free installer outcome to the product transaction, then select Required or another state. This test would pass while violating the app-ID-only correlation contract.
Assert that the installer outcome remains unkeyed or weakly correlated, or assert that the product transaction does not contain its evidence reference.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rs`
around lines 350 - 363, Strengthen the assertion around false_story so it
verifies the installer outcome was not strongly correlated to PRODUCT_ID via
app_id alone, rather than only rejecting InstallerFailure. Assert that the
outcome remains unkeyed or weakly correlated, or that the product transaction
lacks its evidence reference, while preserving valid package correlation
behavior.
There was a problem hiding this comment.
Pull request overview
Adds a new cmtraceopen-parser integration test suite that codifies Reducer Framework v1 “Store pilot Phase 2” semantic contracts for the Microsoft Store reducer as intentionally RED (currently failing) tests, while keeping CI green via #[ignore]. This fits the codebase by formalizing reducer-governance semantics (ADR-001/002/003) as executable contracts without changing runtime behavior.
Changes:
- Added three ignored integration tests asserting Store reducer semantic contracts (typed intent authority, input-order invariance, and identity/correlation rules).
- Recorded current reducer failure outputs verbatim in rustdoc to preserve the Phase 2 baseline behavior and guide Phase 3 fixes.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
Reducer Framework v1 Store pilot, the "PR 2 / Phase 2" slice of
docs/superpowers/plans/2026-08-07-reducer-framework-v1.md. Addscrates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rswith three integration tests that assert the semantic contracts decided in the
governance slice (#519) and record, verbatim, how the merged Store reducer
(#518) currently violates each of them.
All three tests are marked
#[ignore = "RED (Framework v1 Phase 2): fails against current reducer; fixed in Store pilot Phase 3"]so CI stays green. Each test's rustdoc carries the recorded failure output.
Production behavior is intentionally unchanged in this PR: no reducer,
rule, model, or fixture-expectation edits, only the new test file.
Test inventory source:
docs/architecture/reducer-framework-v1-store-inventory.md.Refs #358
Cluster 1: typed intent authority (ADR-001, design spec pipeline contract)
Contract asserted: a typed
StoreAssignmentstatingRequiredis theauthoritative statement of Intune intent. Caller-writable
named_dataon apackage/installer observation is raw metadata and must not override it, nor
flip the transaction to
NotTargeted.Recorded failure (verbatim):
Mechanism:
reduce_groupre-readsIntuneIntentfrom every memberobservation's
named_data; the caller-supplied pair on the package factarrives after the typed assignment's own entry, the last writer wins, and the
forced
NotTargetedstate override then fires.Cluster 2: input order and chronology (ADR-003)
Contract asserted: caller vector order is an acquisition detail, not
chronology. Reducing the same observations (same evidence ids, same record
ids, no timestamps) must give the same state and error regardless of the order
the events were supplied in.
Recorded failure (verbatim):
Mechanism:
state_rankresolves equal-ranked terminal candidates with>=over members iterated in input order, so whichever terminal record the caller
listed last silently wins the transaction state and its error.
Cluster 3: identity and correlation (ADR-002)
Contract asserted: an
app_idmatch without compatible package/productidentity is an Intune-level linkage only; it must not produce strong
correlation, and evidence that never named a package must not drive a
package-specific terminal outcome.
Recorded failure (verbatim):
Mechanism:
joinableaccepts an app_id-only match as a join, so theidentity-free installer outcome lands in the package's group and its
Win32InstallerFailedsignal becomes the transaction's High-confidenceterminal state.
Verification
cargo test -p cmtraceopen-parser --test intune_windows_microsoft_store_semantics -- --ignored: 3 failed (the recorded RED results above)cargo test -p cmtraceopen-parser: all green, 0 failures, 3 ignoredcargo clippy -p cmtraceopen-parser --all-targets -- -D warnings: cleancargo check --workspace: clean🤖 Generated with Claude Code
Summary by CodeRabbit