Skip to content

feat(sccm): add versioned correlation keys - #350

Merged
adamgell merged 3 commits into
codex/parser-family-skeletonfrom
codex/sccm-318-versioned-keys
Jul 30, 2026
Merged

adamgell merged 3 commits into
codex/parser-family-skeletonfrom
codex/sccm-318-versioned-keys

Conversation

@adamgell

@adamgell adamgell commented Jul 30, 2026 •

Copy link
Copy Markdown
Owner

Scope

Implements Task 6 of the SCCM diagnostic spine for #318:

  • adds the public correlation-key, extraction-profile, confidence, and coverage-gap contracts;
  • normalizes all 14 declared SCCM lexical key families without adding a parser kind or duplicating CCM parsing;
  • gates extraction by ConfigMgr version/profile maturity;
  • keeps the single exercised profile experimental and caps every extracted key at Low confidence;
  • rejects forged Stable profiles and malformed or prefix-collision version labels;
  • preserves deterministic ordered candidate gaps for missing and unvalidated versions;
  • requires a declared whole-token boundary both before a label and after its captured value.

No native collection, Windows I/O, findings/reducers, cross-side causal logic, ParserKind::Sccm, CCM grammar, LogEntry, or dependency changes are included.

Review corrections

Independent review first found that a regex capture could stop before an unrecognized contiguous value suffix. Values such as {GUID}}, LAB00001é, or hosté could therefore emit a truncated Low key. The first correction made end-of-message, whitespace, comma, semicolon, or ampersand the only accepted value boundaries.

A fresh dynamic rereview then found the symmetric label-start flaw: per-label regex scans treated forbidden punctuation as a word boundary, so package id=LAB00001/content id=ContentABC could emit a nested ContentId even though the package token was malformed. Commit e99cbab924da49d1b296459758307ba1ee8b110c now applies the same explicit accepted-boundary contract to label starts. It does not special-case /, :, or +.

The test-first nested-label matrix covers all 14 declared second-label kinds across forbidden /, :, and + delimiters, plus Unicode and doubled-brace adjacency. It asserts zero leaked keys, one deterministic cited malformed PackageId gap, UTF-16 spans, and unvalidated-profile candidate behavior. The positive matrix pins accepted whitespace, newline, tab, comma, semicolon, and ampersand starts while retaining Low confidence.

Restack evidence

Based on live codex/parser-family-skeleton at a58eefdc2063f9e03899af882b0bcc35c9cc2bbd.

1:  79ca233 = 1:  4bb5473 feat(sccm): add versioned correlation keys
2:  7dd577f = 2:  c808848 fix(sccm): enforce correlation key boundaries
3:  -------- > 3:  e99cbab fix(sccm): reject nested correlation labels

Verification on exact head e99cbab924da49d1b296459758307ba1ee8b110c

  • RED: cargo test -p cmtraceopen-parser --test sccm_spine_contract key_extraction_rejects_every_label_inside_a_preceding_malformed_token -- --exact --nocapture reproduced leaked Low keys for all 14 second labels across /, :, and +, plus doubled-brace and unvalidated-profile leakage
  • GREEN: the exact regression test passes
  • cargo test --locked -p cmtraceopen-parser --test sccm_spine_contract key_ -- --nocapture — 15 passed
  • cargo test --locked -p cmtraceopen-parser — 654 passed, 0 failed
  • cargo clippy --locked -p cmtraceopen-parser --all-targets -- -D warnings — passed
  • cargo check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown — passed
  • npx tsc --noEmit — passed
  • Rust 1.88 scoped rustfmt --check on all four owned files — passed
  • exact-range git diff --check a58eefdc2063f9e03899af882b0bcc35c9cc2bbd...HEAD — passed
  • rustup run 1.88.0 cargo fmt --check --all — repository baseline remains red in the same 17 unrelated pre-existing files; none are in this PR

Review gate

Substantive exact-head CodeRabbit review and a fresh independent dynamic rereview completed on e99cbab924da49d1b296459758307ba1ee8b110c; both prior blocker threads are resolved. CodeRabbit’s missing-Serde warning was disproved by the existing manual implementations and runtime round trips, while its RegexSet note is a non-blocking unmeasured optimization. Common wrapping punctuation remains a conservative false-negative limitation of the experimental Low-confidence profile.

Refs #318

Summary by CodeRabbit

  • New Features

    • Added SCCM correlation-key extraction across multiple key types.
    • Added normalization and validation for GUIDs, package IDs, site codes, hostnames, numeric IDs, and KB identifiers.
    • Added version-aware extraction profiles, including experimental ConfigMgr version support.
    • Extraction results now include confidence, evidence, offsets, ordering, and gap information.
    • Added serializable models for keys, profiles, confidence levels, and extraction results.
  • Tests

    • Expanded coverage for normalization, validation, version gating, ordering, gap handling, confidence, and JSON round trips.

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please review exact head 79ca233ddce7bdabfb27dc48bb1027aeed600b95 against base c8119325f07b763e5d098bb8e5cebc41342b8ec4, with particular attention to fail-closed version/profile selection, whole-token boundary rejection, deterministic per-candidate coverage gaps, public serde compatibility, and the Low-confidence ceiling. The CLI review attempt was rate-limited before analysis; this draft remains gated pending review.

Copy link
Copy Markdown
Owner Author

Review-status handoff for exact head 79ca233ddce7bdabfb27dc48bb1027aeed600b95: CodeRabbit has acknowledged the request with an eyes reaction only. There is no substantive CodeRabbit review, review submission, or status check yet. The CLI result was errorType: rate_limit, recoverable: true, waitTime: 23 minutes, before any analysis. This is a precise blocker, not approval; the draft remains gated for independent API review and a later exact-head CodeRabbit result.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds public SCCM correlation-key models and profile-aware extraction. Candidates are normalized, validated, deduplicated, ordered deterministically, and returned with confidence, evidence, offsets, or extraction gaps.

Changes

SCCM key extraction

Layer / File(s) Summary
Public extraction contracts
crates/cmtraceopen-parser/src/sccm/models.rs, crates/cmtraceopen-parser/src/sccm/mod.rs, crates/cmtraceopen-parser/tests/sccm_spine_contract.rs
Adds serialized key, confidence, profile, gap, and extraction-result types and publicly re-exports the extraction APIs.
Profile-aware candidate extraction
crates/cmtraceopen-parser/src/sccm/keys.rs, crates/cmtraceopen-parser/tests/sccm_spine_contract.rs
Selects profiles by ConfigMgr version, discovers candidates, records profile gaps, and attaches evidence and UTF-16 offsets to accepted keys.
Normalization and deterministic validation
crates/cmtraceopen-parser/src/sccm/keys.rs, crates/cmtraceopen-parser/tests/sccm_spine_contract.rs
Normalizes and validates GUIDs, identifiers, hosts, decimal IDs, and KB IDs while enforcing boundaries, deduplication, ordering, and malformed-candidate behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant ConfigMgrVersion
  participant SccmExtractionProfile
  participant SccmEvidence
  participant extract_keys
  participant SccmKeyExtractionResult
  ConfigMgrVersion->>SccmExtractionProfile: for_version(version)
  SccmExtractionProfile-->>extract_keys: selected profile and maturity
  SccmEvidence->>extract_keys: evidence messages
  extract_keys->>SccmKeyExtractionResult: normalized keys, gaps, evidence, UTF-16 offsets
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: adding versioned SCCM correlation-key extraction support.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='c8119325f07b763e5d098bb8e5cebc41342b8ec4'
head='79ca233ddce7bdabfb27dc48bb1027aeed600b95'

git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"

printf '\n== Changed files ==\n'
git diff --name-status "$base" "$head"
printf '\n== Diff stat ==\n'
git diff --stat "$base" "$head"
printf '\n== Full patch ==\n'
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"

printf '\n== Rust file outlines ==\n'
git diff --name-only --diff-filter=ACMR "$base" "$head" -- '*.rs' |
while IFS= read -r file; do
  printf '\n--- %s ---\n' "$file"
  ast-grep outline "$file" --items all || true
done

printf '\n== SCCM/profile/key references in changed files ==\n'
git diff --name-only --diff-filter=ACMR "$base" "$head" |
while IFS= read -r file; do
  rg -n -i -C 3 \
    'Sccm|ConfigMgr|CorrelationKey|ExtractionProfile|CoverageGap|Confidence|serde|serialize|deserialize|version|candidate' \
    "$file" || true
done

Length of output: 124140


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '== Numbered candidate-pattern and extraction sections ==\n'
nl -ba crates/cmtraceopen-parser/src/sccm/keys.rs | sed -n '60,290p'

printf '\n== Numbered new public serde contracts ==\n'
nl -ba crates/cmtraceopen-parser/src/sccm/models.rs | sed -n '135,240p'

printf '\n== Boundary and malformed-candidate tests across repository ==\n'
rg -n -i -C 4 \
  'boundary|truncat|malformed.?candidate|overlong|suffix|package id|assignment id|content id|server host|client guid' \
  crates/cmtraceopen-parser/tests crates/cmtraceopen-parser/src

printf '\n== Public SCCM schema/compatibility references ==\n'
rg -n -i -C 3 \
  'schema.?version|serde|serializ|deserializ|future.?tolerant|backward|compatib|SccmKeyConfidence|SccmExtractionProfile' \
  README.md crates/cmtraceopen-parser 2>/dev/null || true

printf '\n== Dependency versions relevant to regex behavior ==\n'
rg -n -C 2 '^(regex|serde|serde_json)\s*=' Cargo.toml crates/**/Cargo.toml

Length of output: 1378


🏁 Script executed:

#!/bin/bash
set -euo pipefail

numbered_range() {
  local file="$1"
  local first="$2"
  local last="$3"
  awk -v first="$first" -v last="$last" \
    'NR >= first && NR <= last { printf "%6d\t%s\n", NR, $0 }' "$file"
}

printf '== Numbered candidate-pattern and extraction sections ==\n'
numbered_range crates/cmtraceopen-parser/src/sccm/keys.rs 60 290

printf '\n== Numbered new public serde contracts ==\n'
numbered_range crates/cmtraceopen-parser/src/sccm/models.rs 135 240

printf '\n== Boundary and malformed-candidate tests across repository ==\n'
rg -n -i -C 4 \
  'boundary|truncat|malformed.?candidate|overlong|suffix|package id|assignment id|content id|server host|client guid' \
  crates/cmtraceopen-parser/tests crates/cmtraceopen-parser/src || true

printf '\n== Public SCCM schema/compatibility references ==\n'
rg -n -i -C 3 \
  'schema.?version|serde|serializ|deserializ|future.?tolerant|backward|compatib|SccmKeyConfidence|SccmExtractionProfile' \
  README.md crates/cmtraceopen-parser 2>/dev/null || true

printf '\n== Dependency versions relevant to regex behavior ==\n'
rg -n -C 2 '^(regex|serde|serde_json)\s*=' Cargo.toml crates/**/Cargo.toml || true

Length of output: 201703


@adamgell Reviewed exact head 79ca233ddce7bdabfb27dc48bb1027aeed600b95 against base c8119325f07b763e5d098bb8e5cebc41342b8ec4.

Finding

  • Whole-token rejection is incomplete. The candidate regexes at crates/cmtraceopen-parser/src/sccm/keys.rs Lines 70–123 end their captures when they encounter a character outside the accepted lexical class, but do not require a valid delimiter or end-of-message afterward. find_candidates() then accepts that prefix directly (Lines 247–256).

    Consequently, under the experimental profile:

    • package id=LAB00001/continued emits LAB00001;
    • assignment id={ABCDEFAB-0000-0000-0000-000000000001}/continued emits the valid GUID;
    • similarly, decimal and host values can be accepted before forbidden suffix characters.

    This bypasses the intended whole-token boundary rule and can create false correlations. Require an explicit accepted post-token boundary (or reject candidates when their next character is a non-delimiter), and add focused regression cases for valid prefixes followed by /, :, +, and similar forbidden continuations.

The fail-closed version/profile gates, per-candidate deterministic coverage gaps, camelCase serde contracts, and extracted-key Low confidence ceiling otherwise look consistent with the stated scope. Static inspection only; I did not independently execute the test suite in this sandbox.

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

BLOCKER — independent exact-head review of 79ca233 against base c811932.

The fail-closed version/profile selection, all 14 normalization kinds, per-candidate missing/unvalidated gaps, experimental Low-only ceiling, forged Stable rejection, canonical version checks, UTF-16 span calculation, evidence references, deterministic ordering, public serde round trips, and pure-Rust/wasm scope are otherwise supported by the exact diff and fresh gates. No Task 7, ParserKind, CCM grammar, LogEntry, I/O, or dependency expansion is present.

Whole-token rejection is incomplete, as detailed inline. CodeRabbit independently reached the same blocker in substantive exact-head comment 5137095645 after the earlier EYES/rate-limit states; those earlier states were correctly treated as non-approval. There are currently no other review threads.

Fresh exact-SHA verification: focused key contract 12/12; full parser 643/643; strict Clippy pass; wasm32 check pass; npx tsc --noEmit pass; scoped Rust 1.88 rustfmt pass; exact-range git diff --check pass. Passing gates do not override the semantic boundary failure. The PR has no closing keyword and remains draft.

The live base advanced to a58eefd while this review ran. After the boundary correction, this branch must be restacked onto that live base, all gates rerun, and both substantive exact-head CodeRabbit and independent rereview repeated before merge. No files were edited and no merge was performed.

@adamgell
adamgell force-pushed the codex/sccm-318-versioned-keys branch from 79ca233 to c808848 Compare July 30, 2026 23:04

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a substantive review of corrected exact head c808848c8b9da2451af25277e8ff65956530d4c2 against live base a58eefdc2063f9e03899af882b0bcc35c9cc2bbd.

This addresses the whole-token blocker in your prior substantive comment by enforcing the explicit boundary set (end, whitespace, comma, semicolon, ampersand), retaining any unrecognized continuation through the next boundary, rejecting it with no key, and citing the complete raw MalformedCandidate. The new test-first matrix covers all 14 kinds, including doubled braces, Unicode suffixes, /, :, and +. Focused 14/14 and full parser 653/653 pass; strict Clippy, wasm32, TypeScript, scoped Rust 1.88 fmt, and exact-range diff checks also pass. Please re-evaluate the boundary logic and report against this exact SHA; the draft remains gated.

@coderabbitai

coderabbitai Bot commented Jul 30, 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='a58eefdc2063f9e03899af882b0bcc35c9cc2bbd'
head='c808848c8b9da2451af25277e8ff65956530d4c2'

git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"

printf '%s\n' '== Exact commits =='
git show -s --format='%H%n%P%n%s' "$base"
git show -s --format='%H%n%P%n%s' "$head"

printf '%s\n' '== Changed files =='
git diff --name-status "$base" "$head"

printf '%s\n' '== Patch =='
git diff --find-renames --find-copies --no-ext-diff "$base" "$head"

printf '%s\n' '== Rust outlines for changed files =='
git diff --name-only --diff-filter=ACMR "$base" "$head" -- '*.rs' |
while IFS= read -r file; do
  printf '\n--- %s ---\n' "$file"
  ast-grep outline "$file" --items all || true
done

printf '%s\n' '== Boundary/extraction implementations and tests =='
rg -n -C 6 \
  'find_candidates|MalformedCandidate|boundary|continuation|candidate|normalize|ExtractionProfile|SccmKeyConfidence|CoverageGap' \
  crates/cmtraceopen-parser/src/sccm crates/cmtraceopen-parser/tests 2>/dev/null || true

Length of output: 201564


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='a58eefdc2063f9e03899af882b0bcc35c9cc2bbd'
head='c808848c8b9da2451af25277e8ff65956530d4c2'

printf '%s\n' '== Changed file list =='
git diff --name-status "$base" "$head"

printf '%s\n' '== Diff summary by hunk =='
git diff --unified=12 --no-ext-diff "$base" "$head" -- \
  'crates/cmtraceopen-parser/src/sccm/keys.rs' \
  'crates/cmtraceopen-parser/src/sccm/models.rs' \
  'crates/cmtraceopen-parser/src/sccm/mod.rs' \
  'crates/cmtraceopen-parser/tests/sccm_spine_contract.rs' 2>/dev/null || true

printf '%s\n' '== Candidate and boundary source sections =='
nl -ba crates/cmtraceopen-parser/src/sccm/keys.rs | sed -n '1,380p'

printf '%s\n' '== SCCM public model sections =='
nl -ba crates/cmtraceopen-parser/src/sccm/models.rs | sed -n '1,300p'

printf '%s\n' '== SCCM spine test symbols =='
ast-grep outline crates/cmtraceopen-parser/tests/sccm_spine_contract.rs --items all 2>/dev/null || true
rg -n -C 10 \
  'boundary|MalformedCandidate|version|profile|confidence|coverage|serde|candidate|key_' \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs 2>/dev/null || true

Length of output: 43375


🏁 Script executed:

#!/bin/bash
set -euo pipefail

previous='79ca233ddce7bdabfb27dc48bb1027aeed600b95'
head='c808848c8b9da2451af25277e8ff65956530d4c2'

printf '%s\n' '== Correction-only diff =='
git diff --unified=20 --no-ext-diff "$previous" "$head" -- \
  crates/cmtraceopen-parser/src/sccm/keys.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

printf '%s\n' '== Direct extraction/profile API references =='
rg -n -C 5 \
  '\bextract_keys\s*\(|\bnormalize_key\s*\(|SccmExtractionProfile::for_version\s*\(|SccmKeyExtractionResult\b' \
  crates/cmtraceopen-parser/src crates/cmtraceopen-parser/tests \
  -g '*.rs' || true

printf '%s\n' '== Boundary and candidate functions (numbered) =='
awk 'NR >= 200 && NR <= 330 { printf "%4d  %s\n", NR, $0 }' \
  crates/cmtraceopen-parser/src/sccm/keys.rs

printf '%s\n' '== Model serde contracts (numbered) =='
awk 'NR >= 145 && NR <= 255 { printf "%4d  %s\n", NR, $0 }' \
  crates/cmtraceopen-parser/src/sccm/models.rs

printf '%s\n' '== Relevant test methods (numbered) =='
rg -n \
  'fn key_(extraction_requires_a_full_token_boundary_for_every_declared_kind|extraction_accepts_the_declared_full_token_boundaries|profile_forged_stable_profile_cannot_emit_strong_or_exact_keys|profile_version_selection_rejects_malformed_or_prefix_collision_versions|profile_and_extraction_result_have_deterministic_json_round_trips)' \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs || true

Length of output: 48128


@adamgell Reviewed corrected exact head c808848c8b9da2451af25277e8ff65956530d4c2 against base a58eefdc2063f9e03899af882b0bcc35c9cc2bbd.

No findings.

The boundary correction resolves the prior blocker: find_candidates() now retains any non-delimited continuation through the next allowed boundary (or end-of-message), and normalization rejects that complete raw token as MalformedCandidate rather than emitting its valid prefix. The 14-kind regression matrix covers the relevant doubled-brace, Unicode, /, :, and + cases, while positive coverage pins all allowed boundaries.

I also confirmed statically that:

  • there is no alternate SCCM extraction path bypassing the boundary logic;
  • version/profile selection remains fail-closed, including forged Stable profiles;
  • extracted keys remain capped at Low confidence;
  • candidate gaps remain ordered deterministically; and
  • the public contracts use camelCase Serde with round-trip coverage.

Static review only; I could not independently execute the test suite in this sandbox.

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-range rereview of a58eefdc2063f9e03899af882b0bcc35c9cc2bbd..c808848c8b9da2451af25277e8ff65956530d4c2: BLOCKED. The original valid-prefix case is fixed, but an adversarial executable probe found a second cross-pattern adjacent-label path. CodeRabbit reviewed this exact head with no findings, but its static result does not cover the dynamic reproduction in the inline comment. The prior thread remains unresolved. Do not merge or mark ready until the forbidden-delimiter case emits no keys and a regression matrix covers adjacent labels.

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a fresh substantive review of exact head e99cbab924da49d1b296459758307ba1ee8b110c against exact base a58eefdc2063f9e03899af882b0bcc35c9cc2bbd.

Focus on the dynamic nested-label correction: every label start must be at start-of-message or follow only whitespace, comma, semicolon, or ampersand; forbidden /, :, +, Unicode, and brace adjacency must not leak a second Low-confidence key from a malformed token. Please also check deterministic cited coverage gaps, UTF-16 spans, unvalidated-profile behavior, public Serde compatibility, the Low-confidence ceiling, and pure wasm32 compatibility. Both independent review threads remain unresolved and this PR remains draft pending exact-head review.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='a58eefdc2063f9e03899af882b0bcc35c9cc2bbd'
head='e99cbab924da49d1b296459758307ba1ee8b110c'

git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"

printf '%s\n' '== Exact commit identities =='
git show -s --format='base: %H%nparents: %P%nsubject: %s' "$base"
git show -s --format='head: %H%nparents: %P%nsubject: %s' "$head"

printf '%s\n' '== Changed files =='
git diff --name-status "$base" "$head"
printf '%s\n' '== Diff stat =='
git diff --stat "$base" "$head"

printf '%s\n' '== AST outlines of changed Rust files =='
git diff --name-only --diff-filter=ACMR "$base" "$head" -- '*.rs' |
while IFS= read -r file; do
  printf '\n--- %s ---\n' "$file"
  ast-grep outline "$file" --items all || true
done

printf '%s\n' '== Full focused patch =='
git diff --unified=20 --no-ext-diff "$base" "$head" -- \
  crates/cmtraceopen-parser/src/sccm/keys.rs \
  crates/cmtraceopen-parser/src/sccm/models.rs \
  crates/cmtraceopen-parser/src/sccm/mod.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

printf '%s\n' '== Boundary/extraction implementation =='
nl -ba crates/cmtraceopen-parser/src/sccm/keys.rs | sed -n '1,420p'

printf '%s\n' '== Public SCCM models =='
nl -ba crates/cmtraceopen-parser/src/sccm/models.rs | sed -n '1,340p'

printf '%s\n' '== Direct extraction and profile API uses =='
rg -n -C 5 --type rust \
  '\b(find_candidates|extract_keys|normalize_key|for_version)\s*\(|SccmKeyExtractionResult|SccmExtractionProfile|SccmCoverageGap|SccmCorrelationKey' \
  crates/cmtraceopen-parser/src crates/cmtraceopen-parser/tests || true

printf '%s\n' '== Focused SCCM spine test functions and assertions =='
rg -n -C 12 --type rust \
  'nested|boundary|MalformedCandidate|utf.?16|unvalidated|serde|confidence|coverage|forged|version' \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs || true

Length of output: 62854


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='a58eefdc2063f9e03899af882b0bcc35c9cc2bbd'
previous='c808848c8b9da2451af25277e8ff65956530d4c2'
head='e99cbab924da49d1b296459758307ba1ee8b110c'

numbered() {
  local file="$1"
  local first="$2"
  local last="$3"
  awk -v first="$first" -v last="$last \
    'NR >= first && NR <= last { printf "%6d  %s\n", NR, $0 }' "$file"
}

printf '%s\n' '== Nested-label correction-only diff =='
git diff --unified=30 --no-ext-diff "$previous" "$head" -- \
  crates/cmtraceopen-parser/src/sccm/keys.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

printf '%s\n' '== Candidate discovery, boundaries, and normalization =='
numbered crates/cmtraceopen-parser/src/sccm/keys.rs 220 452

printf '%s\n' '== Public extraction model contracts =='
numbered crates/cmtraceopen-parser/src/sccm/models.rs 135 240

printf '%s\n' '== Nested-label and accepted-boundary tests =='
numbered crates/cmtraceopen-parser/tests/sccm_spine_contract.rs 560 760

printf '%s\n' '== Profile/gap/Serde contract tests =='
numbered crates/cmtraceopen-parser/tests/sccm_spine_contract.rs 365 450
numbered crates/cmtraceopen-parser/tests/sccm_spine_contract.rs 735 875

printf '%s\n' '== Direct production and test callers =='
rg -n -C 4 --type rust \
  '\bextract_keys\s*\(|\bnormalize_key\s*\(|SccmExtractionProfile::for_version\s*\(' \
  crates/cmtraceopen-parser/src crates/cmtraceopen-parser/tests || true

printf '%s\n' '== Public model serde attributes and artifact-family contract =='
rg -n -C 4 --type rust \
  '#\[serde|pub (enum|struct) Sccm(ArtifactFamily|CorrelationKey|KeyConfidence|ExtractionProfile|ExtractionGap|KeyExtractionResult)' \
  crates/cmtraceopen-parser/src/sccm/models.rs crates/cmtraceopen-parser/src/sccm/catalog.rs || true

printf '%s\n' '== Rust dependency features and wasm target configuration =='
rg -n -C 3 \
  '^\[features\]|^\[dependencies\]|^regex\s*=|^serde\s*=|^serde_json\s*=|wasm32|crate-type' \
  Cargo.toml crates/cmtraceopen-parser/Cargo.toml .cargo 2>/dev/null || true

Length of output: 2388


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='a58eefdc2063f9e03899af882b0bcc35c9cc2bbd'
previous='c808848c8b9da2451af25277e8ff65956530d4c2'
head='e99cbab924da49d1b296459758307ba1ee8b110c'

numbered() {
  local file="$1"
  local first="$2"
  local last="$3"
  awk -v first="$first" -v last="$last" \
    'NR >= first && NR <= last { printf "%6d  %s\n", NR, $0 }' "$file"
}

printf '%s\n' '== Nested-label correction-only diff =='
git diff --unified=30 --no-ext-diff "$previous" "$head" -- \
  crates/cmtraceopen-parser/src/sccm/keys.rs \
  crates/cmtraceopen-parser/tests/sccm_spine_contract.rs

printf '%s\n' '== Candidate discovery, boundaries, and normalization =='
numbered crates/cmtraceopen-parser/src/sccm/keys.rs 220 452

printf '%s\n' '== Public extraction model contracts =='
numbered crates/cmtraceopen-parser/src/sccm/models.rs 135 240

printf '%s\n' '== Nested-label and accepted-boundary tests =='
numbered crates/cmtraceopen-parser/tests/sccm_spine_contract.rs 560 760

printf '%s\n' '== Profile/gap/Serde contract tests =='
numbered crates/cmtraceopen-parser/tests/sccm_spine_contract.rs 365 450
numbered crates/cmtraceopen-parser/tests/sccm_spine_contract.rs 735 875

printf '%s\n' '== Direct production and test callers =='
rg -n -C 4 --type rust \
  '\bextract_keys\s*\(|\bnormalize_key\s*\(|SccmExtractionProfile::for_version\s*\(' \
  crates/cmtraceopen-parser/src crates/cmtraceopen-parser/tests || true

printf '%s\n' '== Public model serde attributes and artifact-family contract =='
rg -n -C 4 --type rust \
  '#\[serde|pub (enum|struct) Sccm(ArtifactFamily|CorrelationKey|KeyConfidence|ExtractionProfile|ExtractionGap|KeyExtractionResult)' \
  crates/cmtraceopen-parser/src/sccm/models.rs crates/cmtraceopen-parser/src/sccm/catalog.rs || true

printf '%s\n' '== Rust dependency features and wasm target configuration =='
rg -n -C 3 \
  '^\[features\]|^\[dependencies\]|^regex\s*=|^serde\s*=|^serde_json\s*=|wasm32|crate-type' \
  Cargo.toml crates/cmtraceopen-parser/Cargo.toml .cargo 2>/dev/null || true

Length of output: 85878


@adamgell Reviewed exact head e99cbab924da49d1b296459758307ba1ee8b110c against exact base a58eefdc2063f9e03899af882b0bcc35c9cc2bbd.

Finding

  • SccmExtractionProfile cannot derive its declared Serde contract. crates/cmtraceopen-parser/src/sccm/models.rs Line 201 contains Vec<SccmArtifactFamily> and the enclosing SccmExtractionProfile derives both Serialize and Deserialize (Lines 196–198). However, crates/cmtraceopen-parser/src/sccm/catalog.rs Lines 7–8 defines SccmArtifactFamily without either Serde derive/implementation. This makes the new public profile type fail to compile because Vec<T> requires T: Serialize and T: Deserialize; consequently, the profile JSON round-trip test cannot build either. Add a compatible Serde implementation (typically the existing camelCase derive convention) for SccmArtifactFamily, or avoid serializing that field.

The nested-label correction itself looks sound under static review: find_candidates() applies the new start-boundary predicate before extracting each match, and it shares the explicit allowed set with the end-boundary logic. The focused matrix covers all 14 second-label kinds across /, :, +, brace, and Unicode adjacency; confirms cited malformed gaps and unvalidated behavior; and exercises accepted separators and UTF-16 spans. The extraction path remains capped at Low confidence.

I did not execute Rust tests, Clippy, or the wasm32 build in this sandbox.

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

Copy link
Copy Markdown
Owner Author

CodeRabbit finding disposition for exact head e99cbab924da49d1b296459758307ba1ee8b110c: the reported missing Serde implementation is not present. catalog.rs imports Serialize/Deserialize and provides manual impl Serialize for SccmArtifactFamily plus impl<'de> Deserialize<'de> for SccmArtifactFamily; this is intentional so Unknown(String) round-trips as its value. The public profile JSON round-trip compiled and passed within focused 15/15 and full parser 654/654 on this exact head. No code change is warranted for this finding. A fresh independent reviewer is separately executing the exact range and will verify the manual Serde path; PR remains draft.

@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 (1)
crates/cmtraceopen-parser/src/sccm/keys.rs (1)

243-264: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Use a RegexSet prefilter for key extraction

find_candidates scans each message with all 14 key regexes. Use a RegexSet to identify matching pattern indices first, then run captures only for those patterns while preserving the existing ordering.

🤖 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/keys.rs` around lines 243 - 264, Update
find_candidates to use a RegexSet prefilter over the key patterns, first
collecting matching pattern indices for the message and then running captures
only against those patterns. Preserve the existing pattern ordering and all
current candidate construction, label validation, token-boundary, and UTF-16
offset behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/cmtraceopen-parser/src/sccm/keys.rs`:
- Around line 243-264: Update find_candidates to use a RegexSet prefilter over
the key patterns, first collecting matching pattern indices for the message and
then running captures only against those patterns. Preserve the existing pattern
ordering and all current candidate construction, label validation,
token-boundary, and UTF-16 offset behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b36ecedd-6b6b-4c1c-9752-d936b6fed9dc

📥 Commits

Reviewing files that changed from the base of the PR and between a58eefd and e99cbab.

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

@adamgell adamgell left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Exact-range independent rereview — PASS

Reviewed exact base a58eefdc2063f9e03899af882b0bcc35c9cc2bbd through exact head e99cbab924da49d1b296459758307ba1ee8b110c in a clean detached worktree. I found no blocking issue in this Task 6 slice.

Prior blockers

  • Valid-prefix truncation is fixed. A fresh runtime cross-product rejected 63 malformed suffix cases across all 14 declared key kinds (/, :, +, Unicode, plus an extra closing brace for every brace-bearing form). Each experimental-profile case emitted no key and one cited MalformedCandidate; each unvalidated-version case emitted no key and one cited UnvalidatedVersion gap preserving the full candidate raw text.
  • Nested-label escape is fixed. A fresh runtime cross-product rejected 70 cases: every one of the 14 second-label kinds after each of /, :, and +, plus every second label after a doubled-brace assignment token and a Unicode-adjacent package token. No second key or second unvalidated candidate gap escaped the malformed first token.

I resolved the two prior review threads only after these matrices passed.

Independent contract proof

  • 196 additional start/end/boundary/span cases passed across all 14 kinds. Start of message, end of message, and each declared whitespace/comma/semicolon/ampersand boundary were exercised independently.
  • UTF-16 spans (including an astral prefix), raw values, evidence citations, deterministic repeated output, text-order sorting, and the extracted-key Low confidence ceiling all matched.
  • The built-in profile remains experimental for the single observed 5.00.9128.* family; unknown/malformed versions do not emit keys; a forged Stable profile is rejected.
  • Serde round trips passed for the profile/result models, and the full parser suite preserves CCM/LogEntry compatibility.
  • The exact diff changes only keys.rs, the additive SCCM models/re-exports, and spine tests. It adds no ParserKind::Sccm, I/O/native/Tauri/network/database dependency, dependency change, or Task 7 finding code.

Common wrapping punctuation ((...), [...], quoted forms) remains outside the explicitly declared token-boundary grammar: the probe emitted zero keys (and retained the general experimental-profile gap). That is a conservative false-negative/experimental-profile coverage limit, not a false key or causal claim; it should be expanded with sanitized observed corpus evidence before any profile promotion.

Verification

  • cargo test --locked -p cmtraceopen-parser --test sccm_spine_contract key_ -- --nocapture — 15 passed
  • cargo test --locked -p cmtraceopen-parser --quiet — 654 passed
  • cargo clippy --locked -p cmtraceopen-parser --all-targets -- -D warnings — passed
  • cargo check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown — passed
  • npx tsc --noEmit — passed
  • Rust 1.88 rustfmt check of the four owned Rust files — passed
  • git diff --check a58eefdc2063f9e03899af882b0bcc35c9cc2bbd..e99cbab924da49d1b296459758307ba1ee8b110c — passed
  • CodeRabbit CLI exact committed-range review — 0 findings

CodeRabbit disposition

CodeRabbit's GitHub comment claiming SccmArtifactFamily lacks Serde is a false positive. catalog.rs imports the Serde traits at line 1, implements Serialize at line 54 and Deserialize at line 63, and maps future strings to Unknown(String) at line 86. I also runtime-round-tripped both ClientPolicy and Unknown("futureFamily"); the committed contract test covers the same behavior at sccm_spine_contract.rs:1420-1432. The 654-test build, strict Clippy, and wasm check independently compile the profile's Vec<SccmArtifactFamily> Serde bounds.

This is a SHA-anchored review of e99cbab924da49d1b296459758307ba1ee8b110c; it does not mark the draft ready, merge it, close #318, or authorize Task 7.

@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-range rereview PASS for a58eefd..e99cbab. A separate detached-worktree reviewer executed 63 malformed-suffix cases, 70 nested-label cases (all 14 second labels across slash, colon, plus, doubled-brace, and Unicode adjacency), and 196 independent accepted-boundary, UTF-16 span, and citation cases across all 14 kinds. No key or unvalidated candidate gap leaked; deterministic ordering, cited raw gaps, Low-confidence ceiling, version/profile fail-closed behavior, and known/future SccmArtifactFamily Serde round trips passed. Common wrapping punctuation is a conservative experimental-profile false negative, not a false positive, and remains an explicit profile limitation. Focused 15/15; full parser 654/654; strict Clippy, wasm32, TypeScript, scoped Rust 1.88 formatting, and exact-range diff checks passed. The CodeRabbit missing-Serde claim is disproved by the manual Serialize and Deserialize implementations and runtime round trips; its RegexSet suggestion is a non-blocking unmeasured optimization and is not warranted in this correctness slice. Both prior blockers are fixed at this SHA. No Task 7, native I/O, ParserKind, CCM, LogEntry, or dependency scope expansion found.

@adamgell
adamgell marked this pull request as ready for review July 30, 2026 23:32
Copilot AI review requested due to automatic review settings July 30, 2026 23:32
@adamgell
adamgell merged commit 25b3733 into codex/parser-family-skeleton Jul 30, 2026
2 checks 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 adds a version-gated SCCM correlation-key extraction contract to the parser layer, introducing public models for extracted keys, extraction profiles, confidence, and deterministic “coverage gap” reporting without adding a new ParserKind.

Changes:

  • Introduces new public SCCM key-related models (kinds, confidence, profiles, gaps, extraction result) and exports a new keys module API.
  • Implements experimental (version-prefixed) key extraction with strict label/value boundary handling and conservative (Low) confidence emission.
  • Expands the SCCM spine contract tests to cover normalization, version gating, malformed-token/nested-label rejection, ordering, and JSON round-trips.

Reviewed changes

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

File Description
crates/cmtraceopen-parser/tests/sccm_spine_contract.rs Adds a comprehensive key normalization/extraction contract test matrix, including boundary and regression coverage.
crates/cmtraceopen-parser/src/sccm/models.rs Adds public SCCM correlation-key, profile, confidence, gap, and result model contracts.
crates/cmtraceopen-parser/src/sccm/mod.rs Wires the new keys module and re-exports its public API.
crates/cmtraceopen-parser/src/sccm/keys.rs Implements versioned, boundary-aware SCCM key extraction and normalization.

Comment on lines +182 to +185
pub extraction_profile_id: Option<String>,
pub evidence: Option<SccmEvidenceRef>,
pub start: Option<usize>,
pub end: Option<usize>,
adamgell added a commit that referenced this pull request Aug 4, 2026
Add fail-closed, versioned SCCM correlation-key extraction with conservative Low-confidence profiles and whole-token boundary validation.

Refs #318.
adamgell added a commit that referenced this pull request Sep 18, 2026
…t-1.6.0 fixes (#633)

* docs(changelog): cite the shipped issue numbers and record main's post-1.6.0 fixes

Three things were wrong with the changelog as it stood after the 1.6.0 cut.

**The 1.6.0 section under-cited its own SCCM work.** A check across every commit
in the tag (`v1.5.2..9bbaf67`) found twelve issue numbers that shipped without
appearing anywhere in the section: #335, #336, #342, #344, #346, #348, #350,
#394, #404, #418, #444, #458. They are the foundation and hardening under the one
SCCM bullet — diagnostic spine, evidence framing, canonical intake and health
contracts, signal tokens, correlation keys, coverage assessment, bounded ids,
overlapping evidence ranges, client discovery, DP-to-intake binding. The bullet
now names them. Two more were folded into bullets that described their work
without citing them: the CodeRabbit retarget and review charter (#537, #538 under
the agent-tooling bullet) and the framework's own extraction (#543, #548 under
Reducer Framework v1).

**Main carries two fixes the 1.6.0 tag does not.** `[Unreleased]` was empty while
`9bbaf67e..main` held the updater-manifest publisher fix and the `rustls` advisory
bump, so both are recorded now.

Verified: a script that walks every `feat`/`fix`/`perf`/`refactor`/`build`/`ci`
commit in the tag, extracts its issue references and checks them against both the
1.6.0 and 1.5.2 sections now reports zero undocumented references. The one that
looked missing before, #521, is documented under 1.5.2 where it shipped.

* docs(changelog): name the redaction boundary decision in the 1.6.0 section

The section cited the work but never named ADR-004 revision 1 or the ruling that
makes it load-bearing. The changelog is the durable record, so the decision now
appears there with the audit finding that motivated it, what changed (projected
form is the only constructible public form, preserving variants are explicitly
named local-only entry points), and a pointer to the document that carries the
eight rulings.

* docs(changelog): say the redaction decision in plain English

Same decision, no jargon: 'covered almost none of the places data actually leaves
the app' rather than 'binds at almost no real export surface', 'the version
holding the real values' rather than 'the preserving variant', and the check
described as following through nested data rather than as structural enforcement
being recursive. The eight rulings and the ADR link are unchanged.
@adamgell
adamgell deleted the codex/sccm-318-versioned-keys branch September 25, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants