Skip to content

fix(sccm): harden server intake boundaries - #434

Merged
adamgell merged 12 commits into
codex/parser-family-skeletonfrom
codex/sccm-335-safety-repair-root
Aug 2, 2026
Merged

adamgell merged 12 commits into
codex/parser-family-skeletonfrom
codex/sccm-335-safety-repair-root

Conversation

@adamgell

@adamgell adamgell commented Aug 2, 2026 •

Copy link
Copy Markdown
Owner

What changed

This follow-up hardens the pure SCCM Server intake contract already integrated for issue #335.

  • bounds manifest, artifact, payload, and opaque-extension intake
  • validates and retains only versioned opaque forward-compatible fields
  • preserves future server-role coverage without letting unknown roles enter parsing, evidence, findings, or artifact requests
  • binds role, topology, source, path, rotation, payload, and collision provenance
  • routes malformed known metadata to the correct manifest error boundary
  • keeps production path and identity provenance opaque
  • adds adversarial fixtures for malformed fields, duplicate identities, future roles, payload limits, rotation, topology, and deterministic output

Why

Independent review of the earlier server-intake slice found that forward-compatible fields were either rejected too broadly or could carry unsafe semantics, metadata errors were mis-scoped, and future roles could not preserve real coverage states. This correction keeps the reader tolerant only through a narrow, versioned, privacy-safe opaque form while remaining evidence-first and conservative.

Validation

  • cargo test --locked -p cmtraceopen-parser --test sccm_server_intake — 56 passed
  • cargo test --locked -p cmtraceopen-parser --test sccm_spine_contract — 161 passed
  • cargo test --locked -p cmtraceopen-parser — passed
  • cargo clippy --locked -p cmtraceopen-parser --all-targets -- -D warnings — passed
  • Rust 1.88.0 cargo check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown — passed
  • changed-file rustfmt --check — passed
  • git diff --check d1bb525b4462b4ea5e2f1426be23568ca469cc3f..ceb487e60d9b9d1de635c9eef5d83a054ffa3e2d — passed
  • independent full-range no-edit review — GO
  • CodeRabbit exact final delta — no findings

Repository-wide cargo fmt --check --all still reports pre-existing unrelated ESP/Tauri formatting drift identically at the base commit; this range does not change those files.

No native server collection or live Windows acceptance is claimed here.

Refs #335 and #317.

Summary by CodeRabbit

  • New Features

    • Added support for safely preserving opaque extension data across SCCM server intake records.
    • Added SHA-256 checksums and relative paths to artifact provenance details.
    • Added support for multiple text encodings, unknown identifiers, and future artifact roles.
    • Added deterministic ordering and access to extension and privacy-related metadata.
  • Bug Fixes

    • Improved validation for malformed metadata, duplicate fields, unsafe paths, and inconsistent artifact configuration.
    • Added safeguards against oversized manifests, artifacts, payloads, and extension data.

Copilot AI review requested due to automatic review settings August 2, 2026 06:07
@coderabbitai

coderabbitai Bot commented Aug 2, 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: b01b2194-ecff-4594-9987-630573f05fca

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

The SCCM server intake parser now supports bounded opaque extensions, future roles, validated provenance, payload hashing, multiple text encodings, duplicate-field detection, metadata limits, and expanded scenario coverage.

Changes

SCCM server intake

Layer / File(s) Summary
Extension contracts and manifest preflight
crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs
Adds public opaque-extension types, assessment accessors, custom serialization, duplicate-field detection, safe-name validation, canonical ordering, and per-scope and aggregate limits.
Bounded artifact normalization
crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs
Validates manifest metadata, artifact identity, paths, roles, rotations, workflow fields, source provenance, and request-generation inputs.
Payload decoding and evidence metadata
crates/cmtraceopen-parser/Cargo.toml, crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs
Moves sha2 to regular dependencies. Adds payload SHA-256 hashes and UTF-8, UTF-16LE, Windows-1252, and unknown-encoding handling.
Intake scenario and contract validation
crates/cmtraceopen-parser/tests/sccm_server_intake.rs, crates/cmtraceopen-parser/tests/fixtures/sccm/server/intake/*/expected.json
Adds coverage for extensions, future roles, limits, encodings, provenance, deterministic ordering, path validation, request behavior, and expected scenario outputs.

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

Sequence Diagram(s)

sequenceDiagram
  participant Manifest
  participant IntakePreflight
  participant ArtifactNormalizer
  participant PayloadDecoder
  Manifest->>IntakePreflight: manifest bytes and metadata
  IntakePreflight->>ArtifactNormalizer: validated declarations and extensions
  ArtifactNormalizer->>PayloadDecoder: payload bytes and encoding
  PayloadDecoder->>ArtifactNormalizer: decoded evidence and SHA-256 metadata
Loading

Possibly related PRs

Suggested labels: test

Suggested reviewers: copilot

🚥 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 and concisely describes the main change: hardening SCCM server intake boundaries.
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.

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request parser Log parser related sccm SCCM/ConfigMgr related labels Aug 2, 2026
@adamgell

adamgell commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

Exact reviewed head: ceb487e60d9b9d1de635c9eef5d83a054ffa3e2d against base d1bb525b4462b4ea5e2f1426be23568ca469cc3f.

Please review the complete seven-commit range, especially opaque extension admission, future-role coverage remaining inert across every state, manifest/topology/artifact error scope, path privacy, payload/limit coherence, and deterministic collision/rotation handling. A fresh independent executable review is GO; no merge will occur until hosted review is complete at this exact head.

@coderabbitai review

@github-copilot review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

@adamgell: I will review the complete seven-commit range at the specified head. I will focus on the listed SCCM Server intake boundaries and deterministic behavior.

✅ 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 added the test Testing related label Aug 2, 2026

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

This PR hardens the SCCM Server intake contract in cmtraceopen-parser by tightening resource boundaries, validating privacy-safe forward-compatible fields (opaque extensions / future roles), and expanding adversarial fixture coverage to ensure deterministic, conservative behavior under malformed or hostile manifests/payloads.

Changes:

  • Added manifest/payload bounding and stricter metadata validation, including opaque v1 extension retention and “opaque future role” handling in server intake.
  • Expanded server intake tests/fixtures to cover duplicate fields, malformed metadata scoping, encoding behaviors, collision safety, and deterministic output under reordering.
  • Promoted sha2 to a non-dev dependency to support payload hashing in production intake.

Reviewed changes

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

Show a summary per file
File Description
crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs Adds bounded intake limits, opaque extension preflight/normalization, future-role tolerance rules, payload decoding, and payload SHA-256 provenance.
crates/cmtraceopen-parser/tests/sccm_server_intake.rs Adds extensive adversarial/intake-contract tests and deterministic assertions across scenarios.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/intake/unsorted-manifest/expected.json Updates expected contract to assert deterministic evidence IDs.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/intake/collision-same-basename-configured-roots/expected.json Tightens collision expectations and asserts relativePath + sha256 provenance.
crates/cmtraceopen-parser/Cargo.toml Moves sha2 into runtime dependencies for production intake hashing.

@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 (9)
crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs (6)

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

Rename synthetic_unclassified; it is not gated on synthetic_fixture.

synthetic_unclassified only tests producer_role == SccmRole::Unknown("unclassified"). It does not read synthetic_fixture. The test server_intake_accepts_only_opaque_future_unsupported_provenance builds a production manifest through bounded_manifest and relies on this flag, so the production path is intentional.

The current name states the opposite. It also feeds the topology-observation bypass at Line 816, where the reader must know that production manifests reach that branch.

♻️ Proposed rename
-    let synthetic_unclassified =
-        artifact.producer_role == SccmRole::Unknown("unclassified".to_owned());
+    // The literal `unclassified` role is accepted in both synthetic and production manifests.
+    let unclassified_role =
+        artifact.producer_role == SccmRole::Unknown("unclassified".to_owned());
     let opaque_future_role = !synthetic_fixture && is_opaque_future_role(&artifact.producer_role);
-    let retained_unknown = opaque_future_role
-        || (synthetic_unclassified && artifact.capture_state == SccmCoverageState::Unsupported);
+    let retained_unknown = opaque_future_role
+        || (unclassified_role && artifact.capture_state == SccmCoverageState::Unsupported);

Update the two remaining uses at Lines 816 accordingly.

🤖 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/server/windows/intake.rs` around lines 777
- 781, Rename synthetic_unclassified to reflect that it detects the unclassified
producer role regardless of synthetic_fixture, and update both remaining
references in the topology-observation bypass around the associated intake
logic. Preserve the existing condition and behavior for production manifests and
synthetic fixtures.

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

Report a version mismatch with a distinct error.

validate returns InvalidName when schema_version != 1. The name can be fully valid in that case. The public SccmServerOpaqueExtensionError then misreports the cause to callers, and the deserialization error text is misleading.

Add a dedicated variant, or at minimum split the condition.

♻️ Proposed refactor
 pub enum SccmServerOpaqueExtensionError {
     #[error("opaque extension name is invalid or unsafe")]
     InvalidName,
     #[error("opaque extension value is invalid or unsafe")]
     InvalidValue,
+    #[error("opaque extension schema version is unsupported")]
+    UnsupportedSchemaVersion,
 }
     fn validate(&self) -> Result<(), SccmServerOpaqueExtensionError> {
-        if self.schema_version != 1 || !safe_opaque_extension_name(&self.name) {
+        if self.schema_version != 1 {
+            return Err(SccmServerOpaqueExtensionError::UnsupportedSchemaVersion);
+        }
+        if !safe_opaque_extension_name(&self.name) {
             return Err(SccmServerOpaqueExtensionError::InvalidName);
         }

Note: opaque_extension_public_construction_and_serde_are_validated only asserts is_err() for the schemaVersion: 2 case, so this change does not break the test.

🤖 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/server/windows/intake.rs` around lines 117
- 125, Update SccmServerOpaqueExtensionError and validate so schema_version != 1
produces a distinct version-mismatch error instead of InvalidName; keep
safe_opaque_extension_name validation mapped to InvalidName and preserve the
existing value validation behavior.

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

The synthetic branch in safe_source_id is unreachable.

"unknown-db-supplement" already appears in the unconditional matches! list at Line 1567. When synthetic_fixture is true and the value is "unknown-db-supplement", the first clause returns true and the allow_unknown branch never runs. The branch cannot change any result.

The redundancy suggests that synthetic retained-unknown sources are restricted to that one literal. They are not; the literal is accepted for every artifact in every manifest. Remove the dead arm so the real contract is visible.

♻️ Proposed simplification
             | "unknown-db-supplement"
-    ) || (allow_unknown
-        && if synthetic_fixture {
-            value == "unknown-db-supplement"
-        } else {
-            opaque_sha256_handle(value, "cmtraceopen.source.sha256.v1:")
-        })
+    ) || (allow_unknown
+        && !synthetic_fixture
+        && opaque_sha256_handle(value, "cmtraceopen.source.sha256.v1:"))
 }

This mirrors the shape already used by safe_source_kind at Lines 1580-1582. Confirm that server_intake_retains_unsupported_source_provenance and server_intake_rejects_unversioned_future_unsupported_source_labels still pass, since both drive this function.

🤖 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/server/windows/intake.rs` around lines
1557 - 1574, Remove the synthetic_fixture conditional from safe_source_id
because its only accepted value is already handled by the unconditional matches!
list, making that branch unreachable. Keep allow_unknown behavior for
non-synthetic values using opaque_sha256_handle, and verify the existing
provenance and future-label tests still pass.

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

Pin MAX_SCCM_SERVER_TOTAL_OPAQUE_EXTENSIONS with an assertion.

EXPECTED_MAX_TOTAL_OPAQUE_EXTENSIONS duplicates the private constant so the test can detect a change to the bound. The duplicate never drives an equality check, so it cannot detect anything.

The loop at Line 2399 divides by MAX_SCCM_SERVER_OPAQUE_EXTENSIONS and produces 33 artifacts of 32 extensions each, which is 1056. If someone lowers MAX_SCCM_SERVER_TOTAL_OPAQUE_EXTENSIONS to 512, the total still exceeds the bound and the test still passes. The oracle is silent about the regression it exists to catch.

Add the missing assertion.

💚 Proposed fix
     const EXPECTED_MAX_TOTAL_OPAQUE_EXTENSIONS: usize = 1_024;
+
+    #[test]
+    fn total_opaque_extension_bound_is_pinned() {
+        assert_eq!(
+            MAX_SCCM_SERVER_TOTAL_OPAQUE_EXTENSIONS,
+            EXPECTED_MAX_TOTAL_OPAQUE_EXTENSIONS,
+            "changing the aggregate extension bound is a public intake contract change"
+        );
+    }

Also applies to: 2399-2403

🤖 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/server/windows/intake.rs` at line 2242,
Update the test using EXPECTED_MAX_TOTAL_OPAQUE_EXTENSIONS to assert equality
with MAX_SCCM_SERVER_TOTAL_OPAQUE_EXTENSIONS, ensuring the duplicated expected
value detects changes to the private bound. In the artifact-generation loop
around MAX_SCCM_SERVER_OPAQUE_EXTENSIONS, retain the existing coverage while
adding this assertion before relying on the configured limit.

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

Remove the unreachable had_errors branch for windows-1252.

encoding_rs::WINDOWS_1252.decode maps every byte value and always returns had_errors == false. Remove the branch or document this guarantee.

🤖 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/server/windows/intake.rs` around lines
1142 - 1149, Update the "windows-1252" arm in the encoding dispatch to remove
the unreachable had_errors check, and return the decoded owned content directly
from encoding_rs::WINDOWS_1252.decode while preserving the existing
Ok(Some(...)) result.

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

Use one convention for optional raw fields.

Missing Option<T> fields already deserialize as None; #[serde(flatten)] on extensions does not change this. Remove the redundant annotations or apply them consistently across these raw structs.

🤖 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/server/windows/intake.rs` around lines
2164 - 2196, Remove the redundant #[serde(default)] annotations from optional
fields in RawServerArtifact, or apply the same convention consistently to
optional raw fields across the related raw structs. Since Option<T> already
defaults to None when absent, preserve deserialization behavior while
eliminating the inconsistent annotations.
crates/cmtraceopen-parser/tests/sccm_server_intake.rs (3)

49-97: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the duplicated scope-to-needle mapping.

manifest_with_duplicate_extension and manifest_with_duplicate_known_field contain the same eight-arm match scope block verbatim at Lines 56-66 and Lines 81-91. A new scope must be added in both places, and a mismatch between them produces a confusing assert_ne! failure rather than a clear error.

Extract one helper and call it from both.

♻️ Proposed refactor
+fn scope_needle(scope: &str) -> &'static str {
+    match scope {
+        "manifest" => "{",
+        "privacy" => "\"privacy\":{",
+        "topology" => "\"topology\":{",
+        "artifact" => "\"artifacts\":[{",
+        "workflowSubject" => "\"workflowSubject\":{",
+        "configuredPathProvenance" => "\"configuredPathProvenance\":{",
+        "rotation" => "\"rotation\":{",
+        "collectionLimit" => "\"collectionLimit\":{",
+        _ => panic!("unknown extension scope: {scope}"),
+    }
+}
+
 fn manifest_with_duplicate_extension(
     manifest_json: &str,
     scope: &str,
     extension_name: &str,
     first_value: &str,
     second_value: &str,
 ) -> String {
-    let needle = match scope {
-        "manifest" => "{",
-        ...
-    };
+    let needle = scope_needle(scope);

Apply the same substitution in manifest_with_duplicate_known_field.

One note on the helpers themselves: for scope == "manifest" the needle is "{", so assert_ne! can never fail. That assertion protects the seven nested scopes only.

🤖 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_server_intake.rs` around lines 49 - 97,
Extract the duplicated scope-to-needle match into a shared helper, then update
both manifest_with_duplicate_extension and manifest_with_duplicate_known_field
to obtain their needle through it. Preserve all existing scope mappings and the
current nested-scope assertion behavior, while keeping the manifest scope’s “{”
handling unchanged.

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

Find the root- segment by prefix instead of by index.

distinctOpaqueRootSegments reads split('/').nth(5) and then filters on the root- prefix. Index 5 is correct only when the relative path has no workflow-subject segment. validate_relative_path inserts subject-<role> and an optional instance-<handle> segment before the configured-root segment, so a subject-bearing artifact shifts the root to index 6 or 7.

Today only the collision fixture uses this key and it has no workflow subject, so the assertion passes. If a later collision fixture adds a subject, .expect("opaque configured-root segment") panics and the message points at a missing root segment rather than at the index assumption.

♻️ Proposed fix
                 let root_segments = artifacts
                     .iter()
                     .map(|artifact| {
                         artifact["relativePath"]
                             .as_str()
                             .expect("relative path")
                             .split('/')
-                            .nth(5)
-                            .filter(|segment| segment.starts_with("root-"))
+                            .find(|segment| segment.starts_with("root-"))
                             .expect("opaque configured-root segment")
                     })
                     .collect::<BTreeSet<_>>();
🤖 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_server_intake.rs` around lines 377 -
392, Update the distinctOpaqueRootSegments assertion in the sccm_server_intake
test to locate the configured-root segment by finding the path component
prefixed with “root-” rather than using split('/').nth(5). Preserve the existing
expectation and distinct-count assertion while allowing subject- and
instance-bearing paths.

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

The synthetic branch assumes the fixture does not already use LAB-MP01.

To prove cross-bundle ID reuse, the branch changes captureHost and then asserts assert_ne!(repeated["topology"], actual["topology"]). For a synthetic fixture it substitutes the literal "LAB-MP01".

normalize_topology accepts only "LAB-CM01" and "LAB-MP01" for synthetic fixtures, so there is exactly one alternative. If the fixture that carries crossBundleArtifactIdReuseAllowed is ever changed to use LAB-MP01, the substitution becomes a no-op, the topologies match, and assert_ne! fails with a message about topology equality rather than about the fixture change.

Select the other permitted host explicitly.

♻️ Proposed fix
                 second_manifest["topology"]["captureHost"] =
                     if second_manifest["syntheticFixture"] == true {
-                        Value::String("LAB-MP01".to_owned())
+                        // Synthetic topology is a closed two-value vocabulary.
+                        if manifest["topology"]["captureHost"] == "LAB-CM01" {
+                            Value::String("LAB-MP01".to_owned())
+                        } else {
+                            Value::String("LAB-CM01".to_owned())
+                        }
                     } else {
                         Value::String(opaque_handle("cmtraceopen.host.sha256.v1:", 999))
                     };
🤖 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_server_intake.rs` around lines 589 -
616, Update the synthetic branch in the crossBundleArtifactIdReuseAllowed test
to choose the permitted host opposite to the fixture’s current captureHost,
using LAB-CM01 when it is LAB-MP01 and LAB-MP01 otherwise. Keep the
opaque-handle behavior for non-synthetic fixtures and preserve the topology
inequality assertion.
🤖 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/server/windows/intake.rs`:
- Around line 1976-2066: Update the preflight validation around
validate_preserved_extensions to derive each known-field list from the
corresponding Serde struct declarations, using shared declarations or a macro
rather than maintaining separate literal lists. Apply this to the manifest,
privacy, topology, artifact, and nested artifact fields so adding a struct field
automatically updates validation and remains accepted as a known field.

In `@crates/cmtraceopen-parser/tests/sccm_server_intake.rs`:
- Around line 1587-1596: Update the reordering test around manifest_value and
serialize_manifest so the reordered manifest is constructed as raw JSON text,
matching the approach used by the duplicate-extension helper. Ensure extension
fields are emitted in a genuinely different arrival order before passing the
text to assess_server_intake, while preserving the existing normalized-output
assertion.

---

Nitpick comments:
In `@crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs`:
- Around line 777-781: Rename synthetic_unclassified to reflect that it detects
the unclassified producer role regardless of synthetic_fixture, and update both
remaining references in the topology-observation bypass around the associated
intake logic. Preserve the existing condition and behavior for production
manifests and synthetic fixtures.
- Around line 117-125: Update SccmServerOpaqueExtensionError and validate so
schema_version != 1 produces a distinct version-mismatch error instead of
InvalidName; keep safe_opaque_extension_name validation mapped to InvalidName
and preserve the existing value validation behavior.
- Around line 1557-1574: Remove the synthetic_fixture conditional from
safe_source_id because its only accepted value is already handled by the
unconditional matches! list, making that branch unreachable. Keep allow_unknown
behavior for non-synthetic values using opaque_sha256_handle, and verify the
existing provenance and future-label tests still pass.
- Line 2242: Update the test using EXPECTED_MAX_TOTAL_OPAQUE_EXTENSIONS to
assert equality with MAX_SCCM_SERVER_TOTAL_OPAQUE_EXTENSIONS, ensuring the
duplicated expected value detects changes to the private bound. In the
artifact-generation loop around MAX_SCCM_SERVER_OPAQUE_EXTENSIONS, retain the
existing coverage while adding this assertion before relying on the configured
limit.
- Around line 1142-1149: Update the "windows-1252" arm in the encoding dispatch
to remove the unreachable had_errors check, and return the decoded owned content
directly from encoding_rs::WINDOWS_1252.decode while preserving the existing
Ok(Some(...)) result.
- Around line 2164-2196: Remove the redundant #[serde(default)] annotations from
optional fields in RawServerArtifact, or apply the same convention consistently
to optional raw fields across the related raw structs. Since Option<T> already
defaults to None when absent, preserve deserialization behavior while
eliminating the inconsistent annotations.

In `@crates/cmtraceopen-parser/tests/sccm_server_intake.rs`:
- Around line 49-97: Extract the duplicated scope-to-needle match into a shared
helper, then update both manifest_with_duplicate_extension and
manifest_with_duplicate_known_field to obtain their needle through it. Preserve
all existing scope mappings and the current nested-scope assertion behavior,
while keeping the manifest scope’s “{” handling unchanged.
- Around line 377-392: Update the distinctOpaqueRootSegments assertion in the
sccm_server_intake test to locate the configured-root segment by finding the
path component prefixed with “root-” rather than using split('/').nth(5).
Preserve the existing expectation and distinct-count assertion while allowing
subject- and instance-bearing paths.
- Around line 589-616: Update the synthetic branch in the
crossBundleArtifactIdReuseAllowed test to choose the permitted host opposite to
the fixture’s current captureHost, using LAB-CM01 when it is LAB-MP01 and
LAB-MP01 otherwise. Keep the opaque-handle behavior for non-synthetic fixtures
and preserve the topology inequality assertion.
🪄 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: dbaf2ca3-92a5-4b0b-9e7a-45cd77d9eca0

📥 Commits

Reviewing files that changed from the base of the PR and between d1bb525 and ceb487e.

📒 Files selected for processing (5)
  • crates/cmtraceopen-parser/Cargo.toml
  • crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/intake/collision-same-basename-configured-roots/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/intake/unsorted-manifest/expected.json
  • crates/cmtraceopen-parser/tests/sccm_server_intake.rs

@adamgell

adamgell commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

Exact review-fix head 976ec2a1d25104d3bfe7e0657091e6bb0d87660b is pushed.

Handled at this head:

  • preflight enforces the 512-artifact limit before any nested artifact work;
  • SHA-256 hex uses one preallocated lowercase encoder;
  • all eight raw Serde wire contracts and preflight known-field lists now come from one macro source;
  • extension-order coverage now uses genuinely reordered raw JSON;
  • opaque schema-version errors, unclassified naming, production-only future source handles, Option defaults, aggregate-bound pinning, helper/root-segment/cross-bundle assertions, and Windows-1252 decoding were corrected;
  • a RED/GREEN regression proves a payload BOM cannot override the manifest-declared Windows-1252 encoding.

Verification at the exact head:

cargo +1.88 test -p cmtraceopen-parser --test sccm_server_intake        # 59 passed
cargo +1.88 test -p cmtraceopen-parser --test sccm_spine_contract      # 161 passed
cargo +1.88 test -p cmtraceopen-parser
cargo clippy --locked -p cmtraceopen-parser --all-targets --all-features -- -D warnings
cargo +1.88 check --locked -p cmtraceopen-parser --all-features --target wasm32-unknown-unknown
rustfmt +1.88 --edition 2021 --check <changed Rust files>
git diff --check ceb487e6..976ec2a1

A fresh independent reviewer returned GO at 976ec2a1. Local CodeRabbit completed the exact correction range with zero findings, and hosted CodeRabbit has approved the exact pushed head. All four prior inline threads were replied to and resolved. A fresh Copilot review has been requested; merge remains held for that exact-head review and refreshed CI. No native/live Windows collection acceptance is claimed.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request parser Log parser related sccm SCCM/ConfigMgr related test Testing related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants