Repository navigation
test(sccm): reject cyclic advanced-role supersession - #442
Conversation
📝 WalkthroughWalkthroughThe catalog test now builds a supersession graph and detects self-referential and multi-card cycles. Cards in cycles receive ChangesSupersession validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
|
@coderabbitai review Please review exact head |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="codex/parser-family-skeleton"
head="410af9d7bbc6fe967233ed9d7d910c57d8d31b39"
printf '%s\n' '== Requested references =='
git rev-parse --verify "${base}^{commit}"
git rev-parse --verify "${head}^{commit}"
printf '%s\n' '== Changed files in exact range =='
git diff --name-status "${base}...${head}"
printf '%s\n' '== Exact diff =='
git diff --find-renames --find-copies --unified=80 "${base}...${head}"
printf '%s\n' '== Rust file outlines near catalog symbols =='
fd -e rs . | xargs -r ast-grep outline --items all --type function,struct,enum,impl --match 'Sccm|Advanced|Role|Catalog|Inventory|supersed' 2>/dev/null || true
printf '%s\n' '== Supersession-related definitions and uses =='
rg -n -i -C 4 'superseded[_ ]?by|supersedes|supersession|cycle|advanced.role' -g '*.rs' .Length of output: 1189 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== Current checkout =='
git status --short --branch
git rev-parse --verify HEAD
git show -s --format='HEAD %H%nParents: %P%nSubject: %s%nDecorations: %D' HEAD
printf '%s\n' '== Remotes =='
git remote -v
printf '%s\n' '== Local and remote refs relevant to the requested range =='
git for-each-ref \
--format='%(refname:short) %(objectname) %(subject)' \
refs/heads refs/remotes refs/tags \
| rg -i '(^|/)(442|codex/parser-family-skeleton)$|410af9d7|parser-family-skeleton' \
|| true
printf '%s\n' '== Probe known commit and pull-request refs, without modifying refs =='
for ref in \
410af9d7bbc6fe967233ed9d7d910c57d8d31b39 \
'refs/pull/442/head' \
'refs/remotes/origin/pr/442' \
'refs/remotes/origin/pull/442/head' \
'refs/remotes/origin/codex/parser-family-skeleton'
do
if git rev-parse --verify --quiet "${ref}^{commit}" >/dev/null; then
printf 'available: %s -> %s\n' "$ref" "$(git rev-parse "${ref}^{commit}")"
else
printf 'unavailable: %s\n' "$ref"
fi
done
printf '%s\n' '== Recent reachable commits =='
git log --oneline --decorate -n 30Length of output: 3941 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="adamgell/cmtraceopen"
base="codex/parser-family-skeleton"
head="410af9d7bbc6fe967233ed9d7d910c57d8d31b39"
printf '%s\n' '== GitHub exact comparison metadata and changed files =='
gh api \
-H 'Accept: application/vnd.github+json' \
"repos/${repo}/compare/${base}...${head}" \
--jq '{status, ahead_by, behind_by, merge_base_commit: {sha: .merge_base_commit.sha}, files: [.files[] | {filename, status, additions, deletions, patch}]}' \
|| true
printf '%s\n' '== Local implementation commit diff =='
git diff --find-renames --find-copies --unified=100 HEAD^ HEAD
printf '%s\n' '== Files changed by the RED and GREEN commits =='
git diff-tree --no-commit-id --name-status -r f62b52996eb72da68c4d87df9c2300e9b3488cd9
git diff-tree --no-commit-id --name-status -r HEAD
printf '%s\n' '== Candidate Rust source files =='
fd -e rs . | rg -i 'sccm|advanced|role|catalog'
printf '%s\n' '== Supersession validation definitions and test cases =='
rg -n -i -C 8 \
'supersessionCycleDetected|supersededBy|supersedes|cycle.*detect|detect.*cycle' \
-g '*.rs' .Length of output: 52865
No actionable findings. ✅ Action performedReview finished.
|
There was a problem hiding this comment.
Pull request overview
This PR hardens the SCCM server advanced-role source-card catalog contract tests by rejecting supersession cycles (including self-references) and ensuring every member of a detected cycle is deterministically marked with the supersessionCycleDetected violation, preventing semantic admission.
Changes:
- Added catalog-level validation (
validate_catalog) that layers cycle detection on top of existing per-card + inventory validation. - Implemented directed-graph cycle detection over supersession relationships and applied a fail-closed violation to all cycle members.
- Updated the catalog contract test to use catalog-level validation and added a dedicated regression test covering self-cycles, multi-card cycles, and reciprocal (non-cyclic) metadata.
* test(sccm): reject cyclic advanced-role supersession * fix(sccm): reject cyclic advanced-role supersession
Scope
Closes one source-card admission gap in the advanced-role catalog contract: self-referential and multi-card supersession cycles now fail closed and every cycle member receives the deterministic
supersessionCycleDetectedviolation.This is deliberately a catalog/fixture-gate hardening slice. It does not add an advanced-role parser, reducer, native collector, live Windows validation, or broader role support.
Test-first evidence
f62b5299: self and three-card cycles were accepted by the existing inventory validator.410af9d7: graph validation rejects closed cycles while preserving legitimate reciprocalsupersededBy/supersedesmetadata as one predecessor-to-successor edge.Verification
cargo test --locked -p cmtraceopen-parser --test sccm_server_advanced_roles_catalog— 7 passedcargo test --locked -p cmtraceopen-parser— passedcargo clippy --locked -p cmtraceopen-parser --all-targets --all-features -- -D warnings— passedrustup run 1.88.0 cargo check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown --all-features— passedrustfmt --check— passedgit diff --check— passedRepository-wide
cargo fmt --all -- --checkremains red only on inherited files outside this one-file slice; no formatter spill is included.Tracks #334. The issue remains open after this slice because advanced roles remain source-card candidates rather than accepted production analyzers.
Summary by CodeRabbit