Skip to content

fix(sccm): scope server intake identities by provenance - #430

Merged
adamgell merged 4 commits into
codex/parser-family-skeletonfrom
codex/sccm-335-host-identity-repair
Aug 1, 2026
Merged

adamgell merged 4 commits into
codex/parser-family-skeletonfrom
codex/sccm-335-host-identity-repair

Conversation

@adamgell

@adamgell adamgell commented Aug 1, 2026 •

Copy link
Copy Markdown
Owner

Refs #335 and #317.

What changed

  • Scope the server intake path-fingerprint lineage reservation by the validated producer-host and workflow-subject handles.
  • Scope the canonical artifact identity by the same provenance dimensions.
  • Preserve exact DuplicateArtifact rejection when caller-chosen artifact/root labels relabel the same host-and-subject identity.
  • Add focused adversarial coverage for both identity maps across distinct producer hosts and distinct workflow subjects.

Root cause

The intake model already validated and projected producerHostHandle and workflowSubject.instanceHandle, but both internal deduplication keys stopped at role-level provenance. Artifacts from distinct hosts or distinct workflow subjects could therefore be rejected as duplicates when their remaining physical identity fields matched.

TDD evidence

RED on test-only commit 56818acd:

cargo test --locked -p cmtraceopen-parser --test sccm_server_intake server_intake_scopes_ -- --nocapture
0 passed; 4 failed; each failed with DuplicateArtifact

GREEN on 2e0bd691:

producer-host and workflow-subject scope probes: 4 passed
precise true-duplicate probes: 2 passed
full server intake: 16 passed
SCCM spine: 138 passed

Verification

  • cargo test --locked -p cmtraceopen-parser --test sccm_server_intake — pass, 16/16
  • cargo test --locked -p cmtraceopen-parser --test sccm_spine_contract — pass, 138/138
  • cargo test --locked -p cmtraceopen-parser — pass
  • cargo check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown — pass
  • cargo clippy --locked -p cmtraceopen-parser --all-targets -- -D warnings — pass
  • changed-file rustfmt --check — pass
  • npx --no-install tsc --noEmit — pass
  • git diff --check 065b8cb7..HEAD — pass
  • local CodeRabbit exact-range review — 0 findings across both changed files

cargo fmt --check --all remains red only for inherited formatting drift in files outside this PR; the two changed files pass the scoped formatter gate.

Boundaries

This is a pure-Rust internal-key repair. It changes no public serialized fields, adds no Windows/native collection code, and makes no live SCCM/Windows acceptance claim. PR remains unmerged pending exact-head hosted review.

Summary by CodeRabbit

  • Bug Fixes

    • Improved duplicate detection by distinguishing artifacts from different producer hosts or workflow subjects.
    • Prevented unrelated artifacts with matching identity details from being incorrectly treated as duplicates.
    • Ensured artifact output remains consistent regardless of manifest order.
    • Preserved independent handling for artifacts associated with different hosts or workflow instances.
  • Tests

    • Expanded coverage for duplicate identities, host-scoped paths, workflow-subject scoping, and ordering scenarios.

Independent review follow-up

Independent exact-range review found that the new provenance dimensions were not yet part of PreparedArtifact::sort_key, and that the DP subject test used a SUP-shaped synthetic label.

Review-fix commit b3ebb5b1:

  • orders otherwise-equal artifacts by producer host plus workflow-subject role/handle before path/rotation/basename/caller ID;
  • proves byte-identical output under reordered distinct-host and distinct-subject manifests;
  • adds only the synthetic dp-02 subject handle and uses DP-shaped handles in DP tests.

Review-fix RED reproduced caller-ID ordering and rejected dp-02 as InvalidArtifact; all listed gates were rerun GREEN at exact head b3ebb5b1414a18eb180c654ae34479f3b6a51132.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The SCCM server intake now includes producer-host and workflow-subject instance handles in artifact identity, ordering, and path-fingerprint keys. Tests verify duplicate rejection and independent handling across distinct hosts and workflow subjects.

Changes

SCCM artifact identity

Layer / File(s) Summary
Context-aware identity and ordering keys
crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs
Path-fingerprint lineage, canonical artifact identity, and artifact ordering include producer-host and workflow-subject instance handles. Synthetic validation accepts synthetic:subject:dp-02.
Identity validation tests
crates/cmtraceopen-parser/tests/sccm_server_intake.rs
Tests verify precise DuplicateArtifact errors and independent identities across producer hosts and workflow subjects, including manifest-order invariance.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: test

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.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 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 main change: scoping SCCM server intake identities by provenance.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request parser Log parser related sccm SCCM/ConfigMgr related labels Aug 1, 2026
@adamgell
adamgell requested a review from Copilot August 1, 2026 22:21
@adamgell

adamgell commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.


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

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 fixes SCCM Server intake deduplication collisions by scoping internal identity keys to stronger provenance dimensions (validated producerHostHandle and workflowSubject.instanceHandle), preventing false DuplicateArtifact rejections across distinct hosts/subjects while preserving true-duplicate rejection behavior.

Changes:

  • Expand the internal path-fingerprint lineage reservation key to include producer-host and workflow-subject handles.
  • Expand the canonical artifact identity key to include the same provenance dimensions.
  • Add targeted adversarial tests to prove independence across distinct producer hosts and distinct workflow subjects, while keeping strict duplicate rejection for relabeling within the same scoped identity.

Reviewed changes

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

File Description
crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs Scopes deduplication keys for path-fingerprint lineage and canonical artifact identity by producer host + workflow subject handles.
crates/cmtraceopen-parser/tests/sccm_server_intake.rs Adds regression tests covering host/subject scoping and preserves explicit DuplicateArtifact assertions for true duplicates.
Suppressed comments (1)

crates/cmtraceopen-parser/tests/sccm_server_intake.rs:391

  • Same clarity issue as above: the handle string ("sup-01") doesn't match the Distribution Point workflow-subject role being configured in this test.
    configure_second_artifact_as_dp_identity(&mut manifest, "synthetic:subject:sup-01", false);

@adamgell

adamgell commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review\n\nPlease review exact head b3ebb5b1414a18eb180c654ae34479f3b6a51132; independent-review fixes add provenance-first ordering and a role-honest synthetic subject handle.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

commit='b3ebb5b1414a18eb180c654ae34479f3b6a51132'

git cat-file -e "${commit}^{commit}"
printf '%s\n' '=== Commit metadata ==='
git show -s --format=fuller "$commit"

printf '%s\n' '=== Changed files ==='
git diff-tree --no-commit-id --name-status -r "$commit"

printf '%s\n' '=== Exact patch ==='
git diff --find-renames --find-copies "${commit}^" "$commit" -- \
  crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs \
  crates/cmtraceopen-parser/tests/sccm_server_intake.rs

printf '%s\n' '=== Production-file outline ==='
ast-grep outline crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs --items all

printf '%s\n' '=== Test-file outline ==='
ast-grep outline crates/cmtraceopen-parser/tests/sccm_server_intake.rs --items all

Length of output: 14124


🏁 Script executed:

#!/bin/bash
set -euo pipefail

src='crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs'
test_file='crates/cmtraceopen-parser/tests/sccm_server_intake.rs'

printf '%s\n' '=== Intake processing, duplicate identity, and sort application ==='
sed -n '145,340p' "$src"

printf '%s\n' '=== Artifact normalization and provenance validation ==='
sed -n '398,638p' "$src"

printf '%s\n' '=== Handle validation and role ordering ==='
sed -n '958,1142p' "$src"

printf '%s\n' '=== Tests for duplicate identity, provenance ordering, and subject helper ==='
sed -n '247,463p' "$test_file"

printf '%s\n' '=== Synthetic subject handles in tracked source and fixtures ==='
rg -n -C 3 --glob '*.rs' --glob '*.json' --glob '*.yaml' --glob '*.yml' \
  'synthetic:subject:(dp-02|dp-01|sup-01)' .

printf '%s\n' '=== Workflow-subject validation helpers and their call sites ==='
rg -n -C 4 --type rust \
  'safe_optional_handle\s*\(|workflow_subject_(role|handle)|RawWorkflowSubject' \
  crates/cmtraceopen-parser/src

Length of output: 69808


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='b3ebb5b1414a18eb180c654ae34479f3b6a51132'

printf '%s\n' '=== Available local and remote refs ==='
git branch -a --contains "$head" || true
git for-each-ref --format='%(refname:short) %(objectname)' refs/remotes refs/heads | sed -n '1,160p'

base=''
for candidate in origin/main origin/master main master; do
  if git rev-parse -q --verify "$candidate^{commit}" >/dev/null; then
    base=$(git merge-base "$candidate" "$head")
    printf 'Selected target ref: %s\nMerge base: %s\n' "$candidate" "$base"
    break
  fi
done
if [ -z "$base" ]; then
  echo 'No standard target branch is available locally.' >&2
  exit 0
fi

printf '%s\n' '=== Complete PR commit list ==='
git log --oneline --decorate "${base}..${head}"

printf '%s\n' '=== Complete PR file delta ==='
git diff --stat "${base}..${head}"
git diff --name-status "${base}..${head}"

printf '%s\n' '=== Complete PR patch ==='
git diff --find-renames --find-copies "${base}..${head}" -- \
  crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs \
  crates/cmtraceopen-parser/tests/sccm_server_intake.rs

printf '%s\n' '=== Identity aliases and all constructor sites ==='
rg -n -C 5 --type rust \
  'type (PathFingerprintKey|CanonicalArtifactIdentity)|path_fingerprint_lineages|canonical_artifact_identities|path_fingerprint_key|canonical_identity' \
  crates/cmtraceopen-parser/src

printf '%s\n' '=== Assessment output order and collection construction ==='
rg -n -C 4 --type rust \
  '(prepared\.sort_by|coverage_by_key|evidence\.sort_by|next_artifact_requests\.sort_by|artifacts\.push|artifact_ids\.sort)' \
  crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs

Length of output: 141742


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='adamgell/cmtraceopen'
pr='430'
head='b3ebb5b1414a18eb180c654ae34479f3b6a51132'

printf '%s\n' '=== Pull request metadata ==='
gh api "repos/${repo}/pulls/${pr}" \
  --jq '{number, state, draft, base: {ref: .base.ref, sha: .base.sha}, head: {ref: .head.ref, sha: .head.sha}}'

printf '%s\n' '=== Pull request commits ==='
gh api "repos/${repo}/pulls/${pr}/commits?per_page=100" \
  --jq '.[] | {sha, message: .commit.message}'

printf '%s\n' '=== Pull request changed files ==='
gh api "repos/${repo}/pulls/${pr}/files?per_page=100" \
  --jq '.[] | {filename, status, additions, deletions}'

base=$(gh api "repos/${repo}/pulls/${pr}" --jq '.base.sha')
remote_head=$(gh api "repos/${repo}/pulls/${pr}" --jq '.head.sha')
printf 'Requested head: %s\nGitHub head: %s\nGitHub base: %s\n' "$head" "$remote_head" "$base"

if [ "$remote_head" != "$head" ]; then
  echo 'The requested commit is not the current GitHub PR head.' >&2
fi

if git cat-file -e "${base}^{commit}" 2>/dev/null && git cat-file -e "${head}^{commit}" 2>/dev/null; then
  printf '%s\n' '=== Actual PR diff stat ==='
  git diff --stat "${base}...${head}"
  printf '%s\n' '=== Actual PR source and test patch ==='
  git diff --find-renames --find-copies "${base}...${head}" -- \
    crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs \
    crates/cmtraceopen-parser/tests/sccm_server_intake.rs
else
  echo 'The GitHub base commit is not available in the local clone.' >&2
fi

Length of output: 14632


@adamgell Full review completed for #430 at b3ebb5b1414a18eb180c654ae34479f3b6a51132.

I found no actionable issues.

The identity keys now scope duplicate detection by producer host and workflow subject. The artifact sort key uses the same provenance before artifact_id. The tests verify deterministic output after manifest reversal. The new synthetic:subject:dp-02 handle is used with the distributionPoint workflow-subject role.

I performed a static review. I did not execute repository tests in this sandbox.

✅ Action performed

Full review finished.


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

@adamgell

adamgell commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

Independent exact-head re-review at b3ebb5b1414a18eb180c654ae34479f3b6a51132: PASS. Both prior findings are fixed and no new actionable issue was found. Local/remote heads match; the worktree is clean. The prior Copilot handle thread is replied to and resolved. Exact-head hosted Copilot and CodeRabbit cycles were re-requested and remain the external review gate; this PR stays draft/unmerged.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

@adamgell

adamgell commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

Please perform a fresh full review of exact head 4a33062 after the integration-base merge.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='adamgell/cmtraceopen'
pr='430'
head='4a330621fdb69303ba77d9137d4127a7ba628854'

printf '%s\n' '=== Pull request metadata ==='
gh api "repos/${repo}/pulls/${pr}" \
  --jq '{number, state, draft, base: {ref: .base.ref, sha: .base.sha}, head: {ref: .head.ref, sha: .head.sha}}'

printf '%s\n' '=== Requested commit ==='
git show -s --format=fuller "$head"
git cat-file -e "${head}^{commit}"

base=$(gh api "repos/${repo}/pulls/${pr}" --jq '.base.sha')
remote_head=$(gh api "repos/${repo}/pulls/${pr}" --jq '.head.sha')
printf 'Requested head: %s\nGitHub head: %s\nGitHub base: %s\n' "$head" "$remote_head" "$base"

printf '%s\n' '=== Pull request commits ==='
gh api "repos/${repo}/pulls/${pr}/commits?per_page=100" \
  --jq '.[] | {sha, message: .commit.message}'

printf '%s\n' '=== Pull request changed files ==='
gh api "repos/${repo}/pulls/${pr}/files?per_page=100" \
  --jq '.[] | {filename, status, additions, deletions}'

if git cat-file -e "${base}^{commit}" 2>/dev/null; then
  printf '%s\n' '=== Complete pull request delta ==='
  git diff --stat "${base}...${head}"
  git diff --name-status "${base}...${head}"
  git diff --find-renames --find-copies "${base}...${head}"
else
  echo 'GitHub base commit is unavailable in the local clone.' >&2
fi

Length of output: 15071


🏁 Script executed:

#!/bin/bash
set -euo pipefail

src='crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs'
test_file='crates/cmtraceopen-parser/tests/sccm_server_intake.rs'

printf '%s\n' '=== Production-file outline ==='
ast-grep outline "$src" --items all

printf '%s\n' '=== Test-file outline ==='
ast-grep outline "$test_file" --items all

printf '%s\n' '=== Intake flow, prepared ordering, and normalization ==='
sed -n '120,350p' "$src"
sed -n '430,570p' "$src"

printf '%s\n' '=== Handle validation and role sorting ==='
sed -n '940,1160p' "$src"

printf '%s\n' '=== All affected identity and ordering symbol uses ==='
rg -n -C 5 --type rust \
  'PathFingerprintKey|CanonicalArtifactIdentity|path_fingerprint_key|canonical_identity|path_fingerprint_lineages|canonical_artifact_identities|sort_key\s*\(|prepared\.sort_by' \
  crates/cmtraceopen-parser/src

printf '%s\n' '=== New and adjacent intake tests ==='
sed -n '230,490p' "$test_file"

printf '%s\n' '=== Synthetic fixture handles and role validation context ==='
rg -n -C 4 --glob '*.rs' --glob '*.json' --glob '*.yaml' --glob '*.yml' \
  'synthetic:(host:(site-01|mp-01)|subject:(dp-01|dp-02|sup-01))|distributionPoint' \
  crates/cmtraceopen-parser

Length of output: 201738


🏁 Script executed:

#!/bin/bash
set -euo pipefail

src='crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs'
test_file='crates/cmtraceopen-parser/tests/sccm_server_intake.rs'

printf '%s\n' '=== Identity aliases and intake duplicate checks ==='
sed -n '1,40p' "$src"
sed -n '150,295p' "$src"

printf '%s\n' '=== Prepared artifact sort key ==='
sed -n '295,345p' "$src"

printf '%s\n' '=== Normalization and key construction ==='
sed -n '430,550p' "$src"

printf '%s\n' '=== Handle and workflow-subject validation ==='
sed -n '960,1095p' "$src"

printf '%s\n' '=== Complete added test block ==='
sed -n '300,470p' "$test_file"

printf '%s\n' '=== Exact references to affected keys within intake.rs ==='
rg -n --type rust \
  'path_fingerprint_lineages\.(get|insert|contains)|canonical_artifact_identities\.(get|insert|contains)|path_fingerprint_key|canonical_identity|prepared\.sort_by' \
  "$src"

Length of output: 26135


@adamgell Fresh full review completed for #430 at 4a330621fdb69303ba77d9137d4127a7ba628854.

I found no actionable issues.

The requested commit matches the current pull request head. The integration-base merge adds no files to the pull request delta.

The identity keys now include producer-host and workflow-subject handles. The duplicate checks use these scoped keys consistently. The artifact sort key uses the same provenance fields before the existing ordering fields. The tests cover distinct hosts, distinct workflow subjects, true duplicates, lineage checks, and reversed-manifest deterministic output.

I performed a static review. I did not execute repository tests in this environment.

✅ Action performed

Full review finished.


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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

@adamgell
adamgell marked this pull request as ready for review August 1, 2026 23:06
@adamgell
adamgell merged commit 2d3c2b0 into codex/parser-family-skeleton Aug 1, 2026
11 checks passed
@adamgell
adamgell deleted the codex/sccm-335-host-identity-repair 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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants