Skip to content

test(sccm): reject cyclic advanced-role supersession - #442

Merged
adamgell merged 2 commits into
codex/parser-family-skeletonfrom
codex/sccm-334-cycle-hardening-r29
Aug 2, 2026
Merged

adamgell merged 2 commits into
codex/parser-family-skeletonfrom
codex/sccm-334-cycle-hardening-r29

Conversation

@adamgell

@adamgell adamgell commented Aug 2, 2026 •

Copy link
Copy Markdown
Owner

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 supersessionCycleDetected violation.

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

  • RED f62b5299: self and three-card cycles were accepted by the existing inventory validator.
  • GREEN 410af9d7: graph validation rejects closed cycles while preserving legitimate reciprocal supersededBy / supersedes metadata as one predecessor-to-successor edge.
  • Independent review reproduced RED, probed longer/disconnected cycles, unknown targets, asymmetric metadata, duplicate IDs, deterministic ordering, and returned no P0-P3 findings.

Verification

  • cargo test --locked -p cmtraceopen-parser --test sccm_server_advanced_roles_catalog — 7 passed
  • cargo test --locked -p cmtraceopen-parser — passed
  • cargo clippy --locked -p cmtraceopen-parser --all-targets --all-features -- -D warnings — passed
  • rustup run 1.88.0 cargo check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown --all-features — passed
  • scoped Rust 1.88 rustfmt --check — passed
  • git diff --check — passed
  • local committed-range CodeRabbit — no findings

Repository-wide cargo fmt --all -- --check remains 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

  • Bug Fixes
    • Improved catalog validation for supersession relationships.
    • Catalogs containing self-references or circular chains are now correctly identified as invalid.
    • Affected entries are prevented from being admitted, reducing the risk of inconsistent or unusable catalog data.
    • Added validation coverage for multi-entry cycles and valid reciprocal predecessor/successor relationships.

@adamgell adamgell self-assigned this Aug 2, 2026
@github-actions github-actions Bot added enhancement New feature or request parser Log parser related sccm SCCM/ConfigMgr related test Testing related labels Aug 2, 2026
@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The catalog test now builds a supersession graph and detects self-referential and multi-card cycles. Cards in cycles receive supersessionCycleDetected, become invalid, and cannot enter semantic admission. Inventory validation now runs at catalog level.

Changes

Supersession validation

Layer / File(s) Summary
Catalog cycle detection
crates/cmtraceopen-parser/tests/sccm_server_advanced_roles_catalog.rs
Adds graph-based catalog validation and rejects cards that participate in supersession cycles. The source-card inventory test now uses validate_catalog.
Cycle validation coverage
crates/cmtraceopen-parser/tests/sccm_server_advanced_roles_catalog.rs
Adds coverage for self-cycles, three-card cycles, and valid reciprocal predecessor and successor links.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: copilot

🚥 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 main change: rejecting cyclic advanced-role supersession.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@adamgell

adamgell commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please review exact head 410af9d7bbc6fe967233ed9d7d910c57d8d31b39 against codex/parser-family-skeleton. This is a one-file advanced-role source-card catalog-contract hardening slice; report only actionable findings and do not push code.

@adamgell
adamgell requested a review from Copilot August 2, 2026 13:13
@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
🧩 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 30

Length 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


@adamgell Reviewed exact head 410af9d7bbc6fe967233ed9d7d910c57d8d31b39 against codex/parser-family-skeleton.

No actionable findings.

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

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

@adamgell
adamgell marked this pull request as ready for review August 2, 2026 20:04
@adamgell
adamgell merged commit 76784c3 into codex/parser-family-skeleton Aug 2, 2026
12 checks passed
adamgell added a commit that referenced this pull request Aug 4, 2026
* test(sccm): reject cyclic advanced-role supersession

* fix(sccm): reject cyclic advanced-role supersession
@adamgell
adamgell deleted the codex/sccm-334-cycle-hardening-r29 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

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