Skip to content

feat(sccm): analyze client health and location evidence - #392

Closed
adamgell wants to merge 43 commits into
codex/sccm-321-policy-analysisfrom
codex/sccm-320-health-analysis
Closed

adamgell wants to merge 43 commits into
codex/sccm-321-policy-analysisfrom
codex/sccm-320-health-analysis

Conversation

@adamgell

@adamgell adamgell commented Jul 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

Production implementation for #320, stacked temporarily on #391 only to reuse the pure normalized SCCM bundle input while keeping this issue diff isolated.

  • evidence-first Setup → Service → Identity → SiteAssignment → ManagementPoint → Transport reducer
  • existing nine sanitized scenarios plus adversarial fail-closed coverage
  • no policy-output dependency, native collection, live SCCM claim, or server/MP causal diagnosis

Current TDD state

RED commit 397dca6: cargo test --locked -p cmtraceopen-parser --test sccm_client_health fails because analyze_client_health does not yet exist. Implementation and full gates follow in later issue-scoped commits.

Closes no issue until production behavior, exact-head review, CodeRabbit, and required validation gates are complete.

Summary by CodeRabbit

  • New Features

    • Added comprehensive SCCM client-health analysis.
    • Reports health phases, findings, recovery status, coverage gaps, and requested diagnostic artifacts.
    • Correlates setup, service, identity, site-assignment, management-point, and transport evidence.
    • Distinguishes confirmed issues, insufficient evidence, contradictions, and terminal failures.
  • Bug Fixes

    • Improved handling of malformed, incomplete, unrelated, or conflicting health evidence.
    • Prevents unsupported evidence from producing misleading success or high-confidence failure results.
    • Ensures consistent ordering and duplicate-free analysis output.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3a5f1cad-bcad-4ce9-8607-f4b7c391ac05

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a public SCCM client-health analysis module that parses normalized evidence, resolves health phases and recovery through chronology-aware state resolution, emits phase-aware findings and coverage requests, enforces deterministic sanitized output, and validates behavior through 1,327 lines of integration tests.

Changes

SCCM client health analysis

Layer / File(s) Summary
Health analysis contracts and module wiring
crates/cmtraceopen-parser/src/sccm/client/health.rs, crates/cmtraceopen-parser/src/sccm/client/mod.rs
Defines public health-analysis schema, workflow, phase, finding, and analysis types. Exports the health module with public re-exports.
Evidence parsing and validation
crates/cmtraceopen-parser/src/sccm/client/health.rs
Filters supported artifacts by profile and parses setup, service, identity, location, assignment, management-point, and transport evidence. Validates GUIDs, bootstrap IDs, request IDs, site codes, test hosts, evidence references, and public identifiers. Constructs coverage-gap records for missing or malformed artifacts.
Phase progression and chronology resolution
crates/cmtraceopen-parser/src/sccm/client/health.rs
Implements phase-aware analysis: rejects duplicate identities, detects setup recovery and terminal outcomes, tracks service and identity progression, checks site and management-point states, resolves transport outcomes using keyed evidence and strict ordering, handles chronology contradictions, and maps duplicate identities to earliest affected phases.
Finding construction and output finalization
crates/cmtraceopen-parser/src/sccm/client/health.rs
Maps each health phase to artifact request and collection reason. Constructs insufficient-evidence, symptom, and confirmed-failure findings with phase metadata. Filters generic location warnings. Finalizes analysis with deterministic finding ordering, deduplicated coverage gaps and artifact requests, schema metadata, and last successful phase.
Integration test infrastructure and scenario contracts
crates/cmtraceopen-parser/tests/sccm_client_health.rs
Loads SCCM health manifests, normalizes evidence, constructs deterministically ordered bundles, and validates evidence citations. Tests schema version, workflow, successful phase, finding projections, public-output sanitization, and deterministic reordering.
Duplicate identity, transport state, and recovery validation
crates/cmtraceopen-parser/tests/sccm_client_health.rs
Tests duplicate artifact-identity handling, opposing transport outcomes, case-insensitive GUID correlation, same-GUID recovery vs. unrelated success, quoted terminal marker rejection, and recovery across canonical artifact rotation with whitespace-delimited terminal tokens.
Adversarial and chronology validation
crates/cmtraceopen-parser/tests/sccm_client_health.rs
Tests validator regression, zero statuses and errors, mismatched identifiers, unsafe hosts and sources, unknown profiles, inaccessible artifacts, cross-artifact time inversion, invalid offsets, terminal events before requests, and bootstrap-correlation edge cases. Tests output sanitization and terminal token boundaries. Tests setup recovery, conflicting evidence identities, and invalid chronology with deterministic results.
Fixture expectation updates
crates/cmtraceopen-parser/tests/fixtures/sccm/client/health/*/expected.json
Malformed health fixture finding classification changed from symptom to insufficientEvidence. No-site-or-mp fixture now records client-location as a coverage gap.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Bundle as SccmNormalizedBundle
  participant Analyzer as analyze_client_health
  participant EvidenceParse as Evidence parsing
  participant PhaseResolve as Phase resolution
  participant FindingBuild as Finding construction
  participant Output as SccmHealthAnalysis

  Bundle->>Analyzer: normalized client evidence
  Analyzer->>EvidenceParse: filter and parse artifacts
  EvidenceParse-->>Analyzer: validated evidence facts
  Analyzer->>PhaseResolve: resolve setup and transport states
  PhaseResolve-->>Analyzer: phase outcomes and chronology
  Analyzer->>FindingBuild: construct findings and coverage gaps
  FindingBuild-->>Analyzer: insufficient-evidence, symptom, or confirmed-failure
  Analyzer->>Output: deterministic sorted analysis with requests
  Output-->>Analyzer: sanitized public output
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding SCCM client health and location evidence analysis functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@adamgell

Copy link
Copy Markdown
Owner Author

#320 RED-to-GREEN implementation checkpoint

Exact pushed head: 990211d19a4415300ce77322836b6da3488cd082

Scope is limited to the client setup/service/identity/site-assignment/management-point/transport reducer, its issue-owned tests, and two fixture corrections required by the reviewed #318 finding validator. It consumes the #321-stack SccmNormalizedBundle only; it does not consume policy findings or make server/cross-side claims.

Commits:

  • 397dca6e frozen public RED contract
  • fa20e780 nine-scenario reducer implementation
  • 11d4c6e5 adversarial RED chronology/provenance contract
  • 990211d1 fail-closed correction

Fixture matrix: success, setup terminal, identity terminal, no site/MP, transport terminal, contradictory bootstrap IDs, rotation boundary, malformed logical record, and incomplete/access-denied identity. Permanent mutations cover zero error/status, same-key recovery versus different key, client/request/host mismatch, source mismatch, missing/unknown profile, partial/access-denied/capped/skipped/unsupported/parse-failed coverage, inverted/invalid timestamp provenance, request-before-terminal ordering, later success/failure resolution, unsafe artifact provenance, and raw public-output leakage.

Verification:

  • cargo test --locked -p cmtraceopen-parser --test sccm_client_health — 6/6 pass
  • prescribed --test sccm_client_intake — target does not exist on the reviewed base; actual --test sccm_client_intake_fixture_contract — 3/3 pass
  • --test sccm_spine_contract — 136/136 pass
  • cargo test --locked -p cmtraceopen-parser — all unit/integration/doc tests pass
  • strict Clippy — pass
  • Rust 1.88.0 wasm32 check — pass
  • frontend TypeScript/Vite build — pass
  • 18 health JSON files — valid
  • scoped rustfmt and git diff --check — pass
  • global cargo fmt --check --all still reports inherited non-SCCM Client: diagnose setup, health, identity, assignment, and location #320 files only; none of the five SCCM Client: diagnose setup, health, identity, assignment, and location #320-owned paths overlap

The PR remains draft. The existing CodeRabbit status is a skipped-draft run, not approval. Fresh exact-head CodeRabbit review and a different independent reviewer are required before any base change or merge. Native Windows/lab acceptance remains explicitly pending and is not claimed.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

Please perform a substantive review of exact head 990211d19a4415300ce77322836b6da3488cd082. Include the committed .log fixtures and adversarial health tests; the earlier CodeRabbit status was a skipped draft run and is not approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

@adamgell I will perform a substantive full review of exact head 990211d19a4415300ce77322836b6da3488cd082. I will include the committed .log fixtures and adversarial health tests.

✅ 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: 6

🧹 Nitpick comments (5)
crates/cmtraceopen-parser/src/sccm/client/health.rs (2)

712-718: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Rename fact_is_strictly_after to match its parameter order.

fact_is_strictly_after(earlier, later) returns true when earlier sorts before later. The name states the opposite of what the first parameter does. All three call sites pass arguments in the correct order, so behavior is right today, but the name invites an inverted call during later edits. The ordering rules here are the fail-closed gate for terminal findings, so an inverted call would be a silent correctness change.

known_inversion reads correctly and needs no change.

♻️ Proposed rename
-fn fact_is_strictly_after(earlier: &HealthFact, later: &HealthFact) -> bool {
+fn fact_is_strictly_before(earlier: &HealthFact, later: &HealthFact) -> bool {
     compare_fact_order(earlier, later) == Some(std::cmp::Ordering::Less)
 }

Update the three call sites at Lines 607, 713, and 729.

🤖 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/src/sccm/client/health.rs` around lines 712 - 718,
Rename fact_is_strictly_after to reflect that it returns true when the first
parameter sorts before the second, updating its definition and all three call
sites while preserving argument order and behavior. Leave known_inversion
unchanged.

249-275: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Collapse the repeated has_captured_without_record branches.

The same predicate is evaluated in three separate inline if expressions to pick the finding ID, title, and summary. Select the triple once. The bare block at Line 273 also adds no scope; assign directly.

♻️ Proposed refactor
-        findings.push(insufficient_finding(
-            if has_captured_without_record {
-                "health-service-malformed"
-            } else {
-                "health-service-coverage-gap"
-            },
-            SccmHealthPhase::Service,
-            last_successful_phase,
-            if has_captured_without_record {
-                "Client service evidence is malformed"
-            } else {
-                "Client service evidence is incomplete"
-            },
-            if has_captured_without_record {
-                "A captured service artifact contained no complete version-profiled logical record."
-            } else {
-                "No complete version-profiled service or evaluation outcome was available."
-            },
+        let (finding_id, title, summary) = if has_captured_without_record {
+            (
+                "health-service-malformed",
+                "Client service evidence is malformed",
+                "A captured service artifact contained no complete version-profiled logical record.",
+            )
+        } else {
+            (
+                "health-service-coverage-gap",
+                "Client service evidence is incomplete",
+                "No complete version-profiled service or evaluation outcome was available.",
+            )
+        };
+        findings.push(insufficient_finding(
+            finding_id,
+            SccmHealthPhase::Service,
+            last_successful_phase,
+            title,
+            summary,
             Vec::new(),
             coverage_gaps_for_missing_group(&service_artifacts, CLIENT_EVALUATION_GROUP, false),
             request_for_phase(SccmHealthPhase::Service),
         ));
         return finalize_health_analysis(last_successful_phase, findings);
     };
-    {
-        last_successful_phase = Some(SccmHealthPhase::Service);
-    }
+    last_successful_phase = Some(SccmHealthPhase::Service);
🤖 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/src/sccm/client/health.rs` around lines 249 - 275,
The service finding construction in the health analysis flow repeats
has_captured_without_record for the ID, title, and summary; select these three
values once before findings.push and reuse them in insufficient_finding. Remove
the unnecessary bare scope block and assign last_successful_phase directly
before returning, preserving the existing values and behavior.
crates/cmtraceopen-parser/tests/sccm_client_health.rs (2)

142-162: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Normalize the expected coverage-gap order.

actual_finding_projection sorts gap_ids at Line 191, but expected_finding_projection passes finding["coverageGapArtifactIds"] through unsorted. The two values are then compared with assert_eq!. Every current fixture declares at most one gap ID, so the mismatch is not visible. A future fixture that lists two IDs in a different order fails the test even when the analyzer is correct.

Sort the expected list with the same key.

♻️ Proposed refactor
         .map(|finding| {
+            let mut gap_ids = finding["coverageGapArtifactIds"]
+                .as_array()
+                .cloned()
+                .unwrap_or_default();
+            gap_ids.sort_by_key(Value::to_string);
             json!({
                 "findingId": finding["findingId"],
                 "healthPhase": finding["phase"],
                 "class": finding["class"],
                 "confidence": finding["confidence"],
-                "coverageGapArtifactIds": finding["coverageGapArtifactIds"],
+                "coverageGapArtifactIds": gap_ids,
🤖 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/sccm_client_health.rs` around lines 142 -
162, Update expected_finding_projection to normalize
finding["coverageGapArtifactIds"] by sorting its IDs with the same ordering used
by actual_finding_projection before inserting them into the JSON projection.
Preserve the existing null and field mappings, and ensure multi-ID fixtures
compare order-independently.

393-397: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Two test-robustness notes.

Line 393 compares Option<SccmHealthPhase> with >=. That relies on the variant declaration order in SccmHealthPhase as a semantic phase ordering. Reordering the variants would silently change what this assertion accepts. State the intent explicitly, for example with matches!(phase, Some(SccmHealthPhase::ManagementPoint | SccmHealthPhase::Transport)).

Line 472 pushes the same message for all four coverage states in the loop. Include the state so a failure names the input.

♻️ Proposed refactor for the loop diagnostic
         if analyze_client_health(&incomplete_coverage)
             .last_successful_phase
             .is_some()
         {
-            accepted.push("non-captured coverage created a successful phase");
+            accepted.push(format!(
+                "non-captured coverage {coverage:?} created a successful phase"
+            ));
         }

accepted then holds String values; change the other accepted.push calls to .to_owned() or declare Vec<String>.

Also applies to: 458-474

🤖 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/sccm_client_health.rs` around lines 393 -
397, Update the `last_successful_phase` assertion to use an explicit `matches!`
check for `ManagementPoint` or `Transport` instead of relying on `Option`
ordering. In the coverage-state loop, include the current state in the accepted
diagnostic message, and make `accepted` consistently store `String` values by
converting the other pushed literals as needed.
crates/cmtraceopen-parser/tests/fixtures/sccm/client/health/no-site-or-mp/expected.json (1)

8-8: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The gap ID matches the reducer; the site branch reports a group instead of artifacts.

coverageGapArtifactIds now contains client-location. That matches analyze_client_health, which hardcodes a single gap with artifact_id: CLIENT_LOCATION_GROUP and coverage: Partial in the missing-site branch (health.rs Lines 363-367).

Every other stage builds its gaps through coverage_gaps_for_missing_group, which reports one gap per artifact with that artifact's real coverage state. The site branch is the only one that reports a group name and a fixed Partial state. In this scenario the location artifact is captured, so the emitted Partial state does not describe any artifact. Consider routing this branch through coverage_gaps_for_missing_group with the location artifacts, for consistency with the management-point branch at Line 405.

Confirm the intent before changing, because the fixture freezes the current shape.

🤖 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/fixtures/sccm/client/health/no-site-or-mp/expected.json`
at line 8, Update the missing-site branch in analyze_client_health to build
coverage gaps via coverage_gaps_for_missing_group using the location artifacts,
matching the management-point branch’s per-artifact coverage behavior. Preserve
the client-location gap identity and ensure each emitted gap uses the
corresponding artifact’s actual coverage state rather than a group-level Partial
value; update the affected fixture expectation accordingly.
🤖 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/src/sccm/client/health.rs`:
- Around line 912-921: Normalize stored client GUID values to a consistent
lowercase representation in every parse_*_fact path that assigns client_guid,
matching policy.rs extract_uuid_label behavior. Keep valid_guid validation
unchanged, and ensure all downstream comparisons in matching_service, the
identity search, and matching_site receive normalized GUIDs.
- Around line 412-426: Update the Succeeded branch of resolve_transport handling
in the health analysis flow: when chain_has_known_inversion returns true, emit
the existing health-transport-chronology-uncertain finding using started and
response as evidence, then prevent fallthrough to the misleading
health-transport-insufficient result. Preserve the current successful Transport
finalization when no inversion exists.
- Around line 277-311: Update the identity-failure handling around the visible
IdentityFailed lookup to ignore failures superseded by a later IdentitySucceeded
fact for the same client_guid, reusing the existing is_later_in_same_artifact
chronology check used by resolve_setup. Preserve terminal and
chronology-uncertain findings only for unrecovered failures, and add a
health-analysis test scenario covering a failure followed by a same-GUID
success.
- Around line 878-903: Update field_value to accept a marker match only when the
character immediately before the matched key is absent or non-alphanumeric,
preventing longer keys such as httperror, httpstatus, or prefixed clientGuid
identifiers from matching. Preserve the existing multiple-match rejection and
value parsing behavior.

In `@crates/cmtraceopen-parser/tests/sccm_client_health.rs`:
- Around line 254-261: Update the evidence omission assertion in the
expected_ranges loop to match each expected reference by artifactId, lineStart,
and lineEnd. Ensure one actual reference cannot satisfy multiple expected ranges
within the same artifact, while preserving the existing scenario and finding_id
failure message.
- Around line 647-650: Update the assertion in the unrelated_analysis test to
validate the findings count before accessing findings[0], ensuring a missing
finding produces a clear assertion failure rather than an index-out-of-bounds
panic. Keep the existing health-setup-contradictory ID assertion after the count
check.

---

Nitpick comments:
In `@crates/cmtraceopen-parser/src/sccm/client/health.rs`:
- Around line 712-718: Rename fact_is_strictly_after to reflect that it returns
true when the first parameter sorts before the second, updating its definition
and all three call sites while preserving argument order and behavior. Leave
known_inversion unchanged.
- Around line 249-275: The service finding construction in the health analysis
flow repeats has_captured_without_record for the ID, title, and summary; select
these three values once before findings.push and reuse them in
insufficient_finding. Remove the unnecessary bare scope block and assign
last_successful_phase directly before returning, preserving the existing values
and behavior.

In
`@crates/cmtraceopen-parser/tests/fixtures/sccm/client/health/no-site-or-mp/expected.json`:
- Line 8: Update the missing-site branch in analyze_client_health to build
coverage gaps via coverage_gaps_for_missing_group using the location artifacts,
matching the management-point branch’s per-artifact coverage behavior. Preserve
the client-location gap identity and ensure each emitted gap uses the
corresponding artifact’s actual coverage state rather than a group-level Partial
value; update the affected fixture expectation accordingly.

In `@crates/cmtraceopen-parser/tests/sccm_client_health.rs`:
- Around line 142-162: Update expected_finding_projection to normalize
finding["coverageGapArtifactIds"] by sorting its IDs with the same ordering used
by actual_finding_projection before inserting them into the JSON projection.
Preserve the existing null and field mappings, and ensure multi-ID fixtures
compare order-independently.
- Around line 393-397: Update the `last_successful_phase` assertion to use an
explicit `matches!` check for `ManagementPoint` or `Transport` instead of
relying on `Option` ordering. In the coverage-state loop, include the current
state in the accepted diagnostic message, and make `accepted` consistently store
`String` values by converting the other pushed literals as needed.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7723c446-3d08-4a12-afbe-355e51eda16e

📥 Commits

Reviewing files that changed from the base of the PR and between 1e5a317 and 990211d.

📒 Files selected for processing (5)
  • crates/cmtraceopen-parser/src/sccm/client/health.rs
  • crates/cmtraceopen-parser/src/sccm/client/mod.rs
  • crates/cmtraceopen-parser/tests/fixtures/sccm/client/health/malformed/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/client/health/no-site-or-mp/expected.json
  • crates/cmtraceopen-parser/tests/sccm_client_health.rs

@adamgell adamgell left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Independent exact-head review verdict: BLOCK at 990211d19a4415300ce77322836b6da3488cd082 against temporary stack base 1e5a3174ceaaf2f7d045d4e36a4e1955a8b06f91. (GitHub does not permit the PR author's account to submit a formal REQUEST_CHANGES event, so this formal review is COMMENTED with an explicit blocking verdict.)

Two additional fail-closed blockers are inline: duplicate artifact identities can make input order authoritative and can panic the public analyzer, and equal-UTC opposing same-key transport outcomes can be promoted to a high-confidence terminal result by artifact-ID sort order.

Disposable probes also independently reproduced three hosted CodeRabbit blockers: UUID case variants split one client key, a later same-artifact/same-GUID identity success does not recover a terminal failure, and httperror= is accepted as the exact error= field. The committed evidence-range assertion also matches expected citations by artifact ID without requiring each expected line range. All probes were reverted; the review worktree is clean.

Fresh baseline gates passed: health 6/6, actual intake contract 3/3, spine 136/136, full parser suite, strict parser Clippy, Rust 1.88 wasm32 check, frontend build, all 18 health JSON files, scoped rustfmt, and diff checks. Global cargo fmt --check --all still reports inherited formatting outside all five #320-owned paths. Local CodeRabbit exact-range review was authenticated and correctly scoped but rate-limited for 19 minutes; that is not approval. Hosted CodeRabbit is exact-head CHANGES_REQUESTED.

Please keep #392 draft/open, add focused regression tests for every confirmed mutation, and rerun both substantive CodeRabbit and a different independent review on the corrected exact head. The PR remains stacked only for SccmNormalizedBundle; it must not merge before the #321 base disposition is explicit.

@adamgell

Copy link
Copy Markdown
Owner Author

#320 corrective RED → GREEN at exact head 3c7d8123769cc2af3a080c0c2a531574229a7a98

Corrected fail-closed contracts

  • Reject duplicate public artifact identities before map construction; emit one deterministic InsufficientEvidence collision result instead of panicking or selecting vector order.
  • Treat equal-UTC opposing outcomes for the same validated request/MP key as contradictory/low, independent of artifact-ID sort position.
  • Normalize every parsed client GUID to lowercase after unchanged validation.
  • Suppress an identity terminal only when a later success has the same normalized GUID and is later in the same artifact; a different-GUID mutation still retains the terminal failure.
  • Require a non-alphanumeric left boundary for exact health fields, so httperror= is not error=.
  • Require every expected artifact/line range in the fixture citation validator; one reference cannot satisfy two ranges in one artifact.
  • Hardened the unrelated-setup count assertion and applied behavior-preserving CodeRabbit naming/projection/diagnostic refactors.

TDD evidence

  • RED b80b72e67a8d806bd77131fd42d002ffb120aa5a: focused target ran 12 tests, 6 prior green / 6 new intended failures (duplicate panic, equal-time terminal selection, GUID case split, unrecovered identity, embedded key, incomplete citation validator).
  • GREEN 3c7d8123769cc2af3a080c0c2a531574229a7a98: focused target 12/12. A disposable exact-key mutation made the identity-recovery test fail for a different GUID, then was reverted before commit.

Fresh verification

  • cargo test --locked -p cmtraceopen-parser --test sccm_client_health — 12/12.
  • Plan literal cargo test --locked -p cmtraceopen-parser --test sccm_client_intake — target does not exist; Cargo identifies sccm_client_intake_fixture_contract.
  • cargo test --locked -p cmtraceopen-parser --test sccm_client_intake_fixture_contract — 3/3.
  • cargo test --locked -p cmtraceopen-parser --test sccm_spine_contract — 136/136.
  • cargo test --locked -p cmtraceopen-parser — all 754 parser tests passed.
  • cargo clippy --locked -p cmtraceopen-parser --all-targets -- -D warnings — pass.
  • rustup run 1.88.0 cargo check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown — pass.
  • npm run frontend:build — pass.
  • All 18 health fixture JSON files — jq empty pass.
  • Scoped Rustfmt for the two changed SCCM Client: diagnose setup, health, identity, assignment, and location #320 files and git diff --check — pass.
  • cargo fmt --check --all — inherited failure only in 17 unchanged paths: parser ESP redaction.rs, reducer.rs, timeline.rs, tests/esp_diagnostics.rs; native commands/recent_entries.rs, commands/system_preferences.rs, esp/process.rs, esp/registry.rs, esp/relaunch.rs, esp/system.rs, graph_api/esp.rs, graph_api/models.rs, intune/evtx_parser.rs, macos_diag/unified_log.rs, menu.rs, sysmon/evtx_parser.rs, and tests/esp_diagnostics_sources.rs. Neither SCCM Client: diagnose setup, health, identity, assignment, and location #320-owned file is reported.

Review/thread state

Seven fixed exact-head threads were resolved. One CodeRabbit minor thread remains deliberately open: the claimed inverted TransportResolution::Succeeded fallthrough is unreachable in the public reducer because each preceding adjacency is admitted only when its comparison is not Greater, while start→outcome requires strict Less; chain_has_known_inversion checks those same adjacent pairs. No untestable dead-branch change was made. The frozen group-level client-location / Partial missing-site gap is also retained: emitting per-artifact Captured as a coverage gap would violate the shared finding validator.

PR remains draft/open and temporarily stacked on #321 solely for SccmNormalizedBundle. Native Windows/live SCCM acceptance is still unclaimed. Fresh exact-head CodeRabbit and a different independent review are required before any merge.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please run a fresh substantive review of exact head 3c7d8123769cc2af3a080c0c2a531574229a7a98, including the corrective RED→GREEN tests and the reachability rationale for the one intentionally open prior minor thread. A skipped, stale, rate-limited, or prior-head result is not approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

@adamgell I will run a fresh substantive review of #392 at exact head 3c7d8123769cc2af3a080c0c2a531574229a7a98.

The review will include the corrective RED-to-GREEN tests and the reachability rationale for the intentionally open minor thread. I will not treat a skipped, stale, rate-limited, or prior-head result as approval.


✏️ Learnings added
Learnt from: adamgell
URL: https://github.com/adamgell/cmtraceopen/pull/392

Timestamp: 2026-07-31T12:48:16.908Z
Learning: In `crates/cmtraceopen-parser` SCCM client health reduction, the claimed inverted `TransportResolution::Succeeded` fallthrough is unreachable when each preceding adjacency is accepted only if its comparison is not `Greater`, the start-to-outcome comparison requires strict `Less`, and `chain_has_known_inversion` checks those same adjacent pairs. Do not request an untestable dead-branch change for this case without new contradictory evidence.

Learnt from: adamgell
URL: https://github.com/adamgell/cmtraceopen/pull/392

Timestamp: 2026-07-31T12:48:16.908Z
Learning: For the SCCM client health fixture contract, retain the group-level `client-location` / `Partial` missing-site coverage gap. Do not emit per-artifact `Captured` as a coverage gap because that violates the shared finding validator.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 2

🧹 Nitpick comments (1)
crates/cmtraceopen-parser/tests/sccm_client_health.rs (1)

720-750: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive the diagnostic message from the coverage state.

SccmCoverageState derives Debug. Replace the variant match with format!("non-captured coverage {coverage:?} created a successful phase"). Change accepted to Vec<String> and convert the other diagnostic literals with .to_owned().

🤖 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/sccm_client_health.rs` around lines 720 -
750, Update the test diagnostics around analyze_client_health to use a
Vec<String> for accepted, derive the coverage name directly with
format!("non-captured coverage {coverage:?} created a successful phase"), and
convert the remaining literal diagnostics to owned Strings. Remove the redundant
SccmCoverageState match while preserving the existing failure reporting
behavior.
🤖 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/sccm_client_health.rs`:
- Around line 545-548: In the test assertion around unrelated_analysis, first
assert that unrelated_analysis.findings contains the expected number of
findings, then index findings[0] to verify its finding_id. Follow the
established assertion pattern from
health_same_key_setup_recovery_does_not_cross_bootstrap_identity.
- Around line 459-480: Update health_guid_matching_is_case_insensitive to assert
that each GUID replacement changes the expected evidence and that the Bootstrap
completed setup evidence is found, failing immediately when the fixture no
longer matches. Retain the existing case-mutation and final
analyze_client_health assertion after confirming the mutations were applied.

---

Nitpick comments:
In `@crates/cmtraceopen-parser/tests/sccm_client_health.rs`:
- Around line 720-750: Update the test diagnostics around analyze_client_health
to use a Vec<String> for accepted, derive the coverage name directly with
format!("non-captured coverage {coverage:?} created a successful phase"), and
convert the remaining literal diagnostics to owned Strings. Remove the redundant
SccmCoverageState match while preserving the existing failure reporting
behavior.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cb249ccc-6a77-4da1-b7ff-34d5e72b49de

📥 Commits

Reviewing files that changed from the base of the PR and between 990211d and 3c7d812.

📒 Files selected for processing (2)
  • crates/cmtraceopen-parser/src/sccm/client/health.rs
  • crates/cmtraceopen-parser/tests/sccm_client_health.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/cmtraceopen-parser/src/sccm/client/health.rs

@adamgell adamgell left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Independent exact-head review verdict: BLOCK at 3c7d8123769cc2af3a080c0c2a531574229a7a98 against temporary stack base 1e5a3174ceaaf2f7d045d4e36a4e1955a8b06f91. GitHub does not permit the PR author account to submit REQUEST_CHANGES, so this formal review is COMMENTED with an explicit blocking verdict.

The six prior semantic blockers now reproduce green: duplicate artifact IDs are deterministic/non-panicking, equal-time opposing same-key outcomes stay contradictory/low, GUID joins are case-normalized, same-artifact same-GUID identity recovery works, embedded httperror= is rejected, and every expected citation range is required.

Two additional fail-closed blockers remain:

  • quoted terminal marker is promoted to high failure: a disposable probe changed only the prefix to Narrative quotes Transport terminal failure ...; the analyzer still emitted health-transport-terminal / ConfirmedFailure / High because event grammars use substring matching.
  • exact cross-rotation recovery cannot suppress a stale high identity failure: a failure in canonical ClientIDManagerStartup.lo_ followed by exact same-GUID success in current ClientIDManagerStartup.log at later NormalizedUtc still emitted health-identity-terminal / High. This conflicts with the plan requirement to use resolved UTC across artifacts when provenance permits it.

Hosted CodeRabbit also completed an exact-head review as CHANGES_REQUESTED: the GUID-case regression can pass vacuously if fixture text drifts, and the unrelated-GUID test indexes findings[0] before asserting cardinality. Its older inverted-success thread is not a code-reachability blocker: service, identity, site, MP, and start selection each reject Greater on the same adjacent comparisons, while start-to-outcome requires strict Less; therefore TransportResolution::Succeeded cannot reach the chain_has_known_inversion == true arm.

Fresh exact-head verification:

  • health 12/12; actual intake contract 3/3; spine 136/136; full parser 754/754;
  • strict parser Clippy; Rust 1.88 wasm32; TypeScript/Vite frontend build; all 18 health JSON files; scoped rustfmt; diff check; detached status clean;
  • the plan-literal sccm_client_intake target is absent; the repository target is sccm_client_intake_fixture_contract;
  • repo-wide format still reports only 17 inherited paths, none owned by #320;
  • local CodeRabbit v0.7.1 was authenticated and exact-range scoped but rate-limited for 13 minutes, which is not approval.

Keep #392 draft/open and stacked on #321 only for SccmNormalizedBundle. Add focused RED to GREEN tests for both semantic blockers, harden the two current CodeRabbit test contracts, then request a fresh exact-head CodeRabbit review and a different independent review. No native Windows acceptance is claimed.

@adamgell

Copy link
Copy Markdown
Owner Author

🟢 #320 round-2 fixer active in fresh isolated worktree from exact head 3c7d812. I am freezing both independent-review P1s as permanent RED tests before implementation, hardening the two current CodeRabbit tests, and preserving the documented unreachable inverted-success rationale. I will not push until focused/aggregate parser, strict Clippy, Rust 1.88 wasm32, frontend, fixture JSON, scoped formatting/diff, and clean-status gates are recorded. Guarded non-force push only; PR stays draft.

@adamgell

Copy link
Copy Markdown
Owner Author

#320 round-2 RED to GREEN correction

Exact pushed head: 665f75bbf7670d0242325fe8868b0cda631851bd

Commits:

  • 0e40559388b417975afc336f553d70b67f5fb34b freezes the two independent-review P1 regressions plus the exact-head CodeRabbit test hardenings.
  • 665f75bbf7670d0242325fe8868b0cda631851bd implements the smallest fail-closed behavior.

TDD evidence:

  • RED: focused health target ran 14 tests, 12 passed and only 2 new tests failed. Quoted narrative text still created a high terminal transport failure, and a later exact same-GUID success in current ClientIDManagerStartup.log did not recover the canonical .lo_ failure despite usable NormalizedUtc provenance.
  • GREEN: focused health target is 14/14.

Behavior now requires the versioned public-message envelope plus an exact allowed event prefix before any phase record is admitted. Identity recovery uses strict logical ordering: physical line order within one artifact, or usable normalized UTC across artifacts. Unknown or unusable cross-artifact time remains non-recovery. The rotation test covers canonical .lo_ failure, later current .log success, exact normalized GUID, and reversed artifact/evidence vectors.

CodeRabbit test findings are hardened: GUID mutations prove every replacement occurred before asserting case-insensitive matching, and the unrelated-GUID finding count is asserted before indexing. The noncaptured diagnostic now derives from SccmCoverageState Debug output without a repeated variant match.

Verification at exact code:

  • cargo test --locked -p cmtraceopen-parser --test sccm_client_health — 14/14.
  • plan-literal --test sccm_client_intake — target absent; Cargo identifies sccm_client_intake_fixture_contract.
  • actual intake contract — 3/3.
  • spine contract — 136/136.
  • full parser suite — 756/756.
  • strict parser Clippy — pass.
  • Rust 1.88.0 wasm32 check — pass.
  • frontend TypeScript/Vite build — pass.
  • all 18 health JSON files — jq empty pass.
  • scoped rustfmt for both SCCM Client: diagnose setup, health, identity, assignment, and location #320 files, git diff --check, and clean status — pass.
  • global cargo fmt --check --all still reports the same 17 inherited paths outside SCCM Client: diagnose setup, health, identity, assignment, and location #320; neither owned file is reported.

Local CodeRabbit CLI v0.7.1 was authenticated and exact-range scoped from 3c7d8123 to 665f75bb, but rate-limited for 36 minutes. That is not approval. Four handled threads are being replied to and resolved. The inverted-success thread remains open and documented because its branch is unreachable under the same adjacent-order predicates; no untestable dead-branch change was made.

PR remains draft/open and stacked on #321 only for SccmNormalizedBundle. Fresh substantive exact-head CodeRabbit and a different independent review remain required. No native Windows or live SCCM acceptance is claimed.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please run a fresh substantive review of exact head 665f75bbf7670d0242325fe8868b0cda631851bd. Include permanent RED 0e405593, exact event-prefix admission, canonical .lo_ to current .log NormalizedUtc recovery, the two test hardenings, and the predicate proof on the intentionally open inverted-success thread. A stale, skipped, rate-limited, incremental prior-head, or acknowledgment-only result is not approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

@adamgell I will run a fresh full review of #392 at exact head 665f75bbf7670d0242325fe8868b0cda631851bd.

The review will include 0e405593, exact event-prefix admission, canonical .lo_ to current .log NormalizedUtc recovery, both test hardenings, and the predicate proof for the intentionally open inverted-success thread. I will not treat an incremental, stale, skipped, rate-limited, or acknowledgment-only result as approval.

✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 29 minutes.

@adamgell

Copy link
Copy Markdown
Owner Author

Review-gate clarification: CodeRabbit submitted an exact-head formal approval and independently confirmed/withdrew the prior inverted-success comment, leaving zero unresolved threads. However, its full-review response also states that the fair-usage limit was reached and the next included review is in 29 minutes. Under the program rule that a rate-limited result is not substantive approval, this is recorded but not accepted as merge clearance. PR remains draft; a different independent exact-head review is still required, and a fresh non-rate-limited CodeRabbit run remains the conservative gate.

@adamgell adamgell left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Independent exact-head review verdict: BLOCK at 665f75bbf7670d0242325fe8868b0cda631851bd against temporary stack base 1e5a3174ceaaf2f7d045d4e36a4e1955a8b06f91. GitHub does not allow the PR author account to submit REQUEST_CHANGES, so this formal review is COMMENTED with an explicit blocking verdict.

The requested round-2 fixes reproduce green: quoted/incidental terminal text is rejected; exact same-GUID .lo_ to current identity recovery works only with strict NormalizedUtc; the GUID mutation cannot pass vacuously; and finding cardinality is asserted before indexing. Four additional plan-backed fail-closed cases remain, detailed inline.

Disposable external harness (the review worktree stayed clean): cargo test --offline -- --nocapture — 4/4 adversarial assertions failed for punctuation-prefixed terminal fields, canonical setup recovery, conflicting duplicate evidence identity, and invalid cross-artifact chronology. Fresh repository gates: health 14/14; intake 3/3; spine 136/136; full parser pass; strict Clippy pass; Rust 1.88 wasm32 pass; frontend build pass; 18 JSON pass; owned rustfmt/diff/status pass. Repo-wide formatting still differs only in inherited non-#320 paths. Local CodeRabbit v0.7.1 was authenticated/exact-range scoped but rate-limited for 27 minutes; hosted CodeRabbit is a separate gate and its rate-limited approval is not this independent review.

Keep #392 draft/open. Freeze these four probes RED, implement the smallest fail-closed behavior, rerun the aggregate gates, obtain a fresh non-rate-limited CodeRabbit review, then request another independent exact-head review. No native Windows acceptance is claimed.

@adamgell

Copy link
Copy Markdown
Owner Author

Round-3 correction claimed from exact head 665f75b in isolated branch codex/sccm-320-665f-round3. I am reproducing all four blockers from review 4828846565 as permanent RED tests before production changes. After focused GREEN and aggregate gates, I will push non-force only if the remote head is still this lineage, reply/resolve each handled thread, and request fresh substantive exact-head CodeRabbit. This remains draft and requires a different independent exact-head re-review.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review\n\nFresh substantive exact-head review requested for fc2cf5d. Please review the full 665f75b..fc2cf5d correction range. The local CLI attempt was authenticated and exact-range scoped but rate-limited; that is not approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

@adamgell I will review PR #392 at exact head fc2cf5da9e5903314e432fbf73d7ec7d0fb28ddc.

I will review the correction range from 665f75bbf7670d0242325fe8868b0cda631851bd to fc2cf5da9e5903314e432fbf73d7ec7d0fb28ddc. I will not treat the rate-limited local CLI result as approval.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@adamgell

Copy link
Copy Markdown
Owner Author

Round-3 RED-to-GREEN correction is pushed to draft PR #392 at exact head fc2cf5d.\n\nScope:\n- exact whitespace field boundaries reject http-error= and http_error= as terminal error evidence;\n- same-bootstrap setup recovery crosses canonical ccmsetup.lo_ to ccmsetup.log only with strict comparable order and matching filename/rotation provenance;\n- duplicate evidence IDs or duplicate exact evidence references fail closed before reduction;\n- complete Transport success requires a fully usable ordered prerequisite chain; invalid cross-artifact timestamps emit a cited low-confidence chronology result instead.\n\nCommits:\n- RED 11024ad: 18 focused tests, 14 prior pass and 4 intended semantic failures.\n- GREEN fc2cf5d: focused health 18/18.\n\nFixture/mutation matrix:\n- both punctuation-prefixed terminal fields;\n- normalized-UTC lo_ failure then current success, reversed vectors, and rotation metadata mismatch;\n- conflicting records sharing both identities, duplicate evidence ID alone, and duplicate reference alone;\n- every success-chain timestamp OffsetInvalid with no UTC, seven cited chain references, and reversed vectors.\n\nFresh verification:\n- health 18/18; available intake contract sccm_client_intake_fixture_contract 3/3; spine 136/136;\n- full cmtraceopen-parser suite passed;\n- strict all-target parser Clippy passed;\n- Rust 1.88.0 wasm32 check passed;\n- frontend TypeScript/Vite build passed;\n- all 18 health JSON files passed jq validation;\n- owned rustfmt, git diff --check, remote/head equality, and clean status passed.\nThe plan-literal sccm_client_intake target is absent on this stacked base; Cargo exposes sccm_client_intake_fixture_contract. Repo-wide formatting still reports 24 inherited hunks across 17 unchanged non-#320 paths; neither owned #320 file is reported.\n\nDependency/review state:\n- PR remains draft/open and stacked on #321 only for SccmNormalizedBundle; no policy output dependency was introduced.\n- All four round-3 blocking threads have exact-head replies and are resolved.\n- Local CodeRabbit 0.7.1 was authenticated and exact-range scoped but rate-limited for eight minutes. Hosted CodeRabbit was requested at #392 (comment) and returned a two-minute review-limit response. Neither rate-limited result is approval; a substantive exact-head retry remains required.\n- A different independent exact-head re-review remains required. No native Windows or live SCCM acceptance is claimed.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai full review\n\nRetry after the review-limit window: perform a fresh substantive full review of exact head fc2cf5d, including both issue-owned files and the permanent RED-to-GREEN adversarial tests. A stale, skipped, or rate-limited result is not approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

@adamgell I will perform a fresh substantive full review of PR #392 at exact head fc2cf5da9e5903314e432fbf73d7ec7d0fb28ddc.

I will review both issue-owned files and the permanent RED-to-GREEN adversarial tests. I will not treat a stale, skipped, or rate-limited result as approval.

✅ 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

🧹 Nitpick comments (4)
crates/cmtraceopen-parser/src/sccm/client/health.rs (1)

567-589: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the duplicated phase and source-group mapping.

Lines 567-589 and Lines 631-654 contain the same family-to-phase match and the same phase-to-group match. A new family or phase must be added in two places. Extract two helpers, for example phase_for_display_name(display_name: &str) -> SccmHealthPhase and source_group_for_phase(phase: SccmHealthPhase) -> &'static str, and call them from both functions.

🤖 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/src/sccm/client/health.rs` around lines 567 - 589,
The duplicated artifact-family-to-phase and phase-to-source-group mappings
should be centralized. Add helpers such as phase_for_display_name and
source_group_for_phase, move the existing match logic into them, and update both
affected functions—including the duplicate-id phase flow—to call these helpers
so future mappings are maintained in one place.
crates/cmtraceopen-parser/tests/sccm_client_health.rs (3)

649-658: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

The loop assigns one evidence_id to every matching record.

Lines 649-653 set the same evidence_id and the same entry_id on each evidence record whose reference.artifact_id equals original_identity_id. The test passes because the identity artifact currently contributes exactly one record.

If the identity-failure fixture later adds a second record to that artifact, the loop creates duplicate evidence identities. analyze_client_health then returns health-evidence-identity-collision with last_successful_phase == None, and the guard at line 655 fails with a message about terminal admission rather than about the duplicate identity. Assert the count first, or derive a unique suffix per record.

♻️ Proposed change
+    let identity_record_count = bundle
+        .evidence
+        .iter()
+        .filter(|evidence| evidence.reference.artifact_id == original_identity_id)
+        .count();
+    assert_eq!(
+        identity_record_count, 1,
+        "this rotation test assumes a single identity evidence record"
+    );
     for evidence in &mut bundle.evidence {
🤖 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/sccm_client_health.rs` around lines 649 -
658, Update the evidence-rewriting loop in the identity-failure fixture to
ensure every matching record receives a unique evidence_id and entry_id, or
assert that exactly one record matches before assigning the canonical values.
Preserve the existing canonical rotation-failure assertion while making
duplicate identity failures surface explicitly.

1083-1089: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Two tests select the fixture artifact by vector index. Both tests mutate bundle.artifacts[0] from the setup-failure fixture. load_bundle sorts artifacts by artifact_id, so index 0 is deterministic only while the fixture keeps its current artifact set. The shared root cause is index-based selection instead of selection by display_name, which the rest of this file already uses with eq_ignore_ascii_case.

  • crates/cmtraceopen-parser/tests/sccm_client_health.rs#L1083-L1089: select the ccmsetup.log artifact by display_name, then re-point the evidence whose reference.artifact_id matches that artifact. Index drift here makes the leak assertions at lines 1101-1105 pass without citing the unsafe provenance.
  • crates/cmtraceopen-parser/tests/sccm_client_health.rs#L1151-L1229: select the ccmsetup.log artifact by display_name before rotating it to ccmsetup.lo_. Index drift here produces a confusing phase-assertion failure instead of a clear fixture error.
🤖 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/sccm_client_health.rs` around lines 1083 -
1089, Replace index-based artifact selection in both affected test sites
(crates/cmtraceopen-parser/tests/sccm_client_health.rs lines 1083-1089 and
1151-1229) with lookup by display_name using the file’s existing
eq_ignore_ascii_case pattern. In the first site, re-point the matching evidence
reference to the selected ccmsetup.log artifact; in the second, select that
artifact before rotating it to ccmsetup.lo_.

169-189: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make an unmapped logical ID fail the test instead of projecting null.

source_group_for_request returns None for any logical ID that is not in the match arms. Line 189 then projects nextArtifactLogicalId as Value::Null. An expected finding that declares no nextArtifacts also projects null at line 163. If the analyzer introduces a new logical artifact ID, or renames an existing one, the projection collapses to null and the comparison can still pass.

Panic on an unmapped ID so the mapping table stays in sync with request_for_phase.

♻️ Proposed change
-fn source_group_for_request(logical_id: &str) -> Option<&'static str> {
+fn source_group_for_request(logical_id: &str) -> &'static str {
     match logical_id {
-        "ccmSetup" => Some("client-ccmsetup"),
-        "ccmEval" | "ccmExec" | "ccmRestart" => Some("client-evaluation"),
-        "clientIdManagerStartup" => Some("client-identity"),
-        "clientLocation" | "locationServices" | "ccmMessaging" => Some("client-location"),
-        _ => None,
+        "ccmSetup" => "client-ccmsetup",
+        "ccmEval" | "ccmExec" | "ccmRestart" => "client-evaluation",
+        "clientIdManagerStartup" => "client-identity",
+        "clientLocation" | "locationServices" | "ccmMessaging" => "client-location",
+        other => panic!("unmapped health request logical ID {other}"),
     }
 }
             let next_group = finding["nextArtifacts"]
                 .as_array()
                 .and_then(|requests| requests.first())
                 .and_then(|request| request["logicalId"].as_str())
-                .and_then(source_group_for_request);
+                .map(source_group_for_request);
🤖 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/sccm_client_health.rs` around lines 169 -
189, Update actual_finding_projection and source_group_for_request so an
existing nextArtifacts entry with an unmapped logicalId fails the test
immediately instead of producing Value::Null; preserve null only when no next
artifact is declared. Keep the mapping synchronized with request_for_phase by
panicking or otherwise asserting on unknown IDs.
🤖 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/src/sccm/client/health.rs`:
- Around line 556-566: Scope collision checks to client-role data: in
crates/cmtraceopen-parser/src/sccm/client/health.rs lines 556-566, filter
bundle.artifacts by artifact.role == SccmRole::Client before sorting and
duplicate_id detection; in lines 597-626, apply evidence.role ==
SccmRole::Client in both the counting loop and collision_artifact_ids iterator.
Use the existing client analysis flow unchanged for all other processing.

---

Nitpick comments:
In `@crates/cmtraceopen-parser/src/sccm/client/health.rs`:
- Around line 567-589: The duplicated artifact-family-to-phase and
phase-to-source-group mappings should be centralized. Add helpers such as
phase_for_display_name and source_group_for_phase, move the existing match logic
into them, and update both affected functions—including the duplicate-id phase
flow—to call these helpers so future mappings are maintained in one place.

In `@crates/cmtraceopen-parser/tests/sccm_client_health.rs`:
- Around line 649-658: Update the evidence-rewriting loop in the
identity-failure fixture to ensure every matching record receives a unique
evidence_id and entry_id, or assert that exactly one record matches before
assigning the canonical values. Preserve the existing canonical rotation-failure
assertion while making duplicate identity failures surface explicitly.
- Around line 1083-1089: Replace index-based artifact selection in both affected
test sites (crates/cmtraceopen-parser/tests/sccm_client_health.rs lines
1083-1089 and 1151-1229) with lookup by display_name using the file’s existing
eq_ignore_ascii_case pattern. In the first site, re-point the matching evidence
reference to the selected ccmsetup.log artifact; in the second, select that
artifact before rotating it to ccmsetup.lo_.
- Around line 169-189: Update actual_finding_projection and
source_group_for_request so an existing nextArtifacts entry with an unmapped
logicalId fails the test immediately instead of producing Value::Null; preserve
null only when no next artifact is declared. Keep the mapping synchronized with
request_for_phase by panicking or otherwise asserting on unknown IDs.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d0fe7126-1f6c-4896-b2b2-29c91de2e858

📥 Commits

Reviewing files that changed from the base of the PR and between 1e5a317 and fc2cf5d.

📒 Files selected for processing (5)
  • crates/cmtraceopen-parser/src/sccm/client/health.rs
  • crates/cmtraceopen-parser/src/sccm/client/mod.rs
  • crates/cmtraceopen-parser/tests/fixtures/sccm/client/health/malformed/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/client/health/no-site-or-mp/expected.json
  • crates/cmtraceopen-parser/tests/sccm_client_health.rs

@adamgell

Copy link
Copy Markdown
Owner Author

Substantive CodeRabbit exact-head review 4829080212 requested changes at fc2cf5da9e5903314e432fbf73d7ec7d0fb28ddc.

The P1 client-role collision-scope finding is accepted. A server-role artifact/evidence identity must not alter client-health output. I have claimed the correction in fresh isolated worktree /Users/Adam.Gell/repo/cmtraceopen/.worktrees/sccm-320-fc2-collision-r4, branch codex/sccm-320-fc2-collision-r4, exact base fc2cf5da.

I will first preserve a focused RED cross-role collision regression, then implement the smallest client-role filter. The four test/maintainability nits will be resolved in the same issue-scoped slice without changing behavior. PR remains draft/open.

adamgell added 12 commits August 1, 2026 09:17
A ManagementPoint artifact reusing the client ccmsetup
artifact id must not select an admission authority by
vector order: forward and reversed analyses must both
equal the client-only success baseline.

Refs #320
Filter the health admission artifact map to
SccmRole::Client so an out-of-scope artifact reusing a
client artifact id can no longer shadow client evidence
or be selected as an authority by vector order.

Refs #320
The #321 restructure moved SccmNormalizedBundle out of sccm/client/mod.rs
into sccm/ingest.rs, re-exported through sccm/mod.rs. The rebase applied
cleanly but health.rs still imported it from its parent module, so the
crate failed to build with an unresolved import plus six cascading
String comparison errors in analyze_client_health.

Point the import at crate::sccm, matching the sibling policy reducer.
The public path is unchanged, so this resolves to the same type and no
health analysis behavior changes.

Refs #320
@adamgell
adamgell force-pushed the codex/sccm-320-health-analysis branch from 080a376 to 4b56322 Compare August 1, 2026 13:22
@adamgell
adamgell requested a review from Copilot August 1, 2026 13:27

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 SCCM client health reducer to cmtraceopen-parser, alongside a large frozen-contract test suite and fixture expectation updates, to analyze evidence across setup → service → identity → site assignment → management point → transport.

Changes:

  • Introduces analyze_client_health and associated public analysis/output types under crates/cmtraceopen-parser/src/sccm/client/health.rs.
  • Adds an extensive fixture-driven regression test suite (sccm_client_health.rs) covering determinism, fail-closed behavior, adversarial inputs, and evidence-citation rules.
  • Updates fixture expectations for coverage gaps and classification in select scenarios.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/cmtraceopen-parser/tests/sccm_client_health.rs Adds frozen-contract + adversarial tests for the new SCCM client-health reducer and its public JSON shape.
crates/cmtraceopen-parser/tests/fixtures/sccm/client/health/no-site-or-mp/expected.json Updates expected coverage-gap artifact IDs for the site-assignment insufficient-evidence finding.
crates/cmtraceopen-parser/tests/fixtures/sccm/client/health/malformed/expected.json Updates expected class for the malformed service finding to insufficientEvidence.
crates/cmtraceopen-parser/src/sccm/client/mod.rs Registers and re-exports the new health module.
crates/cmtraceopen-parser/src/sccm/client/health.rs Implements analyze_client_health, evidence admission, phase chaining, contradiction handling, and redaction-safe output shaping.

compare_fact_order compared only line_start inside one artifact, so two
distinct records claiming the same span were treated as simultaneous.
latest_comparable_fact then picked one arbitrarily and the reducer
admitted a full transport success off unorderable evidence.

Order source-local records by disjoint line spans, reserve Equal for the
same record, and leave shared or overlapping spans incomparable so every
ordered claim fails closed.

Refs #320

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (2)

crates/cmtraceopen-parser/src/sccm/client/health.rs:701

  • resolve_setup returns successes[0] as the authoritative setup success when multiple success records exist for the same (bootstrapId, clientGuid). Because facts are sorted source-locally, this can select an earlier success that predates a later terminal failure/recovery sequence, which can incorrectly allow downstream phases to be admitted based on an outdated setup outcome. Prefer selecting the latest comparable success fact for the unique key.
        if unique_successes.len() == 1 {
            return SetupResolution::Succeeded {
                fact: successes[0].0,
                client_guid: successes[0].2,
            };

crates/cmtraceopen-parser/src/sccm/client/health.rs:420

  • When SiteAssigned evidence is missing, the finding always reports a client-location coverage gap with Partial coverage. If location artifacts are actually absent (or only present with non-Captured coverage like AccessDenied), this misstates the coverage state and can hide the real capture gap. Derive the coverage gap from the actual location artifacts, using Partial only when at least one captured location artifact exists.
            vec![SccmFindingCoverageGap {
                artifact_id: CLIENT_LOCATION_GROUP.to_owned(),
                role: SccmRole::Client,
                coverage: SccmCoverageState::Partial,
            }],

adamgell added a commit that referenced this pull request Aug 1, 2026
)

The CI workflow triggers only on `main`, but the entire SCCM program stacks
on `codex/parser-family-skeleton`. Seven open pull requests (#391, #392,
#394, #404, #405, #407, #420) therefore run none of the six jobs -- no
cargo check/test, no clippy, no MSRV check, no tsc, no Playwright E2E, and
no platform builds -- while still reporting as mergeable.

GitHub gives no signal for this: a pull request whose base branch is absent
from the trigger list is not "pending" or "skipped", it simply has no
checks, which is easy to misread as a passing PR with light gating.

Add the integration branch to both triggers so lane PRs are gated before
they land on it, and so the branch itself is checked after each merge.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

adamgell commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

🔴 Independent exact-head NO-GO for #320 / PR #392

Reviewed PR head 0fceedc928b2f182fd5d59803738b343df7c3524 in a detached clean worktree. Green compilation is not acceptance.

Blockers:

  1. It cannot consume current SCCM Client: add deterministic intake, coverage, and corpus foundation #319: it imports missing SccmNormalizedBundle, uses removed SccmCoverageState::Partial, and merge-tree has an add/add client/mod.rs conflict.
  2. PR feat(sccm): analyze client health and location evidence #392 targets SCCM Client: diagnose policy retrieval, evaluation, and reporting #321 and would drag policy code into SCCM Client: diagnose setup, health, identity, assignment, and location #320, violating issue-scoped integration.
  3. Its loader bypasses SCCM Client: add deterministic intake, coverage, and corpus foundation #319 intake and ignores capture host, path fingerprint, fragment completeness, memberships, and collection limits. All nine expected fixtures remain proposedPending318And319.
  4. Adversarial probes fail conservatively required behavior: a unique access-denied CcmMessaging.log sibling disappears; a high transport terminal exports no correlation keys; different artifact hosts still form success and ConfirmedFailure/High.
  5. Upgrade/repair/removal/reboot/client-health/authentication/boundary phases remain absent.

Fixture corpus audited: success, setup-failure, identity-failure, no-site-or-mp, transport-failure, rotation-boundary, incomplete, malformed, contradictory.

Fresh gates: health 21/21, #319 fixture 3/3, spine 136/136, full parser 784, strict Clippy, Rust 1.88 wasm32, scoped format/JSON/diff all green. Local CodeRabbit found 0, but hosted CodeRabbit was skipped because the PR is draft and no hosted CI reviewed this head.

Required repair order: establish a reviewed normalized #319 input contract; port #320 alone onto it; bind fixtures through public intake; add RED tests for the three reproduced failures and missing phases; then fresh independent/CodeRabbit/Copilot/CI review. Do not merge PR #392.

@adamgell
adamgell force-pushed the codex/sccm-321-policy-analysis branch from 1bdcd9c to 486e982 Compare August 2, 2026 20:35
@adamgell
adamgell marked this pull request as ready for review August 3, 2026 05:47
@adamgell

adamgell commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

Superseded on main. The current health analyzer consumes sealed admitted evidence, carries 11 scenarios (versus 9 here), and includes equal-time/lifecycle regression oracles; latest lane correction 320267e. This stacked head was promoted and hardened through PR #490, so it is not an independent merge candidate.

@adamgell adamgell closed this Aug 5, 2026
@adamgell
adamgell deleted the codex/sccm-320-health-analysis branch September 25, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature New feature parser Log parser related sccm SCCM/ConfigMgr related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants