Repository navigation
fix(sccm): scope server intake identities by provenance - #430
Conversation
📝 WalkthroughWalkthroughThe 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. ChangesSCCM artifact identity
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Comment |
|
@coderabbitai full review |
✅ Action performedFull 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. |
There was a problem hiding this comment.
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);
|
@coderabbitai full review\n\nPlease review exact head |
🧩 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 allLength 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/srcLength 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.rsLength 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
fiLength of output: 14632
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 I performed a static review. I did not execute repository tests in this sandbox. ✅ Action performedFull 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. |
|
Independent exact-head re-review at |
…to codex/sccm-335-host-identity-repair
|
@coderabbitai full review Please perform a fresh full review of exact head 4a33062 after the integration-base merge. |
🧩 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
fiLength 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-parserLength 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
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 performedFull 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. |
Refs #335 and #317.
What changed
DuplicateArtifactrejection when caller-chosen artifact/root labels relabel the same host-and-subject identity.Root cause
The intake model already validated and projected
producerHostHandleandworkflowSubject.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:GREEN on
2e0bd691:Verification
cargo test --locked -p cmtraceopen-parser --test sccm_server_intake— pass, 16/16cargo test --locked -p cmtraceopen-parser --test sccm_spine_contract— pass, 138/138cargo test --locked -p cmtraceopen-parser— passcargo check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown— passcargo clippy --locked -p cmtraceopen-parser --all-targets -- -D warnings— passrustfmt --check— passnpx --no-install tsc --noEmit— passgit diff --check 065b8cb7..HEAD— passcargo fmt --check --allremains 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
Tests
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:dp-02subject handle and uses DP-shaped handles in DP tests.Review-fix RED reproduced caller-ID ordering and rejected
dp-02asInvalidArtifact; all listed gates were rerun GREEN at exact headb3ebb5b1414a18eb180c654ae34479f3b6a51132.