Repository navigation
feat(sccm): admit hierarchy source contracts - #498
Conversation
📝 WalkthroughWalkthroughThe parser now declares versioned SCCM hierarchy source contracts, validates hierarchy intake metadata and topology, and records categorized admission gaps. It also classifies structured site-database supplements and preserves valid or invalid supplement states as admission or coverage-only outcomes. ChangesSCCM hierarchy source contracts
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant RawManifest
participant ServerIntake
participant ServerSourceCatalog
participant ParsedHierarchyRecord
participant ArtifactAssessment
RawManifest->>ServerIntake: provide contract version, links, direction, and supplement metadata
ServerIntake->>ServerSourceCatalog: resolve source contract and rotation policy
ServerIntake->>ParsedHierarchyRecord: validate component and hierarchy evidence
ParsedHierarchyRecord-->>ServerIntake: return component and key evidence
ServerIntake->>ArtifactAssessment: record admission status, gaps, provenance, and eligibility
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/cmtraceopen-parser/src/sccm/server/windows/catalog.rs (1)
289-321: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRecord why the supplement spec is excluded from the public catalog.
classify_declared_server_sourceadmitsSERVER_STRUCTURED_SUPPLEMENT_SPEC, but the publicdeclared_server_source_catalog()at line 299 still returns onlySERVER_SOURCE_SPECS. An external consumer that enumerates the catalog therefore never seesserver-hierarchy-site-database, while intake accepts it. That split looks intentional, because the plan keeps database collection out of discovery scope, but nothing in the code says so. Add a comment on the constant that states the supplement is admission-only and must never enter discovery enumeration. Without it, a later change will "fix" the omission and turn the site database into a discoverable source.Proposed fix
+// Admission-only source. Intake classifies an explicitly authorized site-database +// supplement, but discovery must never enumerate or request it. Keep this spec out +// of `declared_server_source_catalog()`. const SERVER_STRUCTURED_SUPPLEMENT_SPEC: SccmServerSourceSpec = SccmServerSourceSpec {🤖 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/server/windows/catalog.rs` around lines 289 - 321, Add a comment immediately above SERVER_STRUCTURED_SUPPLEMENT_SPEC documenting that this supplement is admission-only, intentionally excluded from declared_server_source_catalog discovery enumeration, and must not become a discoverable source. Leave classify_declared_server_source and declared_server_source_catalog behavior unchanged.
🤖 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.
Inline comments:
In `@crates/cmtraceopen-parser/src/sccm/server/windows/catalog.rs`:
- Around line 7-34: Document every new public API in
crates/cmtraceopen-parser/src/sccm/server/windows/catalog.rs lines 7-34 and the
declared_hierarchy_source_contracts function around line 94, including both
constants, SccmServerHierarchyDirection, SccmServerHierarchySourceContract and
its public fields, and allows_rotation; explain manifest deserialization, the
meanings of contract values, and that direction is never inferred from basename,
component, or rotation. Document SccmServerHierarchyAdmission,
SccmServerHierarchyAdmissionGap, SccmServerSupplementAdmission, and
SccmServerSupplementGap in
crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs lines 629-683,
stating that any gap keeps artifacts coverage-only with no semantic evidence and
that sorted gap variants serialize in declaration order.
In `@crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs`:
- Around line 3943-3946: Rename the wire fields in the supplement parsing path
from operatorAuthorized and privacyClass to supplementOperatorAuthorized and
supplementPrivacyClass, keeping their Rust mappings to
supplement_operator_authorized and supplement_privacy_class. Update
RawServerArtifact::KNOWN_FIELDS, the related assertion, and
site_database_supplement_manifest so all accepted manifest field names use the
consistent supplement prefix.
- Around line 1720-1743: Align synthetic hierarchy-link endpoint values with the
identifiers produced by normalize_topology, covering both site codes and host
handles so validated_direction can recognize synthetic Origin links. Update the
relevant normalization logic, especially normalize_hierarchy_link and its
synthetic vocabulary, then add a syntheticFixture direction test asserting
Some(SccmServerHierarchyDirection::Origin) and no unintended
UnvalidatedDirection gap.
- Around line 571-573: Update the public hierarchy fields in the relevant
artifact struct by adding serde’s skip-when-none attribute to direction,
matching hierarchy_admission and the neighboring fields. Preserve the existing
direction assignment from hierarchy_admission.direction while ensuring
non-hierarchy artifacts omit direction from serialized JSON when it is None.
- Around line 1744-1759: Document at the unconditional
SccmServerHierarchyAdmissionGap::UnvalidatedKeys push that production hierarchy
artifacts are intentionally coverage-only until Task 3 key gating, so the
resulting eligibility clearing and unreachable Exact confidence are explicit.
Update live_like_manifest_preserves_missing_version_topology_direction_and_keys
and component_token_outside_a_valid_ccm_record_is_not_component_evidence to
assert the specific expected gap set rather than relying on evidence.is_empty(),
including UnvalidatedKeys and any other applicable gaps.
- Around line 1568-1573: Update the error match around validate_payload_contract
so structured supplements downgrade only payload-content errors, while
structural violations such as PayloadLengthMismatch and UnexpectedPayload still
return Err and fail closed. Reclassify length mismatches without reporting them
as MalformedPayload, and verify the supplement matrix in
sccm_server_hierarchy_source_contract.rs still passes, especially
malformed-payload and oversized-for-cap cases.
In `@crates/cmtraceopen-parser/tests/sccm_server_hierarchy_source_contract.rs`:
- Around line 58-72: Extend the intake tests around the existing hierarchy
admission assessment to add a wrong-rotation case using rotation kind `lo` with
basename `replmgr.lo_`, and assert that it produces
`SccmServerHierarchyAdmissionGap::RotationMismatch` because `replmgr` only
permits `CURRENT_ROTATION`. Also add an order-independence case that feeds the
same artifacts in reverse order and asserts both assessments are equal.
- Around line 53-55: Replace the ineffective logical_name check in the SCCM
hierarchy contract test with an assertion over the relevant sender contract
row’s rotation permissions. Use the existing contract fields and rotation
symbols to verify that no sender row permits LO_ROTATION, while preserving
checks for unrelated sender behavior.
In `@docs/superpowers/plans/2026-08-04-sccm-481-hierarchy-source-contracts.md`:
- Line 17: Promote every “### Task N” heading in the document to “## Task N” so
heading levels descend sequentially from the top-level title and remain
consistent with the existing “## Self-review” heading.
- Line 229: Replace the en dash in the “Spec coverage” sentence’s “Tasks 1–5”
range with an ASCII hyphen or “through,” preserving the rest of the sentence
unchanged.
- Around line 201-213: Add the missing live-lab-5.00.9141.1000 fixture directory
and input data, then update the fixture-loading test and exact fixture matrix to
include this scenario. Ensure sccm_server_hierarchy_source_contract.rs loads and
exercises the new fixture, while preserving the existing inline-data coverage
and listed validation commands.
---
Outside diff comments:
In `@crates/cmtraceopen-parser/src/sccm/server/windows/catalog.rs`:
- Around line 289-321: Add a comment immediately above
SERVER_STRUCTURED_SUPPLEMENT_SPEC documenting that this supplement is
admission-only, intentionally excluded from declared_server_source_catalog
discovery enumeration, and must not become a discoverable source. Leave
classify_declared_server_source and declared_server_source_catalog behavior
unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 06c2a4b8-9ce7-46c4-b2a5-f00c22c7f943
📒 Files selected for processing (4)
crates/cmtraceopen-parser/src/sccm/server/windows/catalog.rscrates/cmtraceopen-parser/src/sccm/server/windows/intake.rscrates/cmtraceopen-parser/tests/sccm_server_hierarchy_source_contract.rsdocs/superpowers/plans/2026-08-04-sccm-481-hierarchy-source-contracts.md
| pub const SCCM_SERVER_HIERARCHY_SOURCE_CONTRACT_VERSION: u32 = 1; | ||
| pub const SCCM_SERVER_SITE_DATABASE_SCHEMA_VERSION: u32 = 1; | ||
|
|
||
| #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub enum SccmServerHierarchyDirection { | ||
| Origin, | ||
| Target, | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
| pub(crate) enum SccmServerHierarchyRotationContract { | ||
| Current, | ||
| LoUnderscore, | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct SccmServerHierarchySourceContract { | ||
| pub contract_version: u32, | ||
| pub source_id: &'static str, | ||
| pub logical_name: &'static str, | ||
| pub producer_role: SccmRole, | ||
| pub expected_component: &'static str, | ||
| pub(crate) allowed_rotations: &'static [SccmServerHierarchyRotationContract], | ||
| } | ||
|
|
||
| impl SccmServerHierarchySourceContract { | ||
| pub fn allows_rotation(&self, rotation: &SccmRotation) -> bool { |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
New public API on a published crate carries no documentation. This PR adds two public constants, six public types, one public method, and one public function to cmtraceopen-parser, and none of them have doc comments. Each is a semver commitment. The meanings are not self-evident: a reader cannot tell from the signatures that a non-empty gaps list forces coverage-only, that contract_version: None means no supported version was declared, or that direction is never inferred from a basename.
crates/cmtraceopen-parser/src/sccm/server/windows/catalog.rs#L7-L34: documentSCCM_SERVER_HIERARCHY_SOURCE_CONTRACT_VERSION,SCCM_SERVER_SITE_DATABASE_SCHEMA_VERSION,SccmServerHierarchyDirection,SccmServerHierarchySourceContractwith its public fields,allows_rotation, anddeclared_hierarchy_source_contractsat line 94. State thatSccmServerHierarchyDirectionalso deserializes from the manifest, sooriginandtargetare input contract values, and state that direction is never inferred from basename, component, or rotation.crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs#L629-L683: documentSccmServerHierarchyAdmission,SccmServerHierarchyAdmissionGap,SccmServerSupplementAdmission, andSccmServerSupplementGap. State that any gap means the artifact stays coverage-only and produces no semantic evidence. Both gap enums deriveOrdand are sorted before serialization, so record that variant declaration order is the observable output order.
As per path instructions: "Published library crate (cmtraceopen-parser). Treat every public item as a semver commitment: flag breaking changes to public types, signatures, or enum variants, and check that new public items are documented."
📍 Affects 2 files
crates/cmtraceopen-parser/src/sccm/server/windows/catalog.rs#L7-L34(this comment)crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs#L629-L683
🤖 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/server/windows/catalog.rs` around lines 7
- 34, Document every new public API in
crates/cmtraceopen-parser/src/sccm/server/windows/catalog.rs lines 7-34 and the
declared_hierarchy_source_contracts function around line 94, including both
constants, SccmServerHierarchyDirection, SccmServerHierarchySourceContract and
its public fields, and allows_rotation; explain manifest deserialization, the
meanings of contract values, and that direction is never inferred from basename,
component, or rotation. Document SccmServerHierarchyAdmission,
SccmServerHierarchyAdmissionGap, SccmServerSupplementAdmission, and
SccmServerSupplementGap in
crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs lines 629-683,
stating that any gap keeps artifacts coverage-only with no semantic evidence and
that sorted gap variants serialize in declaration order.
Source: Path instructions
| pub direction: Option<SccmServerHierarchyDirection>, | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub hierarchy_admission: Option<SccmServerHierarchyAdmission>, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win
direction duplicates hierarchy_admission.direction and serializes unconditionally.
Line 1801 sets direction from hierarchy_admission.direction, so the two public fields can never disagree and one of them is redundant state. Line 571 also omits skip_serializing_if, unlike every other field added at lines 572-583. Every non-hierarchy artifact therefore gains a "direction": null key in the public JSON. Add the skip attribute so the new hierarchy surface stays absent for non-hierarchy artifacts.
Proposed fix
+ #[serde(skip_serializing_if = "Option::is_none")]
pub direction: Option<SccmServerHierarchyDirection>,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| pub direction: Option<SccmServerHierarchyDirection>, | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub hierarchy_admission: Option<SccmServerHierarchyAdmission>, | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub direction: Option<SccmServerHierarchyDirection>, | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub hierarchy_admission: Option<SccmServerHierarchyAdmission>, |
🤖 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/server/windows/intake.rs` around lines 571
- 573, Update the public hierarchy fields in the relevant artifact struct by
adding serde’s skip-when-none attribute to direction, matching
hierarchy_admission and the neighboring fields. Preserve the existing direction
assignment from hierarchy_admission.direction while ensuring non-hierarchy
artifacts omit direction from serialized JSON when it is None.
| let (bytes, capture_provenance, payload_error) = | ||
| match validate_payload_contract(&artifact, relative_path.as_deref(), payload_by_id) { | ||
| Ok((bytes, capture_provenance)) => (bytes, capture_provenance, None), | ||
| Err(error) if is_structured_supplement => (None, None, Some(error)), | ||
| Err(error) => return Err(error), | ||
| }; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Swallowing every validate_payload_contract error for supplements publishes unverified provenance.
Line 1571 downgrades all SccmServerIntakeError values to a gap when is_structured_supplement is true. That includes structural violations, not only payload content problems:
PayloadLengthMismatch:artifact.bytes_copiedno longer matches the supplied payload length. Line 1820 still publishes that count, andartifact_string_bytesfolds the artifact into the intake integrity seal. The manifest byte count is then sealed without ever being verified against the bytes.UnexpectedPayload: a caller can attach payload bytes to anabsent,accessDenied, orskippedsupplement artifact. The bytes are counted byvalidate_manifest_boundsand then silently discarded.
For every other source these are hard failures. Restrict the swallow to the errors that describe payload content, and keep structural manifest violations fail-closed. This also removes the conflation at line 1305, where MalformedPayload is reported for a length mismatch.
Proposed fix
let (bytes, capture_provenance, payload_error) =
match validate_payload_contract(&artifact, relative_path.as_deref(), payload_by_id) {
Ok((bytes, capture_provenance)) => (bytes, capture_provenance, None),
- Err(error) if is_structured_supplement => (None, None, Some(error)),
+ Err(error)
+ if is_structured_supplement
+ && matches!(
+ error,
+ SccmServerIntakeError::InvalidPayloadEncoding
+ | SccmServerIntakeError::InvalidArtifact
+ | SccmServerIntakeError::MissingPayload
+ ) =>
+ {
+ (None, None, Some(error))
+ }
Err(error) => return Err(error),
};Confirm the supplement matrix in crates/cmtraceopen-parser/tests/sccm_server_hierarchy_source_contract.rs still passes with the narrowed set, because the "malformed payload" and "oversized for cap" cases depend on which error validate_payload_contract returns.
🤖 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/server/windows/intake.rs` around lines
1568 - 1573, Update the error match around validate_payload_contract so
structured supplements downgrade only payload-content errors, while structural
violations such as PayloadLengthMismatch and UnexpectedPayload still return Err
and fail closed. Reclassify length mismatches without reporting them as
MalformedPayload, and verify the supplement matrix in
sccm_server_hierarchy_source_contract.rs still passes, especially
malformed-payload and oversized-for-cap cases.
| let validated_direction = match direction { | ||
| Some(SccmServerHierarchyDirection::Origin) | ||
| if hierarchy_links.iter().any(|link| { | ||
| link.origin_site_code == site_handle | ||
| && link.origin_host_handle | ||
| == artifact.producer_host_handle.as_deref().unwrap_or_default() | ||
| }) => | ||
| { | ||
| Some(SccmServerHierarchyDirection::Origin) | ||
| } | ||
| Some(SccmServerHierarchyDirection::Target) | ||
| if hierarchy_links.iter().any(|link| { | ||
| link.target_site_code == site_handle | ||
| && link.target_host_handle | ||
| == artifact.producer_host_handle.as_deref().unwrap_or_default() | ||
| }) => | ||
| { | ||
| Some(SccmServerHierarchyDirection::Target) | ||
| } | ||
| _ => None, | ||
| }; | ||
| if validated_direction.is_none() { | ||
| gaps.push(SccmServerHierarchyAdmissionGap::UnvalidatedDirection); | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Direction can never validate for a synthetic fixture.
The synthetic topology vocabulary and the synthetic link vocabulary use different namespaces, so the comparison at lines 1723 and 1732 cannot succeed.
normalize_topologyline 1110 mapstopology.siteCode == "LAB"tosite_handle = "synthetic:site:lab".normalize_hierarchy_linkline 1177 requires the raw valuelink.origin_site_code == "LAB"and stores it unmapped.- Line 1723 compares
"LAB"against"synthetic:site:lab".
The host comparison fails the same way. normalize_topology line 1118 produces "synthetic:host:lab-cm01", while the synthetic link vocabulary at lines 1178 and 1184 uses "synthetic:host:site-01", "synthetic:host:site-02", and "synthetic:host:site-03".
validated_direction is therefore always None for a synthetic fixture, and UnvalidatedDirection is always a gap. Synthetic fixtures skip the unconditional UnvalidatedKeys push at line 1745, so this is the one path where a hierarchy artifact could otherwise reach SccmKeyConfidence::Exact and keep its evidence. That path is dead.
No test covers it. Every direction test in crates/cmtraceopen-parser/tests/sccm_server_hierarchy_source_contract.rs uses syntheticFixture: false.
Normalize the synthetic link endpoints through the same mapping normalize_topology applies, or align the two synthetic vocabularies. Then add a synthetic-fixture direction test that asserts Some(SccmServerHierarchyDirection::Origin).
🤖 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/server/windows/intake.rs` around lines
1720 - 1743, Align synthetic hierarchy-link endpoint values with the identifiers
produced by normalize_topology, covering both site codes and host handles so
validated_direction can recognize synthetic Origin links. Update the relevant
normalization logic, especially normalize_hierarchy_link and its synthetic
vocabulary, then add a syntheticFixture direction test asserting
Some(SccmServerHierarchyDirection::Origin) and no unintended
UnvalidatedDirection gap.
| if !synthetic_fixture { | ||
| gaps.push(SccmServerHierarchyAdmissionGap::UnvalidatedKeys); | ||
| } | ||
| gaps.sort(); | ||
| gaps.dedup(); | ||
| let confidence = if gaps.is_empty() { | ||
| SccmKeyConfidence::Exact | ||
| } else { | ||
| SccmKeyConfidence::Low | ||
| }; | ||
| let profile_id = profile.map(|profile| profile.profile_id); | ||
| if !synthetic_fixture && !gaps.is_empty() { | ||
| parser_eligible = false; | ||
| profile_eligible = false; | ||
| evidence.clear(); | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
State that the unconditional UnvalidatedKeys push makes production admission always coverage-only.
Line 1745 pushes UnvalidatedKeys for every non-synthetic hierarchy artifact with no condition. gaps is therefore never empty in production, so line 1755 always fires. Three consequences follow, and none of them are visible at the call site:
parser_eligible,profile_eligible, andevidenceare always cleared for production hierarchy artifacts.SccmKeyConfidence::Exactat line 1750 is unreachable in production.contract_version,component,RotationMismatch, andComponentMismatchbecome reporting only. None of them can change the eligibility outcome.
This matches the plan, which defers key gating to Task 3. Record that in the code. Without a comment, a reader cannot separate "always a gap by design" from a missing condition, and a later change will remove the wrong line.
The same property weakens the tests. live_like_manifest_preserves_missing_version_topology_direction_and_keys and component_token_outside_a_valid_ccm_record_is_not_component_evidence both assert evidence.is_empty(), and that assertion holds even if hierarchy_contract_status returns nothing at all. Assert the specific gap set instead of the eligibility side effect.
Proposed fix
+ // Task 3 has not yet bound hierarchy keys to a validated profile. Until it
+ // does, no production hierarchy artifact may carry exact keys, so this gap
+ // is unconditional and every production artifact stays coverage-only below.
if !synthetic_fixture {
gaps.push(SccmServerHierarchyAdmissionGap::UnvalidatedKeys);
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if !synthetic_fixture { | |
| gaps.push(SccmServerHierarchyAdmissionGap::UnvalidatedKeys); | |
| } | |
| gaps.sort(); | |
| gaps.dedup(); | |
| let confidence = if gaps.is_empty() { | |
| SccmKeyConfidence::Exact | |
| } else { | |
| SccmKeyConfidence::Low | |
| }; | |
| let profile_id = profile.map(|profile| profile.profile_id); | |
| if !synthetic_fixture && !gaps.is_empty() { | |
| parser_eligible = false; | |
| profile_eligible = false; | |
| evidence.clear(); | |
| } | |
| // Task 3 has not yet bound hierarchy keys to a validated profile. Until it | |
| // does, no production hierarchy artifact may carry exact keys, so this gap | |
| // is unconditional and every production artifact stays coverage-only below. | |
| if !synthetic_fixture { | |
| gaps.push(SccmServerHierarchyAdmissionGap::UnvalidatedKeys); | |
| } | |
| gaps.sort(); | |
| gaps.dedup(); | |
| let confidence = if gaps.is_empty() { | |
| SccmKeyConfidence::Exact | |
| } else { | |
| SccmKeyConfidence::Low | |
| }; | |
| let profile_id = profile.map(|profile| profile.profile_id); | |
| if !synthetic_fixture && !gaps.is_empty() { | |
| parser_eligible = false; | |
| profile_eligible = false; | |
| evidence.clear(); | |
| } |
🤖 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/server/windows/intake.rs` around lines
1744 - 1759, Document at the unconditional
SccmServerHierarchyAdmissionGap::UnvalidatedKeys push that production hierarchy
artifacts are intentionally coverage-only until Task 3 key gating, so the
resulting eligibility clearing and unreachable Exact confidence are explicit.
Update live_like_manifest_preserves_missing_version_topology_direction_and_keys
and component_token_outside_a_valid_ccm_record_is_not_component_evidence to
assert the specific expected gap set rather than relying on evidence.is_empty(),
including UnvalidatedKeys and any other applicable gaps.
| assert!(!contracts | ||
| .iter() | ||
| .any(|contract| contract.logical_name == "sender.lo_")); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
This assertion can never fail, so it does not pin the rule it claims to pin.
logical_name never carries a rotation suffix. classify_artifact_name sets it from the basename stem and keeps rotation in a separate field, so no contract row can ever hold the value "sender.lo_".
The plan rule is that no sender row permits the lo_ rotation. Assert that directly. As written, the test still passes if someone adds a sender row with LO_ROTATION, which is the exact row the rule forbids.
Proposed fix
- assert!(!contracts
- .iter()
- .any(|contract| contract.logical_name == "sender.lo_"));
+ assert!(
+ !contracts.iter().any(|contract| contract.logical_name == "sender"
+ && contract.allows_rotation(&SccmRotation::LoUnderscore)),
+ "the lab never observed sender.lo_"
+ );📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| assert!(!contracts | |
| .iter() | |
| .any(|contract| contract.logical_name == "sender.lo_")); | |
| assert!( | |
| !contracts.iter().any(|contract| contract.logical_name == "sender" | |
| && contract.allows_rotation(&SccmRotation::LoUnderscore)), | |
| "the lab never observed sender.lo_" | |
| ); |
🤖 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/tests/sccm_server_hierarchy_source_contract.rs`
around lines 53 - 55, Replace the ineffective logical_name check in the SCCM
hierarchy contract test with an assertion over the relevant sender contract
row’s rotation permissions. Use the existing contract fields and rotation
symbols to verify that no sender row permits LO_ROTATION, while preserving
checks for unrelated sender behavior.
| #[test] | ||
| fn catalog_contract_rows_have_distinct_rotation_policies() { | ||
| let contracts = declared_hierarchy_source_contracts(); | ||
| let rcmctrl = contracts | ||
| .iter() | ||
| .filter(|contract| contract.logical_name == "rcmctrl") | ||
| .collect::<Vec<&SccmServerHierarchySourceContract>>(); | ||
| assert_eq!(rcmctrl.len(), 2); | ||
| assert_ne!( | ||
| rcmctrl[0].allows_rotation(&SccmRotation::Current), | ||
| rcmctrl[1].allows_rotation(&SccmRotation::Current) | ||
| ); | ||
| assert!(rcmctrl[0].allows_rotation(&SccmRotation::Current)); | ||
| assert!(rcmctrl[1].allows_rotation(&SccmRotation::LoUnderscore)); | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
RotationMismatch has no test.
This test pins the catalog rotation policy, but no test drives a rotation mismatch through intake. SccmServerHierarchyAdmissionGap::RotationMismatch at crates/cmtraceopen-parser/src/sccm/server/windows/intake.rs line 1712 is never asserted in this file. The plan Task 2 Step 1 lists "wrong rotation" as a required red test.
Add a case that sets rotation.kind to lo with basename replmgr.lo_ and asserts the gap. replmgr declares only CURRENT_ROTATION, so that combination must produce RotationMismatch.
The same gap applies to Task 2 Step 4, "verify order-independent serialization". No test in this file feeds the same artifacts in reverse order and compares the assessment.
🤖 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/tests/sccm_server_hierarchy_source_contract.rs`
around lines 58 - 72, Extend the intake tests around the existing hierarchy
admission assessment to add a wrong-rotation case using rotation kind `lo` with
basename `replmgr.lo_`, and assert that it produces
`SccmServerHierarchyAdmissionGap::RotationMismatch` because `replmgr` only
permits `CURRENT_ROTATION`. Also add an order-independence case that feeds the
same artifacts in reverse order and asserts both assessments are equal.
|
|
||
| --- | ||
|
|
||
| ### Task 1: Declare the exact hierarchy source/component/rotation contract |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix the heading level jump.
Line 17 uses ### immediately after the # title. No ## heading exists in the document. markdownlint MD001 fails on this. Promote every ### Task N heading to ##, which also matches the existing ## Self-review heading at line 227.
Proposed fix
-### Task 1: Declare the exact hierarchy source/component/rotation contract
+## Task 1: Declare the exact hierarchy source/component/rotation contract📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ### Task 1: Declare the exact hierarchy source/component/rotation contract | |
| ## Task 1: Declare the exact hierarchy source/component/rotation contract |
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)
[warning] 17-17: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
🤖 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 `@docs/superpowers/plans/2026-08-04-sccm-481-hierarchy-source-contracts.md` at
line 17, Promote every “### Task N” heading in the document to “## Task N” so
heading levels descend sequentially from the top-level title and remain
consistent with the existing “## Self-review” heading.
Source: Linters/SAST tools
| ```sh | ||
| cargo test --locked -p cmtraceopen-parser --test sccm_server_hierarchy_source_contract | ||
| cargo test --locked -p cmtraceopen-parser --test sccm_server_intake | ||
| cargo test --locked -p cmtraceopen-parser --test sccm_server_intake_fixture_contract | ||
| cargo test --locked -p cmtraceopen-parser --test sccm_spine_contract | ||
| cargo test --locked -p cmtraceopen-parser | ||
| cargo check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown | ||
| cargo clippy --locked -p cmtraceopen-parser --all-targets -- -D warnings | ||
| cargo fmt --check --all | ||
| git diff --check | ||
| ``` | ||
|
|
||
| Expected: every command exits `0`; no `src-tauri` or `server/windows/hierarchy.rs` change exists. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify the test targets and fixture paths named in the plan.
set -euo pipefail
fd -t f -e rs . crates/cmtraceopen-parser/tests | sort
echo "--- fixture dirs ---"
fd -t d 'hierarchy_and_replication' crates/cmtraceopen-parser/tests || echo "no hierarchy_and_replication fixture directory"Repository: adamgell/cmtraceopen
Length of output: 2887
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- plan excerpt ---'
sed -n '185,220p' docs/superpowers/plans/2026-08-04-sccm-481-hierarchy-source-contracts.md
printf '%s\n' '--- target and fixture references ---'
for f in \
crates/cmtraceopen-parser/tests/sccm_server_intake.rs \
crates/cmtraceopen-parser/tests/sccm_server_intake_fixture_contract.rs \
crates/cmtraceopen-parser/tests/sccm_spine_contract.rs \
crates/cmtraceopen-parser/tests/sccm_server_hierarchy_and_replication_fixture_contract.rs \
crates/cmtraceopen-parser/tests/sccm_server_hierarchy_source_contract.rs
do
printf '\n--- %s ---\n' "$f"
rg -n 'fixture|include_|read_to_string|hierarchy_and_replication|tests/fixtures|fixtures/' "$f" || true
done
printf '%s\n' '--- fixture files ---'
find crates/cmtraceopen-parser/tests/fixtures/sccm/server/hierarchy_and_replication \
-type f -print | sortRepository: adamgell/cmtraceopen
Length of output: 13894
🏁 Script executed:
#!/bin/bash
set -euo pipefail
for f in \
crates/cmtraceopen-parser/tests/sccm_server_hierarchy_source_contract.rs \
crates/cmtraceopen-parser/tests/sccm_server_hierarchy_and_replication_fixture_contract.rs
do
printf '\n--- %s ---\n' "$f"
wc -l "$f"
sed -n '1,80p' "$f"
done
printf '\n--- planned fixture status ---\n'
test -d crates/cmtraceopen-parser/tests/fixtures/sccm/server/hierarchy_and_replication/live-lab-5.00.9141.1000 \
&& echo 'live-lab fixture directory exists' \
|| echo 'live-lab fixture directory is missing'
printf '\n--- tracked target and fixture paths ---\n'
git ls-files \
crates/cmtraceopen-parser/tests/sccm_server_hierarchy_source_contract.rs \
crates/cmtraceopen-parser/tests/sccm_server_intake.rs \
crates/cmtraceopen-parser/tests/sccm_server_intake_fixture_contract.rs \
crates/cmtraceopen-parser/tests/sccm_spine_contract.rs \
'crates/cmtraceopen-parser/tests/fixtures/sccm/server/hierarchy_and_replication/*' \
| rg 'sccm_server_(hierarchy_source|intake)|sccm_spine_contract|hierarchy_and_replication/live-lab' || trueRepository: adamgell/cmtraceopen
Length of output: 5944
Add and exercise live-lab-5.00.9141.1000. The three test targets exist, but the planned fixture directory is missing. sccm_server_hierarchy_source_contract.rs uses inline data and does not load fixture files. Add the fixture, load it in a test, and add its scenario to the exact fixture matrix.
🤖 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 `@docs/superpowers/plans/2026-08-04-sccm-481-hierarchy-source-contracts.md`
around lines 201 - 213, Add the missing live-lab-5.00.9141.1000 fixture
directory and input data, then update the fixture-loading test and exact fixture
matrix to include this scenario. Ensure sccm_server_hierarchy_source_contract.rs
loads and exercises the new fixture, while preserving the existing inline-data
coverage and listed validation commands.
Source: Path instructions
|
|
||
| ## Self-review | ||
|
|
||
| - Spec coverage: catalog, version/profile admission, topology, direction, provenance, keys, rotation, coverage states, supplement boundary, privacy, and determinism map to Tasks 1–5. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Replace the en dash in "Tasks 1–5".
Line 229 contains an en dash (U+2013). Use an ASCII hyphen or the word "through".
Proposed fix
-- Spec coverage: catalog, version/profile admission, topology, direction, provenance, keys, rotation, coverage states, supplement boundary, privacy, and determinism map to Tasks 1–5.
+- Spec coverage: catalog, version/profile admission, topology, direction, provenance, keys, rotation, coverage states, supplement boundary, privacy, and determinism map to Tasks 1 through 5.As per path instructions: "Documentation. Verify commands, paths, and flags actually exist in the repo. Flag em dashes and en dashes."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - Spec coverage: catalog, version/profile admission, topology, direction, provenance, keys, rotation, coverage states, supplement boundary, privacy, and determinism map to Tasks 1–5. | |
| - Spec coverage: catalog, version/profile admission, topology, direction, provenance, keys, rotation, coverage states, supplement boundary, privacy, and determinism map to Tasks 1 through 5. |
🤖 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 `@docs/superpowers/plans/2026-08-04-sccm-481-hierarchy-source-contracts.md` at
line 229, Replace the en dash in the “Spec coverage” sentence’s “Tasks 1–5”
range with an ASCII hyphen or “through,” preserving the rest of the sentence
unchanged.
Source: Path instructions
Closes #481.
Adds the bounded hierarchy and replication source admission contract, fail-closed supplement provenance, topology-bound direction, and exact logical-record component validation. Unknown encodings remain CoverageOnly with MissingDigest and cannot produce semantic evidence.
Independent critic verdict: ACCEPT at edb37e7.
Local gates: focused hierarchy, reducer, intake, fixture, and spine suites; full parser suite and docs; wasm32 check; strict Clippy; scoped rustfmt; diff check.
Summary by CodeRabbit
New Features
Bug Fixes