Repository navigation
feat(sccm): seal task sequence relocation provenance - #493
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTask Sequence artifacts now carry validated relocation provenance through native collection, intake, admission, and reduction. Admission seals the provenance. Task Sequence observations use sealed path classes, lineage, and ordinals for coverage and deterministic ordering. ChangesTask Sequence provenance
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant ClientManifestCollector
participant SccmManifest
participant ClientIntake
participant Admission
participant TaskSequenceReducer
ClientManifestCollector->>SccmManifest: captured smsts.log with provenance
SccmManifest->>ClientIntake: validated provenance
ClientIntake->>Admission: intake fragments with provenance
Admission->>TaskSequenceReducer: admitted evidence with sealed provenance
TaskSequenceReducer->>TaskSequenceReducer: derive observations and relocation ordering
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
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/client/task_sequence.rs (1)
642-674: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftDo not require timestamp authority after sealed relocation ordering succeeds.
When relocation lineage and ordinal pairs are unique, Line 654 orders observations from sealed provenance. Line 671 still requires normalized timestamps, so records with valid relocation order but missing or invalid timestamps become ambiguous. The reducer can then select the representative by phase and evidence reference instead of the sealed final relocation position.
Make unique relocation identities sufficient for safe ordering. Preserve timestamp quality as diagnostic state instead of using it as an authority gate.
🤖 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/client/task_sequence.rs` around lines 642 - 674, Update the ordering_is_safe calculation near relocation_ordinals_are_unique so unique relocation lineage-and-ordinal pairs are sufficient for safe ordering without requiring timestamps_are_unique. Keep timestamp quality available as diagnostic state, while preserving the existing normalized-timestamp requirement for paths that rely on timestamp ordering.
🤖 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/client/intake.rs`:
- Around line 1446-1452: Update the physical identity construction to handle a
missing source.path_fingerprint by returning
SccmClientIntakeError::MissingPhysicalProvenance via ok_or and ? before calling
to_ascii_lowercase, replacing the panic from expect while preserving the
existing physical identity fields.
- Around line 212-213: Treat the public field additions as a semver-breaking API
change: release them only in a major version, or introduce an additive
construction API that preserves downstream struct-literal compatibility. Apply
this to SccmClientIntakeArtifact at
crates/cmtraceopen-parser/src/sccm/client/intake.rs:212-213,
SccmClientIntakeFragment at
crates/cmtraceopen-parser/src/sccm/client/intake.rs:519-519, and
SccmTaskSequencePathObservation at
crates/cmtraceopen-parser/src/sccm/client/task_sequence.rs:85-89; serde defaults
alone are insufficient.
- Around line 34-36: The public SCCM Task Sequence API lacks required rustdoc.
In crates/cmtraceopen-parser/src/sccm/client/intake.rs:34-36, document each
contract constant’s supported version or limit; at 166-175, document
SccmTaskSequenceProvenance and every public field, including privacy constraints
and absence rules; at 212-213, document when provenance is required versus
absent; and at 519, document fragment propagation semantics. In
crates/cmtraceopen-parser/src/sccm/client/task_sequence.rs:85-89, document the
relocation ordinal output ordering contract. Preserve the existing API and
behavior while making all new public items semver-documented.
In `@crates/cmtraceopen-parser/tests/sccm_client_admission_authority.rs`:
- Line 47: Update the package version for cmtraceopen-parser to a
breaking-release minor version, at least 0.2.0, because adding
task_sequence_provenance to the public SccmClientIntakeArtifact struct breaks
downstream struct literals. Keep the field change intact and ensure all package
metadata references use the new version.
In `@crates/cmtraceopen-parser/tests/sccm_client_task_sequence.rs`:
- Around line 250-253: Update the relocationOrdinal conversion in the SCCM
client task fixture setup to use u32::try_from instead of an unchecked as u32
cast, and fail setup with a clear expectation message when the JSON value
exceeds u32::MAX.
In `@docs/superpowers/plans/2026-08-04-sccm-482-task-sequence-provenance.md`:
- Line 15: Update the “Task 1: Add the versioned intake provenance contract”
heading to H2 level, and ensure all task headings in the document consistently
use the same H2 level.
---
Outside diff comments:
In `@crates/cmtraceopen-parser/src/sccm/client/task_sequence.rs`:
- Around line 642-674: Update the ordering_is_safe calculation near
relocation_ordinals_are_unique so unique relocation lineage-and-ordinal pairs
are sufficient for safe ordering without requiring timestamps_are_unique. Keep
timestamp quality available as diagnostic state, while preserving the existing
normalized-timestamp requirement for paths that rely on timestamp ordering.
🪄 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: 38084a47-37c5-4579-bb42-5f24e7bcaeb0
📒 Files selected for processing (14)
crates/cmtraceopen-parser/src/sccm/client/admission.rscrates/cmtraceopen-parser/src/sccm/client/admission_tests.rscrates/cmtraceopen-parser/src/sccm/client/authority_contract_tests.rscrates/cmtraceopen-parser/src/sccm/client/intake.rscrates/cmtraceopen-parser/src/sccm/client/task_sequence.rscrates/cmtraceopen-parser/tests/sccm_client_admission_authority.rscrates/cmtraceopen-parser/tests/sccm_client_deployment.rscrates/cmtraceopen-parser/tests/sccm_client_health.rscrates/cmtraceopen-parser/tests/sccm_client_intake.rscrates/cmtraceopen-parser/tests/sccm_client_inventory.rscrates/cmtraceopen-parser/tests/sccm_client_policy.rscrates/cmtraceopen-parser/tests/sccm_client_task_sequence.rscrates/cmtraceopen-parser/tests/sccm_client_updates.rsdocs/superpowers/plans/2026-08-04-sccm-482-task-sequence-provenance.md
| pub const SCCM_TASK_SEQUENCE_PROVENANCE_VERSION: u16 = 1; | ||
| pub const MAX_SCCM_TASK_SEQUENCE_PATH_EVIDENCE_CHARS: usize = 256; | ||
| pub const MAX_SCCM_TASK_SEQUENCE_RELOCATION_LINEAGE_CHARS: usize = 128; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Document the new public API.
The new public constants, provenance type, and public fields have no rustdoc. Document version support, privacy constraints, absence rules, and relocation ordering semantics.
crates/cmtraceopen-parser/src/sccm/client/intake.rs#L34-L36: document each public contract constant.crates/cmtraceopen-parser/src/sccm/client/intake.rs#L166-L175: documentSccmTaskSequenceProvenanceand its public fields.crates/cmtraceopen-parser/src/sccm/client/intake.rs#L212-L213: document when Task Sequence provenance is required or absent.crates/cmtraceopen-parser/src/sccm/client/intake.rs#L519-L519: document fragment propagation semantics.crates/cmtraceopen-parser/src/sccm/client/task_sequence.rs#L85-L89: document the relocation ordinal output contract.
As per path instructions, "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/client/intake.rs#L34-L36(this comment)crates/cmtraceopen-parser/src/sccm/client/intake.rs#L166-L175crates/cmtraceopen-parser/src/sccm/client/intake.rs#L212-L213crates/cmtraceopen-parser/src/sccm/client/intake.rs#L519-L519crates/cmtraceopen-parser/src/sccm/client/task_sequence.rs#L85-L89
🤖 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/client/intake.rs` around lines 34 - 36,
The public SCCM Task Sequence API lacks required rustdoc. In
crates/cmtraceopen-parser/src/sccm/client/intake.rs:34-36, document each
contract constant’s supported version or limit; at 166-175, document
SccmTaskSequenceProvenance and every public field, including privacy constraints
and absence rules; at 212-213, document when provenance is required versus
absent; and at 519, document fragment propagation semantics. In
crates/cmtraceopen-parser/src/sccm/client/task_sequence.rs:85-89, document the
relocation ordinal output ordering contract. Preserve the existing API and
behavior while making all new public items semver-documented.
Source: Path instructions
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||
| pub task_sequence_provenance: Option<SccmTaskSequenceProvenance>, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Treat these public struct field additions as a major-version change.
Each new field breaks downstream struct literals for SccmClientIntakeArtifact, SccmClientIntakeFragment, and SccmTaskSequencePathObservation. Serde defaults preserve wire deserialization only. They do not preserve Rust source compatibility.
Release this API change in a major version, or provide an additive construction API before release.
crates/cmtraceopen-parser/src/sccm/client/intake.rs#L212-L213: addingtask_sequence_provenancebreaks downstreamSccmClientIntakeArtifactliterals.crates/cmtraceopen-parser/src/sccm/client/intake.rs#L519-L519: addingtask_sequence_provenancebreaks downstreamSccmClientIntakeFragmentliterals.crates/cmtraceopen-parser/src/sccm/client/task_sequence.rs#L85-L89: addingrelocation_ordinalbreaks downstreamSccmTaskSequencePathObservationliterals.
As per path instructions, "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/client/intake.rs#L212-L213(this comment)crates/cmtraceopen-parser/src/sccm/client/intake.rs#L519-L519crates/cmtraceopen-parser/src/sccm/client/task_sequence.rs#L85-L89
🤖 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/client/intake.rs` around lines 212 - 213,
Treat the public field additions as a semver-breaking API change: release them
only in a major version, or introduce an additive construction API that
preserves downstream struct-literal compatibility. Apply this to
SccmClientIntakeArtifact at
crates/cmtraceopen-parser/src/sccm/client/intake.rs:212-213,
SccmClientIntakeFragment at
crates/cmtraceopen-parser/src/sccm/client/intake.rs:519-519, and
SccmTaskSequencePathObservation at
crates/cmtraceopen-parser/src/sccm/client/task_sequence.rs:85-89; serde defaults
alone are insufficient.
Source: Path instructions
| let physical_identity = ( | ||
| source | ||
| .path_fingerprint | ||
| .as_deref() | ||
| .expect("physical source path provenance is validated above") | ||
| .to_ascii_lowercase(), | ||
| provenance.path_class, |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Return a validation error when path_fingerprint is missing.
A physical smsts.log artifact with valid Task Sequence provenance and no path_fingerprint reaches Line 1450 before the generic physical-source validation at Line 1480. The expect panics instead of returning MissingPhysicalProvenance.
Require the fingerprint with ok_or(SccmClientIntakeError::MissingPhysicalProvenance)? before constructing physical_identity.
🤖 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/client/intake.rs` around lines 1446 -
1452, Update the physical identity construction to handle a missing
source.path_fingerprint by returning
SccmClientIntakeError::MissingPhysicalProvenance via ok_or and ? before calling
to_ascii_lowercase, replacing the panic from expect while preserving the
existing physical identity fields.
| path_fingerprint: Some("synthetic-policy-approved".to_owned()), | ||
| rotation_lineage: None, | ||
| relative_path: Some("evidence/client-policy-agent/current/PolicyAgent.log".to_owned()), | ||
| task_sequence_provenance: None, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 6 'pub struct SccmClientIntakeArtifact|task_sequence_provenance' crates --glob '*.rs'
fd --type f 'Cargo.toml' -x rg -n 'name\s*=\s*"cmtraceopen-parser"|version\s*='Repository: adamgell/cmtraceopen
Length of output: 50376
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- package metadata ---'
for f in $(git ls-files '*Cargo.toml'); do
rg -n -C 2 'name\s*=\s*"cmtraceopen-parser"|^version\s*=' "$f" || true
done
printf '%s\n' '--- public type declaration ---'
sed -n '190,222p' crates/cmtraceopen-parser/src/sccm/client/intake.rs
printf '%s\n' '--- change introducing the field ---'
git diff --unified=8 -- crates/cmtraceopen-parser/src/sccm/client/intake.rs crates/cmtraceopen-parser/tests/sccm_client_admission_authority.rsRepository: adamgell/cmtraceopen
Length of output: 2581
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- field history ---'
git log --all --oneline -S'task_sequence_provenance' -- crates/cmtraceopen-parser/src/sccm/client/intake.rs | head -20
printf '%s\n' '--- type history ---'
git log --all --oneline -S'pub struct SccmClientIntakeArtifact' -- crates/cmtraceopen-parser/src/sccm/client/intake.rs | head -20
printf '%s\n' '--- repository state ---'
git status --short --branch
git rev-parse --show-toplevel
git log --oneline -5Repository: adamgell/cmtraceopen
Length of output: 722
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- introducing commit ---'
git show --format=fuller --stat --oneline e45d632a
git show --format= --unified=5 e45d632a -- crates/cmtraceopen-parser/src/sccm/client/intake.rs
printf '%s\n' '--- release tags ---'
git tag --contains d1bb525b --sort=version:refname
git tag --contains e45d632a --sort=version:refname
git tag --sort=version:refname | tail -20Repository: adamgell/cmtraceopen
Length of output: 16270
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- package versions in the introducing commit and its parent ---'
git show e45d632a:crates/cmtraceopen-parser/Cargo.toml | rg -n '^(name|version)\s*='
git show e45d632a^:crates/cmtraceopen-parser/Cargo.toml | rg -n '^(name|version)\s*='
printf '%s\n' '--- crates.io release metadata ---'
curl -fsSL https://crates.io/api/v1/crates/cmtraceopen-parser |
python3 -c 'import json,sys; d=json.load(sys.stdin); print("max_version:", d["crate"]["max_version"]); print("versions:", [(v["num"], v["yanked"]) for v in d["versions"][:10]])'Repository: adamgell/cmtraceopen
Length of output: 1014
Publish cmtraceopen-parser as a breaking release.
task_sequence_provenance was added to the existing public SccmClientIntakeArtifact struct while the package remains at 0.1.1. Downstream struct literals will fail to compile. #[serde(default)] does not preserve Rust source compatibility. Bump to 0.2.0 or redesign the API before publishing.
🤖 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_client_admission_authority.rs` at line
47, Update the package version for cmtraceopen-parser to a breaking-release
minor version, at least 0.2.0, because adding task_sequence_provenance to the
public SccmClientIntakeArtifact struct breaks downstream struct literals. Keep
the field change intact and ensure all package metadata references use the new
version.
Source: Path instructions
| relocation_ordinal: fixture["relocationOrdinal"] | ||
| .as_u64() | ||
| .expect("relocationOrdinal is a number") | ||
| as u32, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reject relocation ordinals that exceed u32::MAX.
Line 253 truncates a JSON u64 into u32. A malformed fixture can then test a different ordinal. Use u32::try_from and fail fixture setup when the value exceeds the contract range.
Proposed fix
- relocation_ordinal: fixture["relocationOrdinal"]
- .as_u64()
- .expect("relocationOrdinal is a number")
- as u32,
+ relocation_ordinal: u32::try_from(
+ fixture["relocationOrdinal"]
+ .as_u64()
+ .expect("relocationOrdinal is a number"),
+ )
+ .expect("relocationOrdinal fits u32"),📝 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.
| relocation_ordinal: fixture["relocationOrdinal"] | |
| .as_u64() | |
| .expect("relocationOrdinal is a number") | |
| as u32, | |
| relocation_ordinal: u32::try_from( | |
| fixture["relocationOrdinal"] | |
| .as_u64() | |
| .expect("relocationOrdinal is a number"), | |
| ) | |
| .expect("relocationOrdinal fits u32"), |
🤖 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_client_task_sequence.rs` around lines
250 - 253, Update the relocationOrdinal conversion in the SCCM client task
fixture setup to use u32::try_from instead of an unchecked as u32 cast, and fail
setup with a clear expectation message when the JSON value exceeds u32::MAX.
|
|
||
| --- | ||
|
|
||
| ### Task 1: Add the versioned intake provenance contract |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use an H2 heading for the first task.
Line 15 jumps from H1 to H3. Change ### Task 1 to ## Task 1. Keep all task headings at that level.
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)
[warning] 15-15: 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-482-task-sequence-provenance.md` at
line 15, Update the “Task 1: Add the versioned intake provenance contract”
heading to H2 level, and ensure all task headings in the document consistently
use the same H2 level.
Source: Linters/SAST tools
Summary
_SMSTSLogPathevidence, relocation lineage, and ordinal through intake/integrityValidation
cmtraceopen-parser: 1,826 passed, 0 failedb63ee5b6independently ACCEPTEDCloses #482
Summary by CodeRabbit
New Features
Bug Fixes