Skip to content

test(intune): record Store reducer Phase 2 semantic RED tests - #529

Merged
adamgell merged 1 commit into
mainfrom
store/reducer-phase2-red
Aug 8, 2026
Merged

test(intune): record Store reducer Phase 2 semantic RED tests#529
adamgell merged 1 commit into
mainfrom
store/reducer-phase2-red

Conversation

@adamgell

@adamgell adamgell commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Reducer Framework v1 Store pilot, the "PR 2 / Phase 2" slice of
docs/superpowers/plans/2026-08-07-reducer-framework-v1.md. Adds
crates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rs
with 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 StoreAssignment stating Required is the
authoritative statement of Intune intent. Caller-writable named_data on a
package/installer observation is raw metadata and must not override it, nor
flip the transaction to NotTargeted.

Recorded failure (verbatim):

thread 'typed_required_intent_survives_caller_writable_named_data' panicked at crates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rs:193:5:
assertion `left == right` failed: ADR-001/design contract: typed assignment intent is authoritative; caller-writable named_data must not override it
  left: NotTargeted
 right: Required

Mechanism: reduce_group re-reads IntuneIntent from every member
observation's named_data; the caller-supplied pair on the package fact
arrives after the typed assignment's own entry, the last writer wins, and the
forced NotTargeted state 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):

thread 'equivalent_input_permutation_does_not_change_the_reduction' panicked at crates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rs:278:5:
assertion `left == right` failed: ADR-003 contract: permuting non-ordered input must not change the reduced state
  left: InstallCompleted
 right: RegistrationFailure

Mechanism: state_rank resolves 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_id match without compatible package/product
identity 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):

thread 'an_app_id_match_without_package_identity_cannot_drive_a_package_terminal_outcome' panicked at crates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rs:354:5:
ADR-002 contract violated: a package-identity-free installer failure was correlated onto package 9WZSYNTH0001 through an app_id match alone and produced the package-specific terminal state InstallerFailure (confidence High)

Mechanism: joinable accepts an app_id-only match as a join, so the
identity-free installer outcome lands in the package's group and its
Win32InstallerFailed signal becomes the transaction's High-confidence
terminal 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 ignored
  • cargo clippy -p cmtraceopen-parser --all-targets -- -D warnings: clean
  • cargo check --workspace: clean

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added comprehensive coverage for Microsoft Store event interpretation, including assignment intent, evidence ordering, and package correlation.
    • Added scenarios for installer failures lacking package identity and app-ID-only matches.
    • Documented currently expected failures and their underlying behavior to support future corrections.

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>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Added 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.

Changes

Microsoft Store semantic coverage

Layer / File(s) Summary
Shared Store test fixtures
crates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rs
Added builders for observation contexts, Store artifacts, package identities, metadata, and AppX deployment events.
Reducer semantic assertions
crates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rs
Added ignored RED tests for typed Required intent precedence, input-order independence, and package-identity correlation during installer failures.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: apps

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and clearly describes the added Intune Microsoft Store reducer semantic tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch store/reducer-phase2-red

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added enhancement New feature or request intune Microsoft Intune related parser Log parser related test Testing related labels Aug 8, 2026
@adamgell

adamgell commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2e6c03b and 93dbb46.

📒 Files selected for processing (1)
  • crates/cmtraceopen-parser/tests/intune_windows_microsoft_store_semantics.rs

Comment on lines +350 to +363
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(),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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.

@adamgell
adamgell marked this pull request as ready for review August 8, 2026 21:58
Copilot AI lite review requested due to automatic review settings August 8, 2026 21:58
@adamgell
adamgell merged commit f633231 into main Aug 8, 2026
17 checks passed
@adamgell
adamgell deleted the store/reducer-phase2-red branch August 8, 2026 21:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@adamgell
adamgell restored the store/reducer-phase2-red branch August 8, 2026 22:00
@adamgell
adamgell deleted the store/reducer-phase2-red branch August 8, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request intune Microsoft Intune related parser Log parser related test Testing related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants