Skip to content

feat(sccm): enforce evidence-backed findings - #353

Merged
adamgell merged 22 commits into
codex/parser-family-skeletonfrom
codex/sccm-318-conservative-findings
Jul 31, 2026
Merged

feat(sccm): enforce evidence-backed findings#353
adamgell merged 22 commits into
codex/parser-family-skeletonfrom
codex/sccm-318-conservative-findings

Conversation

@adamgell

@adamgell adamgell commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Scope

Implements #318 Task 7 from the SCCM diagnostic-spine plan as a pure parser-crate finding builder and validator, on exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

  • Adds public camelCase finding, confidence, phase, terminal-evidence, coverage-gap, and bounded artifact-request contracts.
  • Requires cited observed terminal failure for High ConfirmedFailure today; no extraction profile is registered Stable.
  • Caps LikelyContributor at Moderate without cited terminal failure.
  • Requires InsufficientEvidence to carry a non-Captured coverage gap and a bounded next-artifact request.
  • Selects the requested source by exact catalog logical ID and producer role; free-form reason text cannot broaden that authorization.
  • Evaluates punctuation-separated clauses independently and gives every collection action a non-overlapping local segment.
  • Parses each collection target fail-closed as bounded modifiers + requested exact catalog identity + an optional positively validated suffix.
  • Requires every actionless clause to independently match positive evidence-observation grammar.
  • Allows collection suffixes only when they match positive evidence-observation, cited-reference, bounded-bundle, or bounded-completion grammar.
  • Requires Confirm clauses to match a finite positive confirmation vocabulary, include a confirmation subject or exact catalog identity, reject unbound dotted targets, and retain the existing bounded state-observation exceptions.
  • Constrains passive evidence predicates to evidence-state terms or the requested exact identity.
  • Rejects standalone, suffix, and confirmation unknown imperative/gerund/nominal collection shapes without expanding the finite collection-action verb list.
  • Preserves declared separators such as the five MP_* basenames, accepts every declared catalog basename/logical alias, and rejects prefix/suffix/lookalike identities.
  • Rejects recursive, root, wide/systemwide, drive/environment roots, traversal, rooted paths, globs, unqualified/coordinated-unqualified actions, external containers, and status/identity sanitization attempts.
  • Treats one coverage-gap artifactId as one identity: conflicting role/state is rejected; exact duplicates deterministically deduplicate.
  • Enforces canonical phase/role/terminal-kind/finding/evidence/request identities, raw request cardinality, strict nested wires, cited evidence, conservative confidence, and deterministic normalized output.

No native I/O, Tauri, Windows dependency, collection, reducer, correlation engine, ParserKind, CCM grammar, public LogEntry, workflow fixture, dependency, or live Windows acceptance change is included.

Test-first evidence

Permanent four-boundary regressions cover builder, direct validate(), validating serialization, and deserialization:

  • 49 additional unbounded reasons: 196 accepted boundaries RED → GREEN.
  • Four catalog lookalikes: 16 accepted boundaries RED → GREEN.
  • Five exact MP_* basenames: 20 false rejections RED → GREEN.
  • 15 unqualified collection actions: 60 accepted boundaries RED → GREEN.
  • Three coordinated action suffixes: 12 accepted boundaries RED → GREEN.
  • Two exact unbound-target reproductions plus eight target/order/connector/filename variants: 40 accepted boundaries RED → GREEN.
  • Six exact unrecognized/nominal/inflected collection-language probes: 24 accepted boundaries RED → GREEN.
  • Three evidence-subject passive-target probes: 12 accepted boundaries RED → GREEN.
  • Six standalone unknown-action and inflected-suffix probes: 24 accepted boundaries RED → GREEN.
  • Ten Confirm imperative/gerund/nominal/dotted-target variants from the latest CodeRabbit P1: 40 accepted boundaries RED → GREEN.
  • Four pre-auxiliary passive all-files/full-disk confirmation variants from the independent P1: 16 accepted boundaries RED → GREEN.
  • Two dynamically reproduced trailing-object variants (must have all files provided / must have the full disk provided): 8 accepted boundaries RED → GREEN; the two literal CodeRabbit must include / must provide examples remain permanent already-green rejection controls.
  • Three path-adjacent DOMAIN\\User payloads leaked through both the public evidence message and JSON RED → GREEN; deterministic redaction now preserves only the safe surrounding path fragments.
  • Three unprofiled/unknown/malformed Strong/Exact key variants: 12 accepted boundaries RED → GREEN across builder, direct validation, serialization, and deserialization.
  • Existing bounded confirmation controls for policy/request outcome, download state, retry, assignment, root cause, disk imaging, and exact catalog identities remain GREEN at all four boundaries.
  • Safe same-clause/standalone and strong-punctuation evidence narratives remain GREEN.
  • All 48 declared sources by exact basename and logical alias remain GREEN.
  • The prior 19-unbounded/14-bounded reviewed matrices and all earlier finding contracts remain GREEN.

Verification on exact head a515f33858be599759dd84e02353bc1f92f4a16f

  • cargo +1.88.0 test --locked -p cmtraceopen-parser --test sccm_spine_contract finding_ -- --nocapture71 passed, 0 failed
  • cargo +1.88.0 test --locked -p cmtraceopen-parser726 passed, 0 failed
  • cargo clippy -p cmtraceopen-parser --all-targets -- -D warnings — passed
  • cargo +1.88.0 check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown — passed
  • npx tsc --noEmit — passed
  • Rust 1.88 scoped rustfmt --check on the three changed files — passed
  • git diff --check, git diff --check ca7ee943794f0654c2502606088743ac0b9db7c0..a515f33858be599759dd84e02353bc1f92f4a16f, and git diff --check 25b37333affde22b4ef8a19f4a5f3d89c082b599..a515f33858be599759dd84e02353bc1f92f4a16f — passed

Known unrelated baseline: repository-wide cargo fmt --all -- --check remains red only in the same 17 unrelated files, which this issue-owned slice does not modify. The repository-prescribed strict current-toolchain Clippy command above passes.

Review gate

Independent review of d6d5c697a4fa756078366bebe34b14519f5a0c5e reproduced three P1 shared-contract failures: passive broad confirmation wording, path-adjacent Windows identity leakage, and unvalidated/malformed Strong/Exact finding keys: #353 (review).

Commit ca7ee943794f0654c2502606088743ac0b9db7c0 closes all three with permanent public-boundary regressions while preserving bounded confirmation, safe path fragments, Low-confidence unprofiled/unknown keys, parser purity, and wasm32 compatibility.

CodeRabbit's substantive review of that exact head accepted the key/redaction corrections and found a remaining confirmation-order P1: #353 (comment). Its two literal examples were already rejected; a dynamic equivalent using allowed tokens reproduced the actual root at all four boundaries. Commit a515f33858be599759dd84e02353bc1f92f4a16f now searches the whole confirmation body for an unbound broad target and closes the reproduced 8/8 trailing-object accepts without expanding the finite action vocabulary.

Hosted CodeRabbit completed a substantive review of exact range 25b37333affde22b4ef8a19f4a5f3d89c082b599..a515f33858be599759dd84e02353bc1f92f4a16f with no blocking findings: #353 (comment). A different independent exact-head API/security review is still required before this PR may leave draft. A green status or approval attached to an older SHA is not sufficient. Historical blocker comments remain unresolved as review history.

Do not mark ready, merge, close #318, authorize downstream production reducers/correlation, or claim live Windows acceptance from this PR.

Refs #318

@coderabbitai

coderabbitai Bot commented Jul 30, 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: 29fb8fab-8fbb-4f65-bee2-bb07405273c9

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 finding contract with typed phases, confidence, evidence, coverage gaps, correlation keys, terminal evidence, and bounded artifact requests. Findings support builder construction, validated serialization, normalization, deterministic ordering, corroboration checks, and expanded contract tests.

Changes

SCCM finding contracts

Layer / File(s) Summary
Finding types and public exports
crates/cmtraceopen-parser/src/sccm/findings.rs, crates/cmtraceopen-parser/src/sccm/models.rs, crates/cmtraceopen-parser/src/sccm/mod.rs
Adds public finding models, typed supporting contracts, canonical role validation, and module re-exports.
Validated wire format and contract rules
crates/cmtraceopen-parser/src/sccm/findings.rs
Adds strict deserialization, validation-aware serialization, evidence and role checks, corroboration rules, and bounded artifact-request validation.
Construction, corroboration, and deterministic output
crates/cmtraceopen-parser/src/sccm/findings.rs
Adds builder APIs, identifier normalization, corroboration checks, stable ordering, and deduplication.
Contract and serialization tests
crates/cmtraceopen-parser/tests/sccm_spine_contract.rs
Covers construction, validation, strict wire formats, corroboration, artifact requests, normalization, ordering, privacy-aware output, and round trips.

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

Sequence Diagram(s)

sequenceDiagram
  participant SccmFindingBuilder
  participant SccmFinding
  participant EvidenceValidation
  participant WireDeserializer
  SccmFindingBuilder->>SccmFinding: build finding
  SccmFinding->>EvidenceValidation: validate evidence, roles, keys, and requests
  EvidenceValidation-->>SccmFinding: return validation result
  WireDeserializer->>SccmFinding: deserialize validated wire fields
Loading

Possibly related issues

  • #318 — Covers the SCCM findings, evidence, coverage gaps, artifact requests, and correlation keys implemented here.
  • #317 — Covers the shared diagnostic finding contracts and validation foundation implemented here.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR identifies PR #353 and Task 7 of the SCCM diagnostic-spine plan.
Out of Scope Changes check ✅ Passed The changes remain within SCCM parser contracts, models, and tests, with no reported native I/O, dependency, or unrelated subsystem changes.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the PR's main change: enforcing evidence-backed SCCM findings.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a substantive review of exact head 8612c172a827fb663d6572074dcf9b2c08c91519 against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

Focus on conservative soundness: an empty parser-owned Stable-profile registry must keep arbitrary/unregistered profile strings from authorizing key-only High; duplicate/same-time/keyless/Low/unprofiled/mismatched/uncited evidence must fail closed; terminal markers must be cited and non-forgeable through unknown wire values; InsufficientEvidence must retain explicit non-Captured gaps and exact catalog logical-ID/role requests with bounded reasons/count; drive/root/glob/recursive/whole-disk requests must fail; and custom deserialization must sort/dedup then revalidate while rejecting unknown fields/raw execution context. Please also check deterministic ordering, camelCase round trips, public compatibility, and pure wasm32 scope. This PR remains draft pending CodeRabbit and a different independent API reviewer.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="25b37333affde22b4ef8a19f4a5f3d89c082b599"
head="8612c172a827fb663d6572074dcf9b2c08c91519"

echo "== Checked-out commit =="
git rev-parse HEAD
echo "== Base/head availability =="
git cat-file -t "$base"
git cat-file -t "$head"

echo "== Changed files (exact range) =="
git diff --name-status "$base" "$head"

echo "== Diff stat =="
git diff --stat "$base" "$head"

echo "== Relevant symbols and source map =="
fd -t f -e rs . | rg '(^|/)(findings|sccm_spine_contract)\.rs$' || true
fd -t f -e rs . | xargs -r ast-grep outline --items all --type struct,enum,impl,function --match 'Sccm|Finding|Artifact|Coverage|Terminal|Confidence|Phase' 2>/dev/null || true

echo "== Exact diff =="
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"

Length of output: 58157


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== SCCM module source files =="
fd -t f -e rs . crates/cmtraceopen-parser/src/sccm | sort

echo "== Model and catalog declarations used by findings =="
ast-grep outline crates/cmtraceopen-parser/src/sccm/models.rs --items all --type struct,enum,impl,function --match 'SccmEvidenceRef|SccmCorrelationKey|SccmRole|SccmCoverageState|SccmFindingClass|SccmKeyConfidence'
ast-grep outline crates/cmtraceopen-parser/src/sccm/catalog.rs --items all --type struct,enum,impl,function --match 'declared_source_catalog|SccmSource|Catalog'

echo "== Exact source sections =="
rg -n -A45 -B8 'struct SccmEvidenceRef|struct SccmCorrelationKey|enum SccmRole|enum SccmCoverageState|enum SccmFindingClass|enum SccmKeyConfidence' crates/cmtraceopen-parser/src/sccm/models.rs
rg -n -A120 -B8 'fn declared_source_catalog|struct Sccm.*Catalog|logical_name' crates/cmtraceopen-parser/src/sccm/catalog.rs

echo "== All construction and validation/serde entry points =="
rg -n -C4 -P '\bSccmFinding\s*\{' crates/cmtraceopen-parser
rg -n -C3 -P '\bSccmFindingBuilder::new\s*\(|\b\.validate\s*\(\)|from_(str|slice|value)\s*::<\s*SccmFinding\s*>' crates/cmtraceopen-parser

echo "== Catalog logical IDs and any duplicate logical-id/role pairs =="
rg -n -P 'logical_name:\s*"|role:\s*SccmRole::' crates/cmtraceopen-parser/src/sccm/catalog.rs

echo "== Dependency/scope indicators in the exact diff =="
git diff --no-ext-diff 25b37333affde22b4ef8a19f4a5f3d89c082b599 8612c172a827fb663d6572074dcf9b2c08c91519 -- \
  'Cargo.toml' 'Cargo.lock' \
  | sed -n '1,240p'
rg -n -i -C2 'std::fs|std::net|std::process|tauri|windows|winapi|ParserKind|LogEntry|native' crates/cmtraceopen-parser/src/sccm/findings.rs crates/cmtraceopen-parser/src/sccm/mod.rs

Length of output: 2594


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Model and catalog maps =="
ast-grep outline crates/cmtraceopen-parser/src/sccm/models.rs --items all --type struct,enum,function 2>/dev/null || true
ast-grep outline crates/cmtraceopen-parser/src/sccm/catalog.rs --items all --type struct,enum,function 2>/dev/null || true

echo "== Model declarations used by findings =="
rg -n -A55 -B6 '^(pub )?(struct|enum) (SccmEvidenceRef|SccmCorrelationKey|SccmRole|SccmCoverageState|SccmFindingClass|SccmKeyConfidence)\b' crates/cmtraceopen-parser/src/sccm/models.rs || true

echo "== Catalog declaration and entries =="
rg -n -A160 -B8 '^(pub )?fn declared_source_catalog\b|logical_name:' crates/cmtraceopen-parser/src/sccm/catalog.rs || true

echo "== Direct construction and contract entry points =="
rg -n -C4 -P '\bSccmFinding\s*\{' crates/cmtraceopen-parser || true
rg -n -C3 -P '\bSccmFindingBuilder::new\s*\(|\b\.validate\s*\(\)|from_(str|slice|value)\s*::<\s*SccmFinding\s*>' crates/cmtraceopen-parser || true

echo "== Dependency changes in exact range =="
git diff --no-ext-diff 25b37333affde22b4ef8a19f4a5f3d89c082b599 8612c172a827fb663d6572074dcf9b2c08c91519 -- Cargo.toml Cargo.lock || true

echo "== Native/I-O/prohibited scope indicators in changed implementation =="
rg -n -i -C2 'std::fs|std::net|std::process|tauri|windows|winapi|ParserKind|LogEntry|native' \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/mod.rs || true

Length of output: 55756


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Strict-wire structs and nested fields (numbered) =="
nl -ba crates/cmtraceopen-parser/src/sccm/findings.rs | sed -n '110,220p'
echo
nl -ba crates/cmtraceopen-parser/src/sccm/findings.rs | sed -n '445,575p'

echo "== Deserialization/adversarial-test coverage (numbered) =="
nl -ba crates/cmtraceopen-parser/tests/sccm_spine_contract.rs | sed -n '535,785p'

echo "== Every serde unknown-field policy in SCCM models/findings =="
rg -n -C2 'deny_unknown_fields|derive\(.*Deserialize|Deserialize\)\]' \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/models.rs

echo "== Check exact base/head integrity and uncommitted state =="
git diff --quiet 25b37333affde22b4ef8a19f4a5f3d89c082b599 8612c172a827fb663d6572074dcf9b2c08c91519 -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/mod.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs
printf 'exact-range status: %s\n' "$?"
git status --short

Length of output: 1420


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Strict-wire structs and nested fields (numbered) =="
cat -n crates/cmtraceopen-parser/src/sccm/findings.rs | sed -n '110,220p'
echo
cat -n crates/cmtraceopen-parser/src/sccm/findings.rs | sed -n '445,575p'

echo "== Deserialization/adversarial-test coverage (numbered) =="
cat -n crates/cmtraceopen-parser/tests/sccm_spine_contract.rs | sed -n '535,785p'

echo "== Every serde unknown-field policy in SCCM models/findings =="
rg -n -C2 'deny_unknown_fields|derive\(.*Deserialize|Deserialize\)\]' \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/models.rs || true

echo "== Exact range and working tree =="
if git diff --quiet 25b37333affde22b4ef8a19f4a5f3d89c082b599 8612c172a827fb663d6572074dcf9b2c08c91519 -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/mod.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs; then
  echo "unexpected: exact range has no changes"
else
  echo "exact range contains the reviewed SCCM changes"
fi
git status --short || true

Length of output: 29575


@adamgell I completed a static review of exact head 8612c172a827fb663d6572074dcf9b2c08c91519 against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

Finding

  • [P1] Reject unknown fields recursively within the finding wire contractSccmFindingWire correctly has deny_unknown_fields (Line 171), but its nested values use permissive derived deserializers: SccmTerminalEvidence (Line 121), SccmFindingCoverageGap (Line 137), and SccmArtifactRequest (Line 145). The nested SccmEvidenceRef and SccmCorrelationKey types are permissive as well. Serde does not inherit deny_unknown_fields into these child deserializers, so a payload such as terminalEvidence[0].executionContext (or evidence[0].executionContext) successfully deserializes and silently drops the undeclared field. This bypasses the stated “reject unknown fields, including raw execution context” contract; the current test only covers top-level executionContext. Use strict finding-specific nested wire types (including evidence refs and correlation keys), or otherwise enforce recursive unknown-field rejection, and add nested unknown/raw-context rejection tests.

I also confirmed the requested core safeguards are otherwise present: the empty parser-owned Stable-profile registry prevents arbitrary profile strings from authorizing key-only High; cited observed terminal failures are required for High ConfirmedFailure; duplicate/same-time/keyless/Low/unprofiled/mismatched/uncited evidence does not corroborate High; artifact requests require exact catalog logical ID plus role and bounded reasons/counts; and builder/deserialization paths sort, deduplicate, then validate. The diff is limited to the parser SCCM surface and tests, with no dependency or native/Windows/Tauri changes.

✅ 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 (4)
crates/cmtraceopen-parser/src/sccm/findings.rs (2)

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

Document the intentionally empty stable-profile registry.

REGISTERED_STABLE_CORRELATION_PROFILE_IDS being empty makes has_profiled_key_corroboration always return false, so the corroboration branch in validate (Line 250) is currently unreachable. That is the correct fail-closed default, but a short comment stating the intent (and what must be true before an ID is added) prevents someone from relaxing it accidentally.

♻️ Suggested comment
+/// Intentionally empty: no correlation profile has yet been validated as stable
+/// enough to authorize key-only High-confidence ConfirmedFailure findings.
+/// Adding an ID here weakens the evidence bar and requires contract review.
 const REGISTERED_STABLE_CORRELATION_PROFILE_IDS: &[&str] = &[];
🤖 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/findings.rs` around lines 15 - 18,
Document the intentional fail-closed behavior beside
REGISTERED_STABLE_CORRELATION_PROFILE_IDS, noting that it must remain empty
until a stable correlation profile ID is explicitly verified and registered; do
not change the registry or validation logic.

452-478: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Avoid rebuilding the whole declared catalog on every validation.

declared_source_catalog() allocates a Vec with a String per catalog entry (per crates/cmtraceopen-parser/src/sccm/catalog.rs:431-439) each time validate() runs, then does a linear scan per request. Once findings are validated in bulk by a reducer this becomes a needless hot-path allocation. Consider a borrowed/static lookup keyed by logical name, or hoisting the catalog fetch outside the loop-per-finding call path.

🤖 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/findings.rs` around lines 452 - 478,
Update validate_artifact_requests to avoid calling declared_source_catalog() and
allocating catalog entries for every validation; reuse a borrowed or static
logical-name lookup, or hoist the catalog construction outside the per-finding
validation path. Preserve the existing request-count, reason, declaration, and
role-mismatch checks while using the shared catalog representation for each
request.
crates/cmtraceopen-parser/tests/sccm_spine_contract.rs (2)

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

Test only proves top-level strictness despite its name.

Injecting executionContext at the root is rejected by deny_unknown_fields on SccmFindingWire, but the same key nested under evidence[0], terminalEvidence[0].reference, or correlationKeys[0] is silently ignored today. Extend this test with a nested injection case so it actually guards the claim once nested wire types become strict.

🤖 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_spine_contract.rs` around lines 760 -
776, Extend finding_deserialization_rejects_raw_execution_context_fields with a
nested executionContext injection under evidence[0],
terminalEvidence[0].reference, or correlationKeys[0], and assert deserialization
fails for that payload. Preserve the existing top-level assertion while ensuring
the test guards strict rejection of raw execution-context fields in nested wire
structures.

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

Corroboration acceptance path has no positive test.

Because REGISTERED_STABLE_CORRELATION_PROFILE_IDS is empty, every one of these cases fails for the same reason (no registered profile), so has_profiled_key_corroboration's distinct-identity/kind/normalized logic is never exercised in the accepting direction. A silent regression there (e.g. >= 2 becoming >= 1) would not be caught. Consider exposing a test-only registered profile ID or unit-testing the predicate directly so both outcomes are pinned.

🤖 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_spine_contract.rs` around lines 163 -
225, The corroboration tests only cover rejection because no registered profile
exists, leaving has_profiled_key_corroboration’s accepting path untested. Add a
test-only registered correlation profile or directly unit-test
has_profiled_key_corroboration with two distinct, same-kind, normalized matching
keys, and also preserve a rejection case for duplicate identity/key evidence so
the required corroboration threshold remains enforced.
🤖 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/findings.rs`:
- Around line 534-570: Replace the nested scan in has_profiled_key_corroboration
with a single-pass grouping approach keyed by kind, normalized value, and
extraction profile, tracking distinct evidence identities per group. Ensure the
implementation returns true once any group has at least two identities, while
preserving the existing corroborating-key and missing-evidence filtering
behavior; do not rely on linear contains scans.
- Around line 428-437: Update validate_required_text and the SccmFindingBuilder
construction/validation flow to reject SccmPhase::Unknown values that shadow
declared phase names, matching Serialize for SccmPhase behavior. Ensure
SccmFindingBuilder::phase returns the validation error during construction while
preserving existing required-field checks.

---

Nitpick comments:
In `@crates/cmtraceopen-parser/src/sccm/findings.rs`:
- Around line 15-18: Document the intentional fail-closed behavior beside
REGISTERED_STABLE_CORRELATION_PROFILE_IDS, noting that it must remain empty
until a stable correlation profile ID is explicitly verified and registered; do
not change the registry or validation logic.
- Around line 452-478: Update validate_artifact_requests to avoid calling
declared_source_catalog() and allocating catalog entries for every validation;
reuse a borrowed or static logical-name lookup, or hoist the catalog
construction outside the per-finding validation path. Preserve the existing
request-count, reason, declaration, and role-mismatch checks while using the
shared catalog representation for each request.

In `@crates/cmtraceopen-parser/tests/sccm_spine_contract.rs`:
- Around line 760-776: Extend
finding_deserialization_rejects_raw_execution_context_fields with a nested
executionContext injection under evidence[0], terminalEvidence[0].reference, or
correlationKeys[0], and assert deserialization fails for that payload. Preserve
the existing top-level assertion while ensuring the test guards strict rejection
of raw execution-context fields in nested wire structures.
- Around line 163-225: The corroboration tests only cover rejection because no
registered profile exists, leaving has_profiled_key_corroboration’s accepting
path untested. Add a test-only registered correlation profile or directly
unit-test has_profiled_key_corroboration with two distinct, same-kind,
normalized matching keys, and also preserve a rejection case for duplicate
identity/key evidence so the required corroboration threshold remains enforced.
🪄 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: e3c1e6f8-c272-43b5-b7af-71c497b766f2

📥 Commits

Reviewing files that changed from the base of the PR and between 25b3733 and 8612c17.

📒 Files selected for processing (3)
  • crates/cmtraceopen-parser/src/sccm/findings.rs
  • crates/cmtraceopen-parser/src/sccm/mod.rs
  • crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

Comment thread crates/cmtraceopen-parser/src/sccm/findings.rs
Comment thread crates/cmtraceopen-parser/src/sccm/findings.rs
@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a fresh substantive review of exact head 5fd80ee9f97aa986708f9d8ea27da14111934602 against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

Prior review disposition:

  • Fixed recursive unknown-field rejection with strict finding-specific nested wires for evidence refs, terminal evidence, coverage gaps, correlation keys (including nested refs), and artifact requests. The focused adversarial matrix first failed at nested evidence, then passes all seven insertion points.
  • Fixed builder/serializer phase inconsistency: Unknown("policy" | "content" | "enforcement") now fails validation during construction; focused test was RED then GREEN.
  • Documented that the parser-owned Stable-profile registry is intentionally empty and may change only at explicit contract review.
  • Deferred the nested corroboration-scan optimization: with the registry empty, no candidate reaches the peer scan, so current production behavior is linear. The first Stable-profile registration must land with a bounded/grouped implementation and acceptance contract.
  • Deferred catalog allocation optimization: this slice calls the fixed-size shared catalog once per finding validation, and changing the shared catalog representation is outside the Task 7 safety contract; no correctness or current bounded-request issue depends on it.
  • Did not add a test-only Stable profile or positive key-only High path because that would create acceptance behavior unavailable in production and weaken the fail-closed contract. Acceptance tests are required with the first reviewed Stable profile.
  • The nested strictness test nit is fixed. The docstring-coverage suggestion remains a non-blocking documentation/API-review item; this draft is not being marked ready.
  • Both inline review threads have technical replies and are resolved.

Re-check conservative evidence rules, recursive wire strictness, phase construction/serialization consistency, deterministic normalization, public model compatibility, and pure Rust/wasm32 scope. Verification at this head: 23 focused finding tests; 677 parser tests on Rust 1.88; strict Clippy; Rust 1.88 wasm32 check; TypeScript; scoped Rust 1.88 formatting; and diff checks all pass. The PR remains draft pending this pass and a different independent API reviewer.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="25b37333affde22b4ef8a19f4a5f3d89c082b599"
head="5fd80ee9f97aa986708f9d8ea27da14111934602"

echo "== Exact revisions =="
printf 'checked out: '; git rev-parse HEAD
printf 'base object: '; git cat-file -t "$base"
printf 'head object: '; git cat-file -t "$head"

echo "== Changed files =="
git diff --name-status "$base" "$head"
echo "== Diff stat =="
git diff --stat "$base" "$head"

echo "== Relevant source/test files =="
fd -t f -e rs . | rg '(^|/)(findings|models|catalog|sccm_spine_contract)\.rs$' | sort

echo "== SCCM declaration map =="
ast-grep outline crates/cmtraceopen-parser/src/sccm --items all \
  --type struct,enum,impl,function --match 'Sccm|Finding|Artifact|Coverage|Terminal|Confidence|Phase' 2>/dev/null || true

echo "== Exact diff =="
git diff --no-ext-diff --find-renames --find-copies "$base" "$head" -- \
  crates/cmtraceopen-parser/src/sccm \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs \
  Cargo.toml Cargo.lock

Length of output: 65856


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Dependent SCCM contract declarations =="
rg -n -A70 -B6 \
  '^(pub )?(struct|enum) (SccmEvidenceRef|SccmCorrelationKey|SccmCorrelationKeyKind|SccmCoverageState|SccmFindingClass|SccmKeyConfidence|SccmRole)\b' \
  crates/cmtraceopen-parser/src/sccm/models.rs

echo "== Catalog source and logical-ID/role entries =="
ast-grep outline crates/cmtraceopen-parser/src/sccm/catalog.rs --items all --type struct,enum,function 2>/dev/null || true
rg -n -A180 -B10 '^(pub )?fn declared_source_catalog\b|logical_name:|role:' \
  crates/cmtraceopen-parser/src/sccm/catalog.rs

echo "== Finding implementation tail and all changed test names =="
cat -n crates/cmtraceopen-parser/src/sccm/findings.rs | sed -n '280,851p'
rg -n '^\s*fn finding_|^\s*#\[test\]' crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

echo "== Finding construction, deserialization, and public-export usages =="
rg -n -C3 -P '\bSccmFinding(?:Builder)?\b|from_(str|slice|value)\s*::<\s*SccmFinding\s*>' \
  crates/cmtraceopen-parser

echo "== Changed-scope indicators =="
rg -n -i -C2 'std::fs|std::net|std::process|tauri|windows|winapi|tokio|reqwest|unsafe' \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/mod.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs || true

echo "== Workspace and exact range status =="
git status --short
git diff --check 25b37333affde22b4ef8a19f4a5f3d89c082b599 5fd80ee9f97aa986708f9d8ea27da14111934602

Length of output: 92031


@adamgell I completed a fresh static review of exact head 5fd80ee9f97aa986708f9d8ea27da14111934602 against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

Finding

  • [P1] Prevent externally constructed or mutated invalid findings from being serializedSccmFinding exposes every contract-bearing field as pub (starting at Line 157), while its derived Serialize implementation does not call validate(). Consequently, downstream Rust callers can directly construct—or mutate after SccmFindingBuilder::build()—a ConfirmedFailure with High confidence and no cited terminal evidence, then serialize it as a valid-looking finding. This bypasses the builder/deserialization safeguards and violates the evidence-backed public contract. Make the fields private and expose validated construction/accessors, or replace derived serialization with a validating serializer that rejects invalid state; include a test covering direct invalid construction or post-build mutation.

The previously reported fixes are present: nested finding wire values now reject unknown fields recursively at all seven tested insertion points, and SccmPhase::Unknown values that shadow declared phases are rejected during validation. I also confirmed the empty parser-owned stable-profile registry remains fail-closed; high confirmed failures require a cited observed terminal failure in current production behavior; artifact requests remain catalog/role-bound and reason/count-bounded; and builder/deserialization normalization is deterministic.

The diff remains limited to parser SCCM contracts and tests, with no dependency, native I/O, Windows/Tauri, or wasm32-scope additions.

You are interacting with an AI system.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a fresh substantive review of exact head dddcd03ecb532875981d90d71a181d0c06115c1a against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

The latest P1 from #353 (comment) is fixed test-first:

  • RED: finding_serialization_rejects_post_build_invalid_mutation showed that clearing cited terminal evidence after a valid High ConfirmedFailure build still serialized successfully.
  • GREEN: SccmFinding now implements custom Serialize; it calls the same conservative validate() and then serializes a borrow-only wire with the planned public fields in the same camelCase order.
  • Public fields remain compatible; the change closes direct-construction and post-build mutation bypasses without adding a second public model or native dependencies.

Please re-check every evidence/coverage/key/request mutation path, valid round trips and field shape/order, recursive strict deserialization, phase-shadow validation, deterministic behavior, empty Stable-profile fail-closed behavior, and wasm32 purity.

Verification on this exact head: 24 focused finding tests; 678 parser tests on Rust 1.88; strict Clippy; Rust 1.88 wasm32; TypeScript; scoped Rust 1.88 formatting; and diff checks all pass. PR remains draft pending this review and a different independent API reviewer.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="25b37333affde22b4ef8a19f4a5f3d89c082b599"
head="dddcd03ecb532875981d90d71a181d0c06115c1a"

echo "== Exact revisions =="
printf 'checked out: '; git rev-parse HEAD
printf 'base: '; git cat-file -t "$base"
printf 'head: '; git cat-file -t "$head"

echo "== Changed files and diff stat =="
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"

echo "== SCCM source map =="
ast-grep outline crates/cmtraceopen-parser/src/sccm --items all \
  --type struct,enum,impl,function --match 'Sccm|Finding|Artifact|Coverage|Terminal|Confidence|Phase' 2>/dev/null || true

echo "== Exact implementation diff =="
git diff --no-ext-diff --find-renames --find-copies "$base" "$head" -- \
  crates/cmtraceopen-parser/src/sccm \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs \
  Cargo.toml Cargo.lock

echo "== Findings source, numbered =="
cat -n crates/cmtraceopen-parser/src/sccm/findings.rs

echo "== Dependent model and catalog contracts =="
rg -n -A85 -B8 \
  '^(pub )?(struct|enum) (SccmEvidenceRef|SccmCorrelationKey|SccmCorrelationKeyKind|SccmCoverageState|SccmFindingClass|SccmKeyConfidence|SccmRole)\b' \
  crates/cmtraceopen-parser/src/sccm/models.rs || true
rg -n -A190 -B10 '^(pub )?fn declared_source_catalog\b|logical_name:|role:' \
  crates/cmtraceopen-parser/src/sccm/catalog.rs || true

echo "== Findings tests and serde/mutation test contexts =="
rg -n -A35 -B8 \
  'finding_|serializ|deserializ|unknown|executionContext|phase|determin|correlation|artifact|coverage|terminal' \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs || true

echo "== All public construction/serialization/deserialization paths =="
rg -n -C4 -P \
  '\bSccmFinding(?:Builder)?\b|serde_json::(?:to_|from_)|from_(?:str|slice|value)\s*::<\s*SccmFinding\s*>' \
  crates/cmtraceopen-parser || true

echo "== Scope/dependency indicators and whitespace =="
git diff --no-ext-diff "$base" "$head" -- Cargo.toml Cargo.lock
rg -n -i -C2 'std::fs|std::net|std::process|tauri|windows|winapi|tokio|reqwest|unsafe' \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/mod.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs || true
git diff --check "$base" "$head"

Length of output: 197544


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="25b37333affde22b4ef8a19f4a5f3d89c082b599"
head="dddcd03ecb532875981d90d71a181d0c06115c1a"

echo "== Latest serializer-related delta only =="
git diff --no-ext-diff 5fd80ee9f97aa986708f9d8ea27da14111934602 "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

echo "== Finding wire types, serializer, and deserializer =="
sed -n '1,370p' crates/cmtraceopen-parser/src/sccm/findings.rs | cat -n

echo "== Validator, builder, helpers, and normalization =="
sed -n '367,850p' crates/cmtraceopen-parser/src/sccm/findings.rs | cat -n

echo "== Finding-only contract tests =="
sed -n '1,1010p' crates/cmtraceopen-parser/tests/sccm_spine_contract.rs | cat -n

echo "== Relevant model definitions exactly =="
rg -n -A95 -B5 \
  '^(pub )?(struct|enum) (SccmEvidenceRef|SccmCorrelationKey|SccmCorrelationKeyKind|SccmCoverageState|SccmFindingClass|SccmKeyConfidence|SccmRole)\b' \
  crates/cmtraceopen-parser/src/sccm/models.rs

echo "== Serialize implementations of field-member types =="
rg -n -A25 -B5 'impl Serialize for|derive\(.*Serialize' \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/models.rs

echo "== Exact-range changed paths and dependency diff =="
git diff --name-status "$base" "$head"
git diff --no-ext-diff "$base" "$head" -- Cargo.toml Cargo.lock

Length of output: 126680


@adamgell I completed a fresh static review of exact head dddcd03ecb532875981d90d71a181d0c06115c1a against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

Finding

  • [P1] Require non-empty evidence identities before treating a terminal failure as citedvalidate_terminal_evidence at crates/cmtraceopen-parser/src/sccm/findings.rs Line 285 only checks structural equality against finding.evidence. Since SccmEvidenceRef has public, unconstrained artifact_id and entry_id fields, a caller can construct a High ConfirmedFailure whose evidence and terminalEvidence both contain the same empty reference. It passes the cited-terminal check and the new validating serializer, even though the alleged terminal failure cannot identify any observed evidence. Validate non-blank evidence-reference identity fields (at least artifact_id and entry_id) for finding evidence and nested terminal/key references, and add a serialization/deserialization regression case using an empty referenced terminal failure.

The reported serializer fix is otherwise correctly present: SccmFinding::serialize validates before emitting a borrow-only camelCase wire in the established field order, so clearing terminal evidence—or mutating coverage gaps, keys, requests, or other validated fields into an invalid state—now fails serialization. I also confirmed:

  • strict recursive finding-wire deserialization at all nested evidence, terminal, gap, key, nested-key-reference, and request boundaries;
  • Unknown phases shadowing declared phase names fail in both validation and serialization;
  • deterministic trim/sort/dedup normalization followed by validation;
  • an intentionally empty Stable-profile registry, which keeps key-only High fail-closed;
  • no dependency, native I/O, Windows/Tauri, or wasm32-scope additions in the exact range.
✅ 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

@coderabbitai review

Please perform a fresh substantive review of exact head e69eb1c073e912d1a65f8ce0debd4e904b0639cb against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

The evidence-identity P1 from #353 (comment) is fixed test-first:

  • RED: builder, deserializer, and validating serializer all accepted a High ConfirmedFailure whose top-level and terminal refs shared empty/whitespace artifact and entry IDs.
  • RED: a top-level one-sided line range built successfully, while isolated invalid terminal/key refs reached later citation errors rather than one shared reference-integrity error.
  • GREEN: validate_all_evidence_references routes every top-level, terminal, and correlation-key nested ref through one validator before citation/corroboration checks.
  • Identity requires nonblank artifactId and entryId.
  • Line provenance accepts legitimate None/None; otherwise start/end must both exist, start must be nonzero, and end must be >= start.
  • Public SCCM evidence models and JSON shape remain unchanged.

Please re-check self-attestation, nested refs, error precedence, valid None/None refs, build/deserialize/serialize parity, prior recursive-wire and validating-serialization fixes, empty Stable-profile fail-closed behavior, deterministic output, and wasm32 purity.

Verification on this exact head: 30 focused finding tests; 684 parser tests on Rust 1.88; strict Clippy; Rust 1.88 wasm32; TypeScript; scoped Rust 1.88 formatting; and diff checks all pass. PR remains draft pending this pass and a different independent API reviewer.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="25b37333affde22b4ef8a19f4a5f3d89c082b599"
head="e69eb1c073e912d1a65f8ce0debd4e904b0639cb"

echo "== Exact revisions =="
printf 'checked out: '; git rev-parse HEAD
printf 'base type: '; git cat-file -t "$base"
printf 'head type: '; git cat-file -t "$head"

echo "== Changed paths and stat =="
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"

echo "== SCCM API map at requested head =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" > /tmp/findings.rs
ast-grep outline /tmp/findings.rs --items all --type struct,enum,impl,function \
  --match 'Sccm|Finding|Evidence|Artifact|Coverage|Terminal|Confidence|Phase' || true

echo "== Exact finding implementation: wire types, serializer, deserializer, validator and normalization =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | sed -n '1,920p'

echo "== Dependent public evidence/key/role model declarations =="
git show "$head:crates/cmtraceopen-parser/src/sccm/models.rs" | \
  rg -n -A100 -B8 \
  '^(pub )?(struct|enum) (SccmEvidenceRef|SccmCorrelationKey|SccmCorrelationKeyKind|SccmCoverageState|SccmFindingClass|SccmKeyConfidence|SccmRole)\b' || true

echo "== Catalog logical source declarations =="
git show "$head:crates/cmtraceopen-parser/src/sccm/catalog.rs" | \
  rg -n -A190 -B10 '^(pub )?fn declared_source_catalog\b|logical_name:|role:' || true

echo "== Finding-focused tests at requested head =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | \
  rg -n -A42 -B10 \
  'finding_|evidence.*ref|reference|serializ|deserializ|unknown|executionContext|phase|determin|correlation|artifact|coverage|terminal' || true

echo "== Exact full diff for reviewed files =="
git diff --no-ext-diff --find-renames --find-copies "$base" "$head" -- \
  crates/cmtraceopen-parser/src/sccm \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs \
  Cargo.toml Cargo.lock

echo "== Scope and dependency indicators in exact range =="
git diff --no-ext-diff "$base" "$head" -- Cargo.toml Cargo.lock
git diff --no-ext-diff "$base" "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/mod.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs | \
  rg -n -i 'std::fs|std::net|std::process|tauri|windows|winapi|tokio|reqwest|unsafe' || true

echo "== Whitespace validation =="
git diff --check "$base" "$head"

Length of output: 93710


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="25b37333affde22b4ef8a19f4a5f3d89c082b599"
prior="dddcd03ecb532875981d90d71a181d0c06115c1a"
head="e69eb1c073e912d1a65f8ce0debd4e904b0639cb"

echo "== Latest-only delta (prior reviewed head -> requested head) =="
git diff --no-ext-diff "$prior" "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

echo "== Exact dependent model definitions and serde implementations =="
git show "$head:crates/cmtraceopen-parser/src/sccm/models.rs" > /tmp/sccm-models.rs
ast-grep outline /tmp/sccm-models.rs --items all --type struct,enum,impl,function \
  --match 'SccmEvidenceRef|SccmCorrelationKey|SccmRole|SccmCoverageState|SccmFindingClass|SccmKeyConfidence' || true
git show "$head:crates/cmtraceopen-parser/src/sccm/models.rs" | cat -n | \
  sed -n '/pub struct SccmEvidenceRef/,/pub struct SccmEvidence/p; /pub struct SccmCorrelationKey/,/pub struct Sccm/p; /pub enum SccmRole/,/pub enum Sccm/p; /pub enum SccmCoverageState/,/pub enum Sccm/p; /pub enum SccmFindingClass/,/pub enum Sccm/p; /pub enum SccmKeyConfidence/,/pub enum Sccm/p' || true

echo "== All exact-head finding references and serde boundaries =="
git grep -n -E \
  'SccmFinding(::|[[:space:]]*\{)|SccmFindingBuilder::new|from_(str|slice|value).*SccmFinding|to_(string|value).*SccmFinding|serialize.*SccmFinding' \
  "$head" -- crates/cmtraceopen-parser || true

echo "== Validator ordering / normalize and direct serialize tests, concise =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | sed -n '150,620p'
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | \
  sed -n '620,1180p'

echo "== Unknown-field policy and direct derived serde on public nested types =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | \
  rg -n -C2 'deny_unknown_fields|impl (Serialize|Deserialize) for|derive\(.*(Serialize|Deserialize)' || true
git show "$head:crates/cmtraceopen-parser/src/sccm/models.rs" | \
  rg -n -C2 'SccmEvidenceRef|SccmCorrelationKey|derive\(.*(Serialize|Deserialize)|impl (Serialize|Deserialize) for' || true

echo "== Exact diff check and changed files outside declared scope =="
git diff --check "$base" "$head"
git diff --name-only "$base" "$head" | sort

Length of output: 73717


@adamgell I completed a fresh static review of exact head e69eb1c073e912d1a65f8ce0debd4e904b0639cb against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

No blocking findings.

Confirmed in this pass:

  • All top-level, terminal, and correlation-key nested evidence references pass through the shared integrity validator before citation/corroboration checks. Blank artifactId/entryId, partial ranges, zero starts, and reversed ranges fail with InvalidEvidenceReference; legitimate None/None provenance remains valid.
  • The self-attesting blank-reference case is rejected consistently by builder validation, strict deserialization, and validating serialization.
  • Recursive unknown-field rejection remains enforced at every finding-wire boundary, including nested terminal/key references; raw executionContext is not accepted.
  • SccmFinding serialization still validates all public mutable fields before emitting the established camelCase wire shape, preventing post-build mutation bypasses.
  • Phase shadowing is rejected, normalization remains deterministic, and deserialization normalizes then revalidates.
  • The intentionally empty Stable-profile registry stays fail-closed, so key-only High ConfirmedFailure findings cannot currently pass without cited observed terminal evidence.
  • Coverage-gap and bounded catalog/role artifact-request safeguards remain intact.
  • The exact diff is limited to the parser SCCM contract and tests, with no dependency, native I/O, Windows/Tauri, or wasm32-scope additions.
✅ 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 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 API/security review of exact range 25b37333affde22b4ef8a19f4a5f3d89c082b599..e69eb1c073e912d1a65f8ce0debd4e904b0639cb: BLOCKED.

CodeRabbit completed a substantive review on this exact head and reported no blocking findings (comment). A separate dynamic builder/deserializer/serializer matrix found these blocking contract gaps:

  1. Valid post-build mutation bypasses canonical output. SccmFinding exposes mutable public arrays. Reversing evidence and appending a duplicate after construction still serializes successfully as [B, A, B]. The custom serializer validates current state, but neither canonicalizes it nor rejects a valid-but-noncanonical state. The evidence-first deterministic-output contract therefore does not hold for the public type; the same exposure applies to the other canonicalized arrays.

  2. Logical evidence identities can be duplicated or aliased. Two refs with the same artifact_id + entry_id but different line ranges both survive normalization, even though that same pair is the logical identity used for corroboration. Leading/trailing whitespace in both IDs is also accepted (for example " artifact-a " / " entry-a "). Exact-struct dedup() plus nonblank-only validation does not provide a unique canonical evidence identity.

  3. Unknown-value shadows break canonical/round-trip semantics. SccmPhase::Unknown(" policy ") bypasses the known-phase shadow guard. SccmRole::Unknown("client") serializes as "client" and deserializes as SccmRole::Client, so a valid finding does not round-trip to itself. The role behavior originates in the shared model but is admitted by this new public finding API and needs a guard or shared-model correction before the contract is public.

  4. The bounded-request guard is too literal. All of these were accepted by the builder: “Collect every file on the system.”, “Scan the full disk for related evidence.”, “Collect the complete C: drive.”, “Walk all directories under C:.”, and “Collect drive-wide logs.” This does not enforce the plan's prohibition on requests for an unbounded entire drive.

Independent committed focused tests are green: cargo test --locked -p cmtraceopen-parser --test sccm_spine_contract finding_ -- --nocapture30 passed. The temporary adversarial probe was 3 passed / 6 failed and has been removed; it exercised post-build mutation, duplicate/whitespace evidence identities, phase/role shadows, nested range validation, all non-captured coverage states, and unbounded-request variants.

Please add focused regression tests for each case and make construction, deserialization, serialization, and round-trip behavior converge on one deterministic invariant. This review does not authorize merge, ready-for-review, or issue closure.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please review the exact range 25b37333affde22b4ef8a19f4a5f3d89c082b599..310cee519e68900e6a77dc7025d86b383154dc08.

This head includes the independent blocker matrix and the two accepted local CodeRabbit follow-ups. Please pay particular attention to deterministic post-mutation serialization, canonical evidence identity/range conflicts across all reference surfaces, Unknown phase/role round-trip guards, and structural bounded-request wording. The PR must remain draft pending this exact-head review and a different independent API review.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="25b37333affde22b4ef8a19f4a5f3d89c082b599"
head="310cee519e68900e6a77dc7025d86b383154dc08"

printf 'checked-out: '; git rev-parse HEAD
printf 'base: '; git cat-file -t "$base"
printf 'head: '; git cat-file -t "$head"

echo "== Changed paths/stat =="
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"

echo "== SCCM source/test map =="
fd -t f -e rs . crates/cmtraceopen-parser/src/sccm crates/cmtraceopen-parser/tests | sort
ast-grep outline crates/cmtraceopen-parser/src/sccm --items all \
  --type struct,enum,impl,function \
  --match 'Sccm|Finding|Evidence|Terminal|Artifact|Coverage|Correlation|Phase|Role' 2>/dev/null || true

echo "== Exact diff =="
git diff --no-ext-diff --find-renames --find-copies "$base" "$head" -- \
  crates/cmtraceopen-parser/src/sccm \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs \
  Cargo.toml Cargo.lock

echo "== Findings implementation (numbered) =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n

echo "== Dependent public models/catalog (numbered excerpts) =="
git show "$head:crates/cmtraceopen-parser/src/sccm/models.rs" | cat -n | \
  rg -n -A110 -B8 \
  'pub (struct|enum) (SccmEvidenceRef|SccmCorrelationKey|SccmCorrelationKeyKind|SccmRole|SccmCoverageState|SccmFindingClass|SccmKeyConfidence)' || true
git show "$head:crates/cmtraceopen-parser/src/sccm/catalog.rs" | cat -n | \
  rg -n -A190 -B8 'fn declared_source_catalog|logical_name:|role:' || true

echo "== Finding-focused tests (numbered) =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | \
  rg -n -A60 -B10 \
  'finding_|serializ|deserializ|mutation|reference|range|unknown|phase|role|artifact|request|coverage|terminal|determin|canonical' || true

echo "== Public construction/serde references =="
git grep -n -E \
  'SccmFinding(::|[[:space:]]*\{)|SccmFindingBuilder::new|from_(str|slice|value).*SccmFinding|to_(string|value).*SccmFinding' \
  "$head" -- crates/cmtraceopen-parser || true

echo "== Scope/dependency/whitespace =="
git diff --no-ext-diff "$base" "$head" -- Cargo.toml Cargo.lock
git diff --no-ext-diff "$base" "$head" -- \
  crates/cmtraceopen-parser/src/sccm \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs | \
  rg -n -i 'std::fs|std::net|std::process|tauri|windows|winapi|tokio|reqwest|unsafe' || true
git diff --check "$base" "$head"

Length of output: 132027


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head="310cee519e68900e6a77dc7025d86b383154dc08"

echo "== findings.rs: public wires, serde, and validation =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | nl -ba | sed -n '1,760p'

echo "== findings.rs: remaining helpers/builder =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | nl -ba | sed -n '760,980p'

echo "== Blocker-matrix tests: deterministic/canonical reference behavior =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | nl -ba | sed -n '430,940p'

echo "== Request wording tests and helpers =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | nl -ba | sed -n '40,120p; 900,1020p'

echo "== Phase/role definitions and serde implementations =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | nl -ba | sed -n '1,160p'
git show "$head:crates/cmtraceopen-parser/src/sccm/models.rs" | nl -ba | \
  rg -n -A140 -B10 'enum SccmRole|impl SccmRole|enum SccmCoverageState|struct SccmEvidenceRef|struct SccmCorrelationKey'

echo "== Latest delta only, for accepted follow-ups =="
git diff --no-ext-diff e69eb1c073e912d1a65f8ce0debd4e904b0639cb "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

Length of output: 1710


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head="310cee519e68900e6a77dc7025d86b383154dc08"

echo "== findings.rs: public wires, serde, and validation =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | sed -n '1,760p'

echo "== findings.rs: remaining helpers/builder =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | sed -n '760,980p'

echo "== Blocker-matrix tests: deterministic/canonical reference behavior =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | sed -n '430,940p'

echo "== Request wording tests and helpers =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | sed -n '40,120p; 900,1020p'

echo "== Phase/role definitions and serde implementations =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | sed -n '1,160p'
git show "$head:crates/cmtraceopen-parser/src/sccm/models.rs" | cat -n | \
  rg -n -A140 -B10 'enum SccmRole|impl SccmRole|enum SccmCoverageState|struct SccmEvidenceRef|struct SccmCorrelationKey'

echo "== Latest delta only, for accepted follow-ups =="
git diff --no-ext-diff e69eb1c073e912d1a65f8ce0debd4e904b0639cb "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

Length of output: 117714


@adamgell I completed a fresh static review of exact range 25b37333affde22b4ef8a19f4a5f3d89c082b599..310cee519e68900e6a77dc7025d86b383154dc08.

Finding

  • [P1] Reject direct filesystem-root paths in artifact-request reasonshas_unbounded_request_scope in crates/cmtraceopen-parser/src/sccm/findings.rs Line 713 only detects word-token combinations such as root + drive, broad quantifiers, glob characters, and recursive terms. A reason like Collect C:\ for related evidence. (likewise /) produces tokens such as collect, c, for, related, evidence, so it contains neither a forbidden word combination nor *, ?, [, or ]. It therefore passes validation even though it explicitly requests the root of a drive, contrary to the bounded-request contract. Detect rooted Windows/POSIX path forms structurally before tokenization (including drive roots and UNC roots as applicable), and cover builder, deserialization, and validating-serialization paths.

The requested safeguards otherwise hold in this pass:

  • Serialization clones, normalizes, revalidates, and emits normalized collections, so valid post-build ordering/duplication mutations serialize deterministically while invalid mutations still fail.
  • Evidence identities are trimmed and range-conflict checked across top-level evidence, terminal evidence, and correlation-key references before citation checks.
  • Whitespace-wrapped declared Unknown phases are rejected after normalization; valid future phases round-trip canonically.
  • SccmRole rejects empty, noncanonical, and declared-name-shadowing unknown values at standalone serde and all finding/gap/request boundaries.
  • Recursive strict finding-wire deserialization, terminal citation integrity, empty Stable-profile fail-closed behavior, coverage-gap requirements, and catalog logical-ID/role request binding remain intact.
  • The exact diff remains parser-only, with no dependency, native I/O, Windows/Tauri, or wasm32-scope additions.
✅ 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.

🧹 Nitpick comments (3)
crates/cmtraceopen-parser/tests/sccm_spine_contract.rs (3)

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

Assert the exact error variant here.

Every neighbouring builder test compares against a specific SccmFindingValidationError; this one only checks is_err(), so it would still pass if the whitespace-wrapped phase were rejected for an unrelated reason.

♻️ Suggested tightening
-    assert!(result.is_err());
+    assert_eq!(
+        result.unwrap_err(),
+        SccmFindingValidationError::MissingRequiredField
+    );
🤖 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_spine_contract.rs` around lines 746 -
758, Update finding_rejects_whitespace_wrapped_declared_phase_shadow to assert
the specific SccmFindingValidationError returned by SccmFindingBuilder::build,
matching the neighboring builder tests and verifying the rejection is caused by
the whitespace-wrapped phase.

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

Test name promises ordering that isn't asserted.

finding_validates_finding_gap_and_request_roles_before_other_rules only asserts that InvalidRole is returned. Each fixture is otherwise valid, so InvalidRole is the only possible error and precedence over the other rules is never exercised. Either rename to drop the ordering claim, or add a fixture that violates a second rule (e.g. an InsufficientEvidence finding with no coverage gap plus an invalid role) to prove InvalidRole wins.

🤖 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_spine_contract.rs` around lines 847 -
895, Update the test
`finding_validates_finding_gap_and_request_roles_before_other_rules` so it
actually exercises validation precedence by making at least one fixture violate
both `InvalidRole` and another rule, such as insufficient evidence without a
coverage gap, and assert that `InvalidRole` is returned first; alternatively,
rename the test to remove the ordering claim if precedence is not intended to be
tested.

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

Bare is_err() plus missing filesystem-root cases.

Two gaps in this table test:

  1. assert!(result.is_err()) doesn't pin the failure to InvalidArtifactRequestReason; a regression that instead trips UndeclaredArtifactRequest or ArtifactRequestRoleMismatch would keep this green.
  2. The reason list covers prose forms ("filesystem root", "under C:.") but no literal root path such as C:\, \\server\share, or /. That is exactly the outstanding P1 called out in the PR discussion, so adding these rows will make the fix verifiable.
♻️ Suggested additions
         "Collect from the filesystem root.",
         "Use a glob for matching log files.",
         r"Collect C:\Windows\CCM\Logs\*.log.",
+        r"Collect C:\.",
+        r"Collect \\LAB-CLIENT-01\C$.",
+        "Collect /.",
     ];
 
     for reason in reasons {
@@
-        assert!(result.is_err(), "{reason}");
+        assert_eq!(
+            result.unwrap_err(),
+            SccmFindingValidationError::InvalidArtifactRequestReason,
+            "{reason}"
+        );
🤖 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_spine_contract.rs` around lines 946 -
976, Strengthen finding_artifact_requests_reject_structurally_unbounded_reasons
by matching the build error specifically to InvalidArtifactRequestReason rather
than using a bare is_err assertion, while preserving the existing request setup.
Expand its reasons table with literal filesystem-root cases such as C:\,
\\server\share, and /, and verify each is rejected for that exact error variant.
🤖 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.

Nitpick comments:
In `@crates/cmtraceopen-parser/tests/sccm_spine_contract.rs`:
- Around line 746-758: Update
finding_rejects_whitespace_wrapped_declared_phase_shadow to assert the specific
SccmFindingValidationError returned by SccmFindingBuilder::build, matching the
neighboring builder tests and verifying the rejection is caused by the
whitespace-wrapped phase.
- Around line 847-895: Update the test
`finding_validates_finding_gap_and_request_roles_before_other_rules` so it
actually exercises validation precedence by making at least one fixture violate
both `InvalidRole` and another rule, such as insufficient evidence without a
coverage gap, and assert that `InvalidRole` is returned first; alternatively,
rename the test to remove the ordering claim if precedence is not intended to be
tested.
- Around line 946-976: Strengthen
finding_artifact_requests_reject_structurally_unbounded_reasons by matching the
build error specifically to InvalidArtifactRequestReason rather than using a
bare is_err assertion, while preserving the existing request setup. Expand its
reasons table with literal filesystem-root cases such as C:\, \\server\share,
and /, and verify each is rejected for that exact error variant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 764dbf07-1965-4840-808d-eb61649fb52e

📥 Commits

Reviewing files that changed from the base of the PR and between 8612c17 and 310cee5.

📒 Files selected for processing (3)
  • crates/cmtraceopen-parser/src/sccm/findings.rs
  • crates/cmtraceopen-parser/src/sccm/models.rs
  • crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please review exact range 25b37333affde22b4ef8a19f4a5f3d89c082b599..670fe2d5bf84f2aae3b8dd78a5895a74501e3b71.

Disposition of the prior exact-head P1: accepted and fixed test-first in 670fe2d5bf84f2aae3b8dd78a5895a74501e3b71. Request reasons now structurally reject embedded Windows drive-root/absolute (C:\, C:/...), POSIX absolute/root (/, /var/...), and UNC/network-root (\\server\share, //server/share) forms before tokenization. The matrix exercises builder, deserializer, and validating serializer; bounded Logs/..., Logs\..., descriptive, and disk-imaging reasons remain accepted.

Please keep PR #353 draft pending this exact-head review and a different independent API review.

@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 API/security rereview of 25b37333affde22b4ef8a19f4a5f3d89c082b599..670fe2d5bf84f2aae3b8dd78a5895a74501e3b71: BLOCKED.

The new rooted-path fix works for Windows drive/absolute, POSIX absolute/root, and UNC forms. The full dynamic boundary/equivalence replay still finds three blocking contract classes:

  1. Public validation boundaries disagree.

    • A post-build SccmPhase::Unknown(" policy ") is accepted by direct validate(), while builder construction and finding serialization reject it. Standalone phase serialization also admits the whitespace shadow.
    • Same-range whitespace aliases of a cited evidence identity on each of top-level evidence, terminal evidence, and correlation-key evidence are rejected by direct validate(), while builder construction and serialization normalize and accept the same logical identity.
    • A whitespace-wrapped catalog logical ID/reason has the same split: direct validate() rejects it, while builder and serializer normalize and accept it.

    The public contract needs one invariant at direct validation, construction, deserialization, and serialization. Canonical aliases may be normalized or rejected, but the result cannot depend on which boundary the caller uses.

  2. The request-count invariant is bypassed by serialization normalization. Seventeen identical requests are rejected by builder construction, direct validate(), and deserialization because the raw count exceeds 16; the same post-build mutation serializes successfully after deduplication to one request. Decide whether the cap applies before or after canonicalization, then enforce that choice at every boundary.

  3. Free-text scope matching has both false negatives and false positives.

    • Still accepted as unbounded: allfiles, everydirectory, entiredisk, wholefilesystem, and “Collect every log on the system.”
    • Incorrectly rejected despite requesting one exact catalog artifact: “Collect the full disk imaging Task Sequence log.”, “Confirm the whole-disk encryption status recorded in PolicyAgent.log.”, “Confirm the system-wide assignment recorded in PolicyAgent.log.”, “Confirm recursive retry behavior recorded in PolicyAgent.log.”, and “Confirm all files were downloaded, as recorded in PolicyAgent.log.”

    The guard must distinguish requested collection scope from words describing the bounded workflow/evidence. Add both negative equivalence rows and positive disk-imaging/workflow controls so tightening one side cannot regress the other.

Independent results on this exact SHA:

  • committed focused finding tests: 46 passed
  • temporary adversarial replay: 5 passed / 6 failed
  • confirmed green in the replay: canonical post-build collection serialization, conflicting range rejection across build/validate/serde, standalone/finding/gap/request role shadows plus canonical future role, all recursive unknown-wire insertions, and terminal/key/confidence/all-six-gap rules.

CodeRabbit performed a substantive review of the prior exact 310cee5 and found the rooted-path P1, which 670fe2d fixes. The exact-670fe2d CodeRabbit request is pending; the authenticated local CLI was also attempted but hit the service's recoverable rate limit. A green status alone is not being treated as substantive approval.

Please commit focused red/green regressions for these cases and request another exact-SHA CodeRabbit and independent review. This review does not authorize merge, ready-for-review, or issue closure.

@adamgell

Copy link
Copy Markdown
Owner Author

Ownership claim for the blocked exact-head correction: /root/review_342_restacked is the sole foundation-contract owner for PR #353 / #318 in /Users/Adam.Gell/repo/cmtraceopen/.worktrees/sccm-318-findings on codex/sccm-318-conservative-findings. I am reproducing the independent review's 11 dynamic cases test-first from exact head 670fe2d5bf84f2aae3b8dd78a5895a74501e3b71. No other agent should edit this worktree or shared SCCM model/finding contracts during this correction. PR remains draft; no merge or issue closure is authorized.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a substantive review of exact range 25b37333affde22b4ef8a19f4a5f3d89c082b599..117cec9a02fe0f67ae5875e6e7e03bfadc23b3d6.

Disposition of independent blocker review 4824495987: accepted and fixed test-first. Permanent focused RED was 40 passed / 11 failed; the same suite is now 51/51 green. Please focus on:

  • strict standalone/finding SccmPhase::Unknown invariants;
  • strict non-trimming opaque IDs across builder/direct validate/Serialize/Deserialize;
  • original raw request cardinality validation before serialization deduplication;
  • context-aware rejection of actual unbounded collection while preserving the five bounded narrative controls;
  • preservation of rooted-path, role, key, evidence, citation, confidence, and deterministic-ordering invariants.

The authenticated local CLI was also attempted on the final uncommitted delta and returned a recoverable 13-minute rate limit; that is not being represented as approval. Keep PR #353 draft pending this exact-head review and a different independent API rereview.

@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 API/security review — BLOCKED

Reviewed exact range 25b37333affde22b4ef8a19f4a5f3d89c082b599..a515f33858be599759dd84e02353bc1f92f4a16f in a fresh detached read-only worktree. The PR head, fetched remote ref, and checkout all resolve to a515f33858be599759dd84e02353bc1f92f4a16f; the review worktree is clean. This is not approval. Keep PR #353 draft and open.

[P1] Active has/have confirmation forms still authorize broad targets

has_passive_unbounded_confirmation_request() only enters its broad-target check for tokens recognized by is_passive_auxiliary(). However, had, has, and have are accepted evidence predicates but are not passive auxiliaries. The later broad-scope check also treats files as bounded merely because a state-observation token and catalog identity occur elsewhere in the clause.

A disposable external consumer probe reproduced four active forms as accepted by the builder, direct validate(), validating serialization, and strict deserialization — 16/16 unsafe accepts:

  • Confirm PolicyAgent.log status has all files provided.
  • Confirm PolicyAgent.log status has every file provided.
  • Confirm all files have provided status in PolicyAgent.log.
  • Confirm Smsts.log imaging status has the full disk provided.

These are the same broad-target requirement hidden behind accepted active evidence vocabulary. Add permanent four-boundary regressions and make the quantified broad-target rule independent of passive versus active auxiliary selection. Preserve the existing bounded observations such as Confirm all files were downloaded, as recorded in PolicyAgent.log.

[P1] Public evidence redaction remains message-path-specific and field-incomplete

The direct Windows identity matcher drops a match whenever the preceding byte is a path separator, and the fallback path matcher only recognizes the literal Users directory. The sensitive-label grammar also omits common structured Windows identity fields. A deterministic normalized-evidence probe showed the raw identity in both SccmEvidence.message and serialized JSON for all six cases — 12 public-surface leaks:

  • C:\Profiles\LAB\SyntheticUser\profile.dat
  • \\server\home\LAB\SyntheticUser\cache
  • C:\Profiles\.\LocalUser\profile.dat
  • {"domain":"LAB","accountName":"SyntheticJsonUser"}
  • {"domain":"LAB","samAccountName":"SyntheticSamUser"}
  • localUser=LocalStructuredUser

UPN redaction remained green, and the committed safe path/code controls remained green. Separately, SccmRawEvidenceSnapshot::export() copies component and ccm_source_file verbatim. A normalized CCM record with component="LAB\ComponentUser" and file="LAB\FileUser" exposed both raw identities in public SccmEvidence JSON. The spine contract says raw user names or user context must never reach public evidence; projection cannot be limited to the message field or one directory spelling. Add deterministic evidence-object and JSON regressions while preserving genuinely safe path fragments and diagnostic codes.

[P1] Coverage-only states still become diagnostic claims

SccmFinding::validate() accepts any nonempty coverage-gap vector as a substitute for evidence, then applies terminal/corroboration guards only to High ConfirmedFailure and High LikelyContributor. A disposable four-boundary probe built coverage-only Symptom/High, LikelyContributor/Moderate, and ConfirmedFailure/Moderate findings from AccessDenied alone — 12/12 builder/validate/serialize/deserialize accepts.

That directly violates the program constraint that absent, access-denied, capped, skipped, unsupported, malformed, or partial sources are coverage states, not proof of a symptom, contributor, or failure. Reserve coverage-only output for InsufficientEvidence with its bounded next-artifact request, or require cited evidence for every diagnostic claim class.

Verified closures, gates, and corroboration

  • The prior key/profile blocker is closed at this SHA: five missing/unknown/experimental/forged/malformed Strong or Exact profile cases were rejected at all four public finding boundaries. The registered stable-profile set remains empty and fail-closed; conservative Low controls remain green.
  • Committed suites are green: finding contracts 71/71, complete spine 133/133, full parser 726/726.
  • Repository-default strict Clippy passed. Rust 1.88 strict Clippy reports the same 59 unrelated uninlined_format_args baseline findings at exact base and head, with none in the five changed files.
  • Rust 1.88 wasm32 check passed; TypeScript 7.0.2 tsc --noEmit passed; scoped Rust 1.88 formatting and base/head plus incremental git diff --check passed.
  • Full-workspace Rust 1.88 formatting still reports the same unrelated 17-file baseline outside this range.
  • No dependency change, native/Windows/Tauri/network/database/process I/O, ParserKind::Sccm, or public LogEntry change was found.
  • Hosted CodeRabbit completed a substantive exact-head review with no blocker: #353 (comment). The authenticated local CodeRabbit 0.7.1 run returned status-only output, so it is not claimed as another approval. The reproduced failures above supersede the hosted no-blocker result.

Do not mark ready, merge, resolve ownership/history threads, close #318, or unblock downstream production reducers/correlation. Unblock after permanent tests and corrections for all three contract classes, every prescribed gate, fresh substantive CodeRabbit on the corrected exact SHA, and a different independent exact-head PASS.

@adamgell

Copy link
Copy Markdown
Owner Author

Exact-head review-fix round — implemented, still draft

The independent API/security review on a515f33858be599759dd84e02353bc1f92f4a16f reproduced three P1 contract gaps. Commit 5c0fda213686fd9ddb12a29723c601f675836567 closes them test-first:

  • Active broad Confirm forms: the four exact has/have probes were accepted by builder, direct validation, validating serialization, and deserialization (16/16 RED). had/has/have now participate in the same broad-target auxiliary guard; all four boundaries reject the probes, while Confirm all files were downloaded, as recorded in PolicyAgent.log. remains accepted.
  • Public identity projection: exact profile/home/local paths, accountName, samAccountName, localUser, CCM component, and CCM file values leaked in normalized public evidence JSON (RED). The deterministic v1 projection now recognizes the structured labels and common profile roots, handles repeated separators, and projects message, component, and ccmSourceFile without mutating raw internal snapshots (GREEN).
  • Coverage-only claims: AccessDenied alone substantiated Symptom/High, LikelyContributor/Moderate, ConfirmedFailure/Moderate, and BlockedOrDeferred/Low across all four public boundaries (16/16 RED). Every non-InsufficientEvidence finding now requires cited evidence; coverage-only remains representable only as InsufficientEvidence with a bounded next-artifact request (GREEN).

Fresh verification on exact head 5c0fda213686fd9ddb12a29723c601f675836567:

  • three exact focused regressions — 3 passed, 0 failed
  • cargo +1.88.0 test --locked -p cmtraceopen-parser --test sccm_spine_contract135 passed, 0 failed
  • cargo +1.88.0 test --locked -p cmtraceopen-parser728 passed, 0 failed
  • cargo clippy -p cmtraceopen-parser --all-targets -- -D warnings — passed
  • cargo +1.88.0 check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown — passed
  • npx tsc --noEmit — passed
  • Rust 1.88 scoped rustfmt --check on the three owned files — passed
  • git diff --check and staged diff check — passed

The plan-prescribed repository-wide cargo fmt --check --all still reports the same unrelated 17-file baseline; none of the three owned files appear in that output. No dependency, native I/O, Windows/Tauri/network/database/process, ParserKind, CCM grammar, or public LogEntry change is included.

Remaining review blockers: a fresh substantive hosted CodeRabbit review and a different independent exact-head review of 5c0fda2. Do not mark ready, merge, close #318, or use this slice as live Windows acceptance yet.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a fresh substantive review of exact head 5c0fda213686fd9ddb12a29723c601f675836567 against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

This head supersedes the prior no-blocker review on a515f338: a later independent exact-head review reproduced three P1s. Focus on whether every Confirm broad target is rejected regardless of had/has/have wording while bounded observed download state remains valid; whether path and structured identities are removed from message, component, and ccmSourceFile without unsafe path/code false positives; and whether coverage-only states can construct only InsufficientEvidence rather than any diagnostic claim class. Also re-check recursive wire validation, deterministic normalization, pure Rust/wasm32 scope, no ParserKind::Sccm, and public LogEntry compatibility.

Please anchor the review to exact SHA 5c0fda213686fd9ddb12a29723c601f675836567; a skipped draft status or stale review is not approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="25b37333affde22b4ef8a19f4a5f3d89c082b599"
head="5c0fda213686fd9ddb12a29723c601f675836567"
prior="a515f33858be599759dd84e02353bc1f92f4a16f"

echo "== Exact revision objects =="
printf 'checked-out: '; git rev-parse HEAD
printf 'base: '; git cat-file -t "$base"
printf 'head: '; git cat-file -t "$head"

echo "== Changed paths, stat, and whitespace =="
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
git diff --check "$base" "$head"

echo "== Latest correction delta =="
git diff --no-ext-diff "$prior" "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/evidence.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

echo "== Declaration map for the exact head =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" > /tmp/findings-5c0fda2.rs
ast-grep outline /tmp/findings-5c0fda2.rs --items all --type struct,enum,impl,function \
  --match 'Sccm|Finding|Artifact|Confirm|Evidence|Coverage|Correlation|Confidence|Phase|Terminal' || true

echo "== Finding contract, validation, serde, and normalization =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '150,760p; 1940,2300p'

echo "== Artifact request confirmation grammar and scope controls =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '700,1945p'

echo "== Evidence projection and redaction implementation =="
git show "$head:crates/cmtraceopen-parser/src/sccm/evidence.rs" | cat -n | \
  sed -n '1,340p'

echo "== Exact regression and adjacent control tests =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | \
  rg -n -A180 -B28 \
  'all files|full disk|had|has|have|downloaded|Confirm|redact|profile|accountName|samAccountName|localUser|component|ccmSourceFile|coverage.only|InsufficientEvidence|AccessDenied|serialize|deserializ|determin' || true

echo "== Wire strictness, coverage validation, and projection call sites =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | \
  rg -n -C5 \
  'deny_unknown_fields|Wire|Deserialize|Serialize|coverage|InsufficientEvidence|evidence\.is_empty|project|normalize|sort|dedup'
git show "$head:crates/cmtraceopen-parser/src/sccm/evidence.rs" | \
  rg -n -C5 \
  'project|redact|component|ccm|account|profile|identity|message'

echo "== Models, keys, catalog identities, and exported SCCM module =="
git show "$head:crates/cmtraceopen-parser/src/sccm/models.rs" | cat -n | \
  rg -n -A115 -B12 'SccmCorrelationKey|SccmKeyConfidence|SccmEvidenceRef|SccmRole|Serialize|Deserialize' || true
git show "$head:crates/cmtraceopen-parser/src/sccm/keys.rs" | \
  rg -n -C5 'normalize|profile|stable|confidence|SccmKeyConfidence' || true
git show "$head:crates/cmtraceopen-parser/src/sccm/catalog.rs" | \
  rg -n -C3 'logical_name:|basename:|MP_|smsts' || true
git show "$head:crates/cmtraceopen-parser/src/sccm/mod.rs" | cat -n

echo "== Scope and public compatibility delta =="
git diff --no-ext-diff "$base" "$head" -- Cargo.toml Cargo.lock
git diff --no-ext-diff "$base" "$head" -- crates/cmtraceopen-parser/src | \
  rg -n -C3 '^\+.*(LogEntry|ParserKind|std::fs|std::net|std::process|tauri|windows|winapi|tokio|reqwest|unsafe)|^\-.*(LogEntry|ParserKind)' || true
git diff --name-only "$base" "$head" | sort

Length of output: 101963


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head="5c0fda213686fd9ddb12a29723c601f675836567"

echo "== Finding validation class and confidence rules =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '400,700p; 1960,2140p'

echo "== Complete Confirm grammar and broad-target checks =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '1120,1625p'

echo "== Request tokenization and suffix/actionless controls =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '820,1125p; 1625,1960p'

echo "== Exact latest regression diff =="
git diff --no-ext-diff a515f33858be599759dd84e02353bc1f92f4a16f "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/src/sccm/evidence.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

echo "== Focused broad-Confirm and coverage-only test bodies =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | \
  rg -n -A150 -B30 \
  'active.*broad|broad.*confirm|had|has|have|all files|full disk|coverage.only|coverage.*claim|AccessDenied|InsufficientEvidence|MissingEvidenceOrCoverageGap'

echo "== Focused projection/redaction test bodies =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | \
  rg -n -A180 -B30 \
  'accountName|samAccountName|localUser|ccmSourceFile|component|profile|home|DOMAIN|redact|safe path|diagnostic code|raw snapshot'

echo "== Every parser kind and LogEntry change in the exact range =="
git diff --no-ext-diff 25b37333affde22b4ef8a19f4a5f3d89c082b599 "$head" -- \
  crates/cmtraceopen-parser/src crates/cmtraceopen-parser/tests | \
  rg -n -C4 'ParserKind|LogEntry|std::fs|std::net|std::process|tauri|windows|winapi|tokio|reqwest|unsafe' || true

echo "== Test names near the new contract coverage =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | \
  rg -n '^\s*fn (finding_|sccm_|public_|.*redact|.*coverage|.*confirm)' || true

Length of output: 108487


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head="5c0fda213686fd9ddb12a29723c601f675836567"

echo "== Passive Confirm target guard =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | \
  rg -n -A120 -B25 \
  'fn has_passive_unbounded_confirmation_request|fn confirmation_clause_is_non_authorizing|fn is_confirmation_|had|has|have'

echo "== Passive Confirm regression matrix =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | \
  sed -n '2285,2355p'

echo "== Latest active-verb correction =="
git diff --no-ext-diff a515f33858be599759dd84e02353bc1f92f4a16f "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs | \
  rg -n -A100 -B20 'had|has|have|all files|full disk|Confirm'

echo "== Structured-label redaction and range handling =="
git show "$head:crates/cmtraceopen-parser/src/sccm/evidence.rs" | \
  sed -n '10,195p'
git show "$head:crates/cmtraceopen-parser/src/sccm/evidence.rs" | \
  rg -n -A80 -B12 'fn sensitive_value_end|fn redact_sensitive_segments|fn redact_windows_identities'

echo "== Public structured-surface regression =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | \
  sed -n '4750,4850p'

echo "== Recursive wire rejection and deterministic finding output tests =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | \
  sed -n '3190,3418p'

Length of output: 115626


@adamgell I completed a fresh static review of exact head 5c0fda213686fd9ddb12a29723c601f675836567 against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

Finding

  • [P1] Reject broad targets after active had/has/have without a trailing participlehas_passive_unbounded_confirmation_request() at Line 1268 detects a broad target in the complete Confirm body. However, Line 1290 returns rejection for had, has, or have only when a later token is one of archived, captured, collected, copied, exported, gathered, included, provided, or required. Therefore, Confirm PolicyAgent.log status has all files. passes validation. It has the requested identity and a status observation. The confirmation vocabulary permits has, all, and files. The broad-target helper returns false because no listed participle follows has. The same issue applies to forms such as Confirm Smsts.log imaging status has the full disk. Reject every unbound broad collection target when any auxiliary, including had, has, or have, occurs in the confirmation body. Add builder, direct SccmFinding::validate(), serialization, and deserialization cases without provided or another trailing participle.

I also confirmed these controls:

  • The recursive finding wire rejects unknown fields at all nested insertion points.
  • Finding serialization validates the mutable finding and the normalized copy.
  • Finding deserialization normalizes and validates before it returns.
  • Coverage-only state can construct only SccmFindingClass::InsufficientEvidence. Non-InsufficientEvidence classes require cited evidence.
  • The public evidence projection applies identity redaction to message, component, and ccmSourceFile.
  • The exact diff does not add ParserKind::Sccm.
  • The exact diff does not change public LogEntry.
  • The inspected range remains parser-only. I found no dependency, native I/O, Windows/Tauri, network, process, or wasm32-specific addition.

Keep #353 in draft until this issue is corrected and receives a fresh exact-head review.

You are interacting with an AI system.

@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 API/security review of exact range 25b37333affde22b4ef8a19f4a5f3d89c082b599..5c0fda213686fd9ddb12a29723c601f675836567: BLOCKED. The remote PR head was re-read and matched this SHA before submission.

[P1] Auxiliary-led broad targets still pass every public boundary

has_passive_unbounded_confirmation_request() detects the broad target at crates/cmtraceopen-parser/src/sccm/findings.rs:1280-1285, but the return predicate at Lines 1290-1304 rejects had / has / have and the other non-modal auxiliaries only when a later token is one of the listed collection participles. A confirmation with the requested identity and a state observation can therefore authorize the unbound broad target directly after the auxiliary.

A disposable external-consumer probe reproduced 48 improper acceptances: 12 variants x builder, direct SccmFinding::validate(), validating serializer, and strict deserializer. The accepted variants include:

  • Confirm PolicyAgent.log status has all files.
  • the same shape with had, have, are, be, been, being, is, was, and were
  • Confirm Smsts.log imaging status has the full disk.
  • Confirm Smsts.log imaging status is the full disk.

Three bounded controls remained accepted, including Confirm all files were downloaded, as recorded in PolicyAgent.log. The correction needs to reject auxiliary-led unbound broad targets at all four boundaries without removing that bounded observation. Add a permanent four-boundary regression matrix for the no-trailing-participle forms.

CodeRabbit independently reported the same exact-head P1 in a substantive review: #353 (comment). The older formal CodeRabbit approval is stale and does not apply to this SHA.

Verification at the exact head:

  • focused finding contract: 72 passed
  • complete spine contract: 135 passed
  • full parser crate: passed
  • strict parser Clippy: passed
  • wasm32-unknown-unknown check: passed
  • TypeScript tsc --noEmit: passed with the existing dependency tree exposed to the detached worktree
  • scoped rustfmt --check for all five changed Rust files: passed
  • repository cargo fmt --check --all: same 17-file / 24-hunk unrelated baseline at base and head
  • git diff --check: passed

The remaining reviewed controls are intact: coverage-only findings are restricted to InsufficientEvidence; invalid and unregistered profiled keys fail closed; message, path-adjacent, structured, component, and ccmSourceFile redaction tests pass with safe controls; mutable finding serialization normalizes and validates; recursive deserialization remains strict; no dependency, ParserKind::Sccm, public LogEntry, native I/O, Windows/Tauri, network, process, or wasm-specific implementation delta was introduced.

Keep PR #353 draft. This review does not authorize ready-for-review, merge, or issue closure.

@adamgell

Copy link
Copy Markdown
Owner Author

#318 review correction — exact head 889eaa1da73b94b6d9cc7de76465fe8997ff9626

Scope is limited to the conservative finding request validator and its public-boundary contract tests.

RED evidence

Against exact parent 5c0fda213686fd9ddb12a29723c601f675836567, the expanded passive-confirmation test failed because 11 auxiliary certainty claims were accepted at all four public boundaries: builder, direct validate, serializer, and deserializer. That produced 44 observed escapes. The matrix includes:

  • Confirm PolicyAgent.log status has all files.
  • Confirm Smsts.log imaging status has the full disk.
  • bounded variants for had/has/have/are/be/been/being/is/was/were

Smallest behavior change

A confirmation clause now fails closed when an auxiliary is followed by an uncited broad file or disk target. Existing exact-artifact observations with a bounded state predicate remain accepted.

Fixture and control matrix:

  • 23 passive or broad-scope confirmation rejects, including the 11 new no-participle cases
  • 10 bounded auxiliary confirmation controls
  • existing bounded named-artifact controls, including content-file download observations

GREEN verification

  • cargo test -p cmtraceopen-parser --test sccm_spine_contract finding_review_passive_unbounded_confirmation_requests_fail_at_every_public_boundary -- --exact — 1 passed
  • cargo test -p cmtraceopen-parser --test sccm_spine_contract finding_review_bounded_auxiliary_confirmations_pass_at_every_public_boundary -- --exact — 1 passed
  • cargo test -p cmtraceopen-parser --test sccm_spine_contract finding_ — 73 passed
  • cargo test -p cmtraceopen-parser --test sccm_spine_contract — 136 passed
  • cargo test -p cmtraceopen-parser — passed
  • cargo clippy -p cmtraceopen-parser --all-targets -- -D warnings — passed
  • cargo check -p cmtraceopen-parser --target wasm32-unknown-unknown — passed
  • npx tsc --noEmit — passed
  • rustfmt --edition 2021 --check crates/cmtraceopen-parser/src/sccm/findings.rs crates/cmtraceopen-parser/tests/sccm_spine_contract.rs — passed
  • git diff --check — passed

Repository-wide cargo fmt --check --all still reports the existing 17 unrelated baseline files; neither #318-owned changed file is listed.

Commit: 889eaa1da73b94b6d9cc7de76465fe8997ff9626

Dependency/review state: PR stays draft. Fresh substantive CodeRabbit review and a different independent exact-head review are required before this shared interface can be marked ready or merged.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a fresh substantive review of exact head 889eaa1da73b94b6d9cc7de76465fe8997ff9626.

Focus on whether auxiliary certainty claims can still smuggle an unbounded file, disk, drive, directory, or filesystem request across builder, direct validation, serialization, or deserialization, including word-order and punctuation variants. Also verify that bounded exact-artifact state observations remain accepted.

This request supersedes reviews of earlier heads. A status-only, skipped, rate-limited, or stale response will not be treated as approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="25b37333affde22b4ef8a19f4a5f3d89c082b599"
head="889eaa1da73b94b6d9cc7de76465fe8997ff9626"
prior="5c0fda213686fd9ddb12a29723c601f675836567"

printf 'checked-out: '; git rev-parse HEAD
printf 'base object: '; git cat-file -t "$base"
printf 'head object: '; git cat-file -t "$head"

echo "== Exact changed paths and whitespace =="
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
git diff --check "$base" "$head"

echo "== Latest correction delta =="
git diff --no-ext-diff "$prior" "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

echo "== Exact-head SCCM contract outline =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" > /tmp/findings-889eaa1.rs
ast-grep outline /tmp/findings-889eaa1.rs --items all --type struct,enum,impl,function \
  --match 'Sccm|Finding|Artifact|Confirm|Evidence|Coverage|Correlation|Confidence|Phase|Terminal' || true

echo "== Validation and public serde paths =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '150,760p; 1940,2300p'

echo "== Confirm grammar, target checks, clause splitting, and scope vocabulary =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '700,1945p'

echo "== Passive/broad confirmation matrices and bounded controls =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | \
  rg -n -A180 -B30 \
  'passive.*unbounded|bounded.*auxiliary|all files|full disk|drive|directory|filesystem|had|has|have|are|be|been|being|is|was|were|Confirm|serialize|deserializ|direct.validation' || true

echo "== Exact call paths and parser/public-surface scope =="
git grep -n -E \
  'validate_artifact_request|reason_scope_is_within_catalog_artifact|confirmation_clause_is_non_authorizing|has_passive_unbounded_confirmation_request|SccmFindingBuilder::new|impl (Serialize|Deserialize) for SccmFinding|from_(str|slice|value).*SccmFinding|to_(string|value).*SccmFinding' \
  "$head" -- crates/cmtraceopen-parser || true
git diff --no-ext-diff "$base" "$head" -- Cargo.toml Cargo.lock
git diff --no-ext-diff "$base" "$head" -- crates/cmtraceopen-parser/src | \
  rg -n -C3 '^\+.*(LogEntry|ParserKind|std::fs|std::net|std::process|tauri|windows|winapi|tokio|reqwest|unsafe)|^\-.*(LogEntry|ParserKind)' || true

Length of output: 118569


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head="889eaa1da73b94b6d9cc7de76465fe8997ff9626"

echo "== Dispatch and confirmation helpers =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '810,900p; 1160,1365p'

echo "== Broad-target and confirmation vocabulary helpers =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '1365,1545p; 1690,1945p'

echo "== Tokenization and identity-range behavior =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '1545,1695p; 2020,2145p'

echo "== Four-boundary test helper and passive/bounded matrices =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | \
  sed -n '450,590p; 2340,2455p'

echo "== Exact latest test delta =="
git diff --no-ext-diff 5c0fda213686fd9ddb12a29723c601f675836567 "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

echo "== Broad-target terminology and all Confirm regression literals =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | \
  rg -n -C5 'broad|all.*files|full.*disk|drive|directory|filesystem|auxiliar|certainty|passive'
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | \
  rg -n -C5 'Confirm .*?(all files|full disk|drive|directory|filesystem)|bounded auxiliary|passive unbounded'

Length of output: 74482


@adamgell I completed a fresh static review of exact head 889eaa1da73b94b6d9cc7de76465fe8997ff9626 against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

Finding

  • [P1] Reject a broad target that precedes an auxiliary without a trailing participlehas_passive_unbounded_confirmation_request() detects the broad target in the full confirmation body. However, for had, has, have, are, be, been, being, is, was, and were, it returns rejection only when the broad target occurs after the auxiliary or a listed participle occurs after it. A payload such as Confirm all files have status in PolicyAgent.log. passes. all files is before have, so broad_target_follows_auxiliary is false. The predicate has no listed participle. The confirmation vocabulary allows every token. The exact PolicyAgent.log identity and status satisfy the per-token exception at Lines 1251-1255. This accepts an unbounded target through word order. Reject an uncited broad target anywhere in a Confirm body when any auxiliary is present, unless the complete form is an explicitly bounded state observation. Add this payload, equivalent disk forms, and punctuation variants at builder, direct SccmFinding::validate(), validating serialization, and strict deserialization boundaries.

I also confirmed the following:

  • The latest matrix covers the listed auxiliary forms across all four public boundaries.
  • Builder validation, direct validation, serialization, and deserialization share the artifact-request validation path.
  • The narrow bounded controls remain present for exact-artifact state observations.
  • The exact range remains parser-only. I found no dependency, native I/O, Windows/Tauri, network, process, ParserKind, or public LogEntry change.

Keep PR #353 in draft until this blocker is corrected and receives a fresh exact-head review.

You are interacting with an AI system.

@adamgell

Copy link
Copy Markdown
Owner Author

Exact-head CodeRabbit P1 corrected — head 29d3bc54ae9eb68aa8cdef6588adaccaadb8de7d

Addressed the word-order bypass reported in #353 (comment).

RED evidence at prior head 889eaa1d

Thirteen inverse-order and punctuation cases were accepted at builder, direct validation, serializer, and deserializer boundaries, for 52 observed escapes. The new cases include:

  • Confirm all files have status in PolicyAgent.log.
  • Confirm the full disk has imaging status in Smsts.log.
  • broad targets preceding had/has/have/are/be/been/being/is/was/were
  • comma variants for both file and disk forms

Smallest correction

Any confirmation containing an uncited broad file or disk target plus an auxiliary now fails closed unless the complete form is the already supported exact-artifact bounded download-state observation. Unsafe collection participles and modal certainty forms remain rejected.

The matrix now contains 36 passive or broad-scope rejects, 10 bounded auxiliary controls, and the existing bounded named-artifact controls.

Fresh verification at 29d3bc54

  • focused inverse-order test — 1 passed
  • bounded named-artifact control — 1 passed
  • bounded auxiliary control — 1 passed
  • cargo test -p cmtraceopen-parser --test sccm_spine_contract finding_ — 73 passed
  • cargo test -p cmtraceopen-parser --test sccm_spine_contract — 136 passed
  • cargo test -p cmtraceopen-parser — passed
  • cargo clippy -p cmtraceopen-parser --all-targets -- -D warnings — passed
  • cargo check -p cmtraceopen-parser --target wasm32-unknown-unknown — passed
  • npx tsc --noEmit — passed
  • changed-file rustfmt --check — passed
  • git diff --check — passed

Repository-wide cargo fmt --check --all continues to report only the same 17 unrelated baseline files; neither owned file is listed.

PR #353 remains draft. A fresh substantive exact-head CodeRabbit review and a different independent review are still required before readiness or merge.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a fresh substantive review of exact head 29d3bc54ae9eb68aa8cdef6588adaccaadb8de7d.

Re-test broad file and disk targets both before and after every auxiliary, including punctuation variants, at builder, direct validation, validating serialization, and strict deserialization boundaries. Verify that only explicit bounded exact-artifact state observations remain accepted.

This request supersedes all earlier-head reviews. A skipped, status-only, stale, or rate-limited response is not approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="25b37333affde22b4ef8a19f4a5f3d89c082b599"
head="29d3bc54ae9eb68aa8cdef6588adaccaadb8de7d"
prior="889eaa1da73b94b6d9cc7de76465fe8997ff9626"

echo "== Exact revisions =="
printf 'checked-out: '; git rev-parse HEAD
printf 'base: '; git cat-file -t "$base"
printf 'head: '; git cat-file -t "$head"

echo "== Range scope and whitespace =="
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
git diff --check "$base" "$head"

echo "== Latest correction delta =="
git diff --no-ext-diff "$prior" "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

echo "== Findings declaration map =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" > /tmp/findings-29d3bc54.rs
ast-grep outline /tmp/findings-29d3bc54.rs --items all --type struct,enum,impl,function \
  --match 'Sccm|Finding|Artifact|Confirm|Evidence|Coverage|Correlation|Confidence|Phase|Terminal' || true

echo "== Public validation and serde paths =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '150,760p; 1940,2325p'

echo "== Artifact validation, Confirm grammar, and broad target checks =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '700,1960p'

echo "== Tokenization and all confirmation helper definitions/callers =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | \
  rg -n -C6 \
  'confirmation_clause_is_non_authorizing|has_passive_unbounded_confirmation_request|is_.*auxiliary|is_broad|all.*files|full.*disk|drive|directory|filesystem|request_clauses|tokenize_request_reason|is_collection_action'

echo "== Passive broad-target and bounded-control matrices =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | \
  rg -n -A210 -B35 \
  'passive.*unbounded|inverse.order|bounded.*auxiliary|bounded.*named|all files|full disk|drive|directory|filesystem|had|has|have|are|be|been|being|is|was|were|Confirm|serialize|deserializ|direct.validation' || true

echo "== Four-boundary helper implementation and exact test bodies =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | \
  sed -n '440,610p; 2320,2515p'

echo "== Parser/platform/public surface delta =="
git diff --no-ext-diff "$base" "$head" -- Cargo.toml Cargo.lock
git diff --no-ext-diff "$base" "$head" -- crates/cmtraceopen-parser/src | \
  rg -n -C3 '^\+.*(LogEntry|ParserKind|std::fs|std::net|std::process|tauri|windows|winapi|tokio|reqwest|unsafe)|^\-.*(LogEntry|ParserKind)' || true
git diff --name-only "$base" "$head" | sort

Length of output: 117887


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head="29d3bc54ae9eb68aa8cdef6588adaccaadb8de7d"
prior="889eaa1da73b94b6d9cc7de76465fe8997ff9626"

echo "== Latest correction only =="
git diff --no-ext-diff "$prior" "$head" -- \
  crates/cmtraceopen-parser/src/sccm/findings.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

echo "== Exact confirmation helper implementation =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | nl -ba | \
  sed -n '1160,1435p'

echo "== Exact broad-target and auxiliary vocabularies =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | nl -ba | \
  sed -n '1435,1595p; 1690,1815p'

echo "== Exact request validation dispatch and serde validation sequencing =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | nl -ba | \
  sed -n '190,460p; 780,915p'

echo "== Complete passive-reject and bounded-control constants =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | nl -ba | \
  sed -n '320,465p'

echo "== Exact four-boundary regression test bodies =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | nl -ba | \
  sed -n '2280,2465p'

echo "== Punctuation handling and complete test reason corpus =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | \
  rg -n -A45 -B10 'fn request_clauses|fn tokenize_request_reason|strong.punctuation|split'
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | \
  rg -n -C3 'Confirm .*?(all files|full disk|drive|directory|filesystem)|all files.*Confirm|full disk.*Confirm|,.*(has|have|had|are|be|been|being|is|was|were)' || true

Length of output: 5047


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head="29d3bc54ae9eb68aa8cdef6588adaccaadb8de7d"

echo "== Confirmation helper implementation =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '1160,1435p'

echo "== Broad-target, auxiliary, and identity helper definitions =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '1435,1595p; 1690,1815p'

echo "== Artifact request dispatch and finding serde validation paths =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | cat -n | \
  sed -n '190,460p; 780,915p'

echo "== Passive-reject and bounded-control constants =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | \
  sed -n '320,465p'

echo "== Four-boundary test bodies =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | cat -n | \
  sed -n '2280,2465p'

echo "== Clause splitting and tokenization =="
git show "$head:crates/cmtraceopen-parser/src/sccm/findings.rs" | \
  rg -n -A55 -B12 'fn request_clauses|fn tokenize_request_reason|fn reason_scope_is_within_catalog_artifact'

echo "== All confirmation broad-target literals =="
git show "$head:crates/cmtraceopen-parser/tests/sccm_spine_contract.rs" | \
  rg -n -C2 'Confirm .*?(all files|every file|full disk|whole disk|drive|directory|filesystem)|all files.*Confirm|full disk.*Confirm' || true

Length of output: 67931


@adamgell I completed a fresh static review of exact head 29d3bc54ae9eb68aa8cdef6588adaccaadb8de7d against exact base 25b37333affde22b4ef8a19f4a5f3d89c082b599.

No blocking findings.

Confirmed in this pass:

  • has_passive_unbounded_confirmation_request() evaluates the complete Confirm body.
  • A broad target before or after an auxiliary now rejects by default.
  • The rejection covers had, has, have, are, be, been, being, is, was, and were.
  • The regression matrix contains 36 broad-target cases.
  • The matrix includes broad file and disk targets in normal and inverse word order.
  • The matrix includes comma punctuation variants.
  • The matrix tests builder construction, direct SccmFinding::validate(), validating serialization, and strict deserialization.
  • The only allowed exception is the identity-bound download-state observation. It requires an exact catalog identity, a broad target before the auxiliary, and downloaded in the predicate.
  • Existing bounded controls retain valid exact-artifact observations such as Confirm PolicyAgent.log files were downloaded. and Confirm all files were downloaded, as recorded in PolicyAgent.log..
  • Confirmation clauses remain independently evaluated. A separate clause cannot inherit the catalog identity from another clause.
  • Custom serialization validates the mutable finding, normalizes it, and validates the normalized result.
  • Custom deserialization uses strict nested wires, normalizes the finding, and validates it before return.
  • The inspected range does not change LogEntry, ParserKind, dependencies, or the pure Rust and wasm32 scope.

PR #353 should remain draft pending the separate independent exact-head review, as requested.

You are interacting with an AI system.

@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 API/security review — PASS

Reviewed exact range 25b37333affde22b4ef8a19f4a5f3d89c082b599..29d3bc54ae9eb68aa8cdef6588adaccaadb8de7d in a new clean detached worktree. The remote PR head and base were re-read immediately before submission and match those SHAs. No blocking finding remains.

Certainty-claim closure

  • The committed 36-case passive/inverse broad-target matrix rejects all 144 builder, direct SccmFinding::validate(), validating serializer, and strict deserializer boundaries.
  • The committed 10-case bounded auxiliary matrix accepts all 40 corresponding boundaries.
  • A disposable independent matrix added 16 new unsafe file/disk variants across auxiliary-before-broad and broad-before-auxiliary order, with colon, comma, parentheses, and em-dash forms. All 64 public-boundary attempts were rejected.
  • The same probe added eight bounded controls for negative state observations and exact-artifact download state. All 32 public-boundary attempts were accepted. This includes identity-before/after-auxiliary order and DataTransferService/PolicyAgent exact artifact forms.
  • The disposable probe was removed; the exact-head review worktree is clean.

Earlier blocker audit

  • Privacy/redaction tests cover message, component, ccmSourceFile, path-adjacent identities, structured account fields, UPN/local identities, credentials/tokens, deterministic projection, and raw context omission. The focused evidence filter passed 30 tests. A local CodeRabbit minor noted the trailing \b on Windows identity patterns; a disposable $/- suffix probe confirmed the account names remain redacted on every public string surface. Its proposed negative lookahead is unsupported by Rust regex and no raw identity leak was reproduced, so this is not a blocker.
  • Coverage-only AccessDenied remains valid only for InsufficientEvidence; Symptom, LikelyContributor, ConfirmedFailure, and BlockedOrDeferred were rejected at builder, validate, serialize, and deserialize boundaries.
  • High ConfirmedFailure still requires cited terminal evidence because the parser-owned stable profile registry is empty. Forged, unknown, unregistered, uncited, duplicate, low, same-time, and keyless paths fail closed. High LikelyContributor remains capped without terminal evidence.
  • Recursive wire strictness, canonical role/phase handling, evidence identity/range consistency, deterministic sort/dedup, bounded catalog requests, and validating serialization/deserialization remain intact.
  • The exact range changes only five SCCM parser/test files. There is no dependency change, ParserKind::Sccm, public LogEntry change, native/Windows/Tauri/network/database/process I/O, or live acceptance claim.

Fresh verification

  • finding target: 73 passed
  • committed spine: 136 passed
  • full parser crate: 729 passed
  • repository-default strict Clippy: passed
  • Rust 1.88 wasm32 check: passed
  • TypeScript 7.0.2 tsc --noEmit: passed
  • Rust 1.88 owned-file rustfmt --check: passed
  • worktree and exact base/head git diff --check: passed
  • full-workspace Rust 1.88 formatting: unchanged unrelated baseline of 17 files / 24 hunks at base and head, none in the five changed files
  • Rust 1.88 strict Clippy: unchanged unrelated baseline of 59 uninlined_format_args lints at base and head, none in the five changed files; default strict Clippy is green

Fresh hosted CodeRabbit performed a substantive exact-head review with no blocker: #353 (comment). Authenticated local CodeRabbit 0.7.1 completed against the same exact range with the one non-blocking suffix note evaluated above.

Both previously owner-held review threads were independently reproduced through their permanent four-boundary tests and are now resolved; the PR has zero unresolved threads.

This is an exact-head PASS for the #318 findings slice. Keep PR #353 draft and do not merge, mark ready, or close #318 solely from this review; the coordinator still owns the foundation merge gate and downstream restack order.

@adamgell
adamgell marked this pull request as ready for review July 31, 2026 06:26
Copilot AI review requested due to automatic review settings July 31, 2026 06:26
@adamgell
adamgell merged commit a8a367c into codex/parser-family-skeleton Jul 31, 2026
1 check passed

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 implements SCCM “evidence-backed findings” contracts at the parser-crate layer by introducing a new sccm::findings module that defines public finding/phase/confidence/terminal-evidence/coverage-gap/artifact-request types, plus strict validation + deterministic normalization across build/validate/serialize/deserialize boundaries.

Changes:

  • Add a new SCCM finding contract surface (SccmFinding* types + SccmFindingBuilder) with strict validation and canonical (sorted/deduped) serialization/deserialization.
  • Tighten SCCM public redaction to cover additional identity shapes (including path-adjacent identities) and extend sensitive-label detection.
  • Add extensive contract/regression tests enforcing the new constraints across builder, direct validate(), serialization, and deserialization.

Reviewed changes

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

Show a summary per file
File Description
crates/cmtraceopen-parser/tests/sccm_spine_contract.rs Adds broad regression coverage for new SCCM finding validation, canonicalization, artifact-request bounds, and expanded identity-redaction guarantees.
crates/cmtraceopen-parser/src/sccm/models.rs Hardens SccmRole serde by requiring canonical unknown-role values that cannot shadow declared roles.
crates/cmtraceopen-parser/src/sccm/mod.rs Registers and re-exports the new findings module from sccm.
crates/cmtraceopen-parser/src/sccm/findings.rs Introduces the core SCCM finding contracts (types + wire format + normalization + validation + builder).
crates/cmtraceopen-parser/src/sccm/evidence.rs Expands public redaction to catch additional identity patterns (including user-path-adjacent identities) and redacts identity-bearing component/source-file surfaces.

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