Skip to content

test(sccm): prepare Distribution Point corpus - #374

Merged
adamgell merged 21 commits into
codex/parser-family-skeletonfrom
codex/sccm-329-distribution-point-corpus
Jul 31, 2026
Merged

test(sccm): prepare Distribution Point corpus#374
adamgell merged 21 commits into
codex/parser-family-skeletonfrom
codex/sccm-329-distribution-point-corpus

Conversation

@adamgell

@adamgell adamgell commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Issue

Preparation slice for #329 under epic #317. This PR intentionally does not close the issue.

Scope

  • adds the exact ten-scenario synthetic DP/content corpus;
  • adds a focused Rust fixture-contract test that runs captured evidence through the existing raw CCM logical-record envelope;
  • pins site-server versus DP producer provenance, one physical capture for multi-DP site logs, exact package/content/version/DP/profile keys, normalized timestamp/capture bounds, coverage states, bounded requests, deterministic ordering, collisions, and conservative confidence;
  • binds source-local client/malformed/rotation classifications to exact physical role, state, lineage, fragment, and evidence semantics;
  • adds the SCCM Server: diagnose distribution-point and content-distribution workflows #329 source/state/dependency preparation document.

No production reducer, native collector, shared SCCM model edit, new parser kind, IIS tree scan, cross-side correlation, or live Windows claim is included.

TDD evidence

  • initial matrix RED: 0/1 because the required fixture root did not exist;
  • nested CCM-delimiter adversary RED: 5/6 before closed field syntax;
  • physical-capture/classification hardening RED: 6/8, exposing two duplicated site logs and three accepted classification relabels;
  • prior-CodeRabbit follow-up RED: 0/1, exposing site-server host collapse onto a DP and nonphysical collectionLimit provenance;
  • final focused result: 8/8 green.

Fixture matrix

  • healthy package
  • terminal distribution failure
  • transfer retry/backlog
  • provider validation failure
  • same package/content across two versions and two DPs in one physical site-log capture
  • bounded serving observation
  • client-only lookalike request
  • current/lo_ rotation split plus malformed bytes
  • absent source candidates with observed DP role retained
  • incomplete downstream absent/access-denied coverage

Corpus totals: 10 scenarios, 27 physical artifacts, 22 synthetic evidence files, 13,934 evidence bytes.

Verification at exact head

  • cargo test --locked -p cmtraceopen-parser --test sccm_server_distribution_point_fixture_contract — 8/8
  • cargo test --locked -p cmtraceopen-parser --test sccm_server_intake_fixture_contract — 1/1
  • cargo test --locked -p cmtraceopen-parser — 662/662
  • cargo clippy --locked -p cmtraceopen-parser --all-targets -- -D warnings — pass
  • cargo +1.88.0 check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown — pass
  • npx tsc --noEmit — pass
  • rustfmt +1.88.0 --check crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs — pass
  • all corpus JSON through jq empty — pass
  • git diff --check — pass

Repository-wide cargo fmt --check --all continues to report only pre-existing ESP/Tauri formatting drift outside this exact diff; no unrelated file is retained in the branch.

Dependency and review state

The production reducer remains gated on the corrected/reviewed #318 finding API in draft PR #353, the applicable #335/#319 intake contracts, restacking to the live base, and eventual native Windows validation. This PR remains draft.

Prior substantive CodeRabbit findings for producer-host/subject separation, source-local classification semantics, and nonphysical collection-limit provenance are now covered by permanent tests. Fresh substantive exact-head CodeRabbit and independent adversarial review are required before this preparation slice can advance.

Exact head submitted: d07ab1575d2d5a4360dc0f606064b8dbc6525170.

Summary by CodeRabbit

  • Documentation

    • Added guidance for interpreting synthetic SCCM distribution-point evidence, manifests, coverage states, and validation rules.
    • Documented preparation requirements and boundaries for future distribution-point analysis.
  • Tests

    • Added comprehensive scenario coverage for healthy, failed, incomplete, absent, retrying, rotation-boundary, and validation-failure workflows.
    • Added validation checks for provenance, topology, artifact coverage, transaction evidence, deterministic output, and malformed or adversarial inputs.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ae79dce-ee81-472a-847c-afa71ccf6dc0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This change adds a synthetic SCCM distribution-point fixture corpus, expected scenario outputs, a preparation contract, and Rust tests for provenance, topology, coverage, transactions, evidence, ordering, and fail-closed mutations.

Changes

SCCM distribution-point corpus

Layer / File(s) Summary
Corpus contract and scenario definitions
docs/sccm/preparation/issue-329-distribution-point-corpus.md, crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/README.md
Defines fixture conventions, producer roles, workflow states, transaction keys, coverage states, scenario cases, validation rules, and implementation boundaries.
Synthetic manifest fixtures
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/*/manifest.json
Adds synthetic manifests for topology, artifact provenance, capture states, rotation, collection metadata, and evidence paths.
Scenario expected outputs
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/*/expected.json
Adds expected workflow states, coverage, transactions, observations, requests, confidence values, and correlation handoff results.
Fixture contract validation
crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs
Adds manifest and expected-output validation, scenario-specific checks, deterministic ordering checks, provenance checks, and fail-closed mutation tests.

Estimated code review effort: 4 (Complex) | ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.84% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the SCCM test and the preparation of the Distribution Point corpus.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a substantive exact-head review of 25b37333affde22b4ef8a19f4a5f3d89c082b599..15b3474f8721a3453e8732e264e0d20464e37288 for Issue #329. Focus on strict CCM field binding, producer/subject role topology, exact package/content/version/DP/profile separation, normalized timestamp/capture ordering, coverage-state preservation, rotation/malformed handling, collision-safe paths, deterministic output, bounded artifact requests, and prevention of client/DP causal claims. A status-only or skipped review is not approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='25b37333affde22b4ef8a19f4a5f3d89c082b599'
head='15b3474f8721a3453e8732e264e0d20464e37288'

git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"

echo '=== exact range ==='
git diff --stat "$base" "$head"
echo '=== changed files ==='
git diff --name-status "$base" "$head"
echo '=== fixture and document inventory ==='
git diff --name-only "$base" "$head" | grep -E '\.(rs|json|md|log|txt)$' || true
echo '=== changed Rust outlines ==='
git diff --name-only "$base" "$head" | grep -E '\.rs$' | while IFS= read -r file; do
  echo "--- $file"
  ast-grep outline "$file" --items all || true
done
echo '=== diff (all, no color) ==='
git diff --no-ext-diff --unified=80 "$base" "$head"

Length of output: 184074


🏁 Script executed:

#!/bin/bash
set -euo pipefail

contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'
root='crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point'

echo '=== contract: manifest topology and normalization ==='
sed -n '243,697p' "$contract"
echo '=== contract: expected-output validation ==='
sed -n '758,1417p' "$contract"

echo '=== locate SCCM normalization implementation ==='
rg -n -C 4 --type rust '\bnormalize_ccm_artifact\s*\(' crates
rg -n -C 3 --type rust 'enum SccmRole|struct SccmArtifact|enum SccmCoverageState|enum SccmRotation|enum SccmTimeOrderingState' crates/cmtraceopen-parser

echo '=== source outlines for likely SCCM modules ==='
fd -e rs . crates/cmtraceopen-parser/src | while IFS= read -r file; do
  if rg -q --type rust '\bnormalize_ccm_artifact\b' "$file"; then
    echo "--- $file"
    ast-grep outline "$file" --items all
  fi
done

echo '=== corpus JSON, paths, byte counts, and record field audit ==='
python3 - <<'PY'
import json, re
from pathlib import Path
from datetime import datetime

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
issues = []
for scenario_dir in sorted(p for p in root.iterdir() if p.is_dir()):
    scenario = scenario_dir.name
    try:
        manifest = json.loads((scenario_dir / "manifest.json").read_text())
        expected = json.loads((scenario_dir / "expected.json").read_text())
    except Exception as e:
        issues.append(f"{scenario}: JSON error: {e}")
        continue
    captured = datetime.fromisoformat(manifest["bundle"]["capturedUtc"].replace("Z","+00:00"))
    seen_rel, seen_fingerprint = set(), set()
    artifacts = {a["artifactId"]: a for a in manifest["artifacts"]}
    for a in manifest["artifacts"]:
        aid = a["artifactId"]
        if a["pathFingerprint"] in seen_fingerprint:
            issues.append(f"{scenario}/{aid}: duplicate pathFingerprint")
        seen_fingerprint.add(a["pathFingerprint"])
        if a["captureState"] in {"captured","capped","parseFailed"}:
            rel = a.get("relativePath")
            if rel in seen_rel:
                issues.append(f"{scenario}/{aid}: duplicate relativePath {rel}")
            seen_rel.add(rel)
            data = (scenario_dir / rel).read_bytes()
            if len(data) != a.get("bytesCopied"):
                issues.append(f"{scenario}/{aid}: byte count {len(data)} != {a.get('bytesCopied')}")
            if "SYNTHETIC FIXTURE" not in data.decode("utf-8", "replace"):
                issues.append(f"{scenario}/{aid}: missing marker")
    for txn in expected["transactions"]:
        key = txn["key"]
        for obs in txn["observations"]:
            for ev in obs["evidence"]:
                a = artifacts[ev["artifactId"]]
                data = (scenario_dir / a["relativePath"]).read_text()
                line = data.splitlines()[ev["startLine"]-1]
                msg = re.search(r'<!\[LOG\[(.*?)\]LOG\]!>', line)
                if not msg:
                    issues.append(f"{scenario}/{obs['observationId']}: cited line has no CCM envelope")
                    continue
                fields = dict(x.strip().split("=", 1) for x in msg.group(1).split(";")[1:])
                expected_fields = {
                    "PackageId": key["packageId"], "ContentId": key["contentId"],
                    "ContentVersion": str(key["contentVersion"]), "SiteCode": key["siteCode"],
                    "DpHandle": key["distributionPointHandle"], "ProfileId": key["extractionProfileId"],
                    "Phase": obs["phase"], "Disposition": obs["disposition"],
                    "Terminal": str(obs["terminal"]).lower(),
                }
                for n, v in expected_fields.items():
                    if fields.get(n) != v:
                        issues.append(f"{scenario}/{obs['observationId']}: {n}={fields.get(n)!r}, expected {v!r}")
                stamp = re.search(r'<time="([^"]+)" date="([^"]+)"', line)
                if stamp:
                    t = datetime.strptime(f"{stamp.group(2)}T{stamp.group(1)}", "%m-%d-%YT%H:%M:%S.%f%z")
                    if t > captured:
                        issues.append(f"{scenario}/{obs['observationId']}: evidence is after bundle capture")
print("audit issues:", len(issues))
print("\n".join(issues) if issues else "none")
PY

Length of output: 71484


🏁 Script executed:

#!/bin/bash
set -euo pipefail

contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'

echo '=== numbered topology validation ==='
nl -ba "$contract" | sed -n '425,620p'
echo '=== numbered source-local validation ==='
nl -ba "$contract" | sed -n '1210,1325p'
echo '=== normalizer implementation ==='
nl -ba crates/cmtraceopen-parser/src/sccm/ingest.rs
echo '=== artifact model ==='
nl -ba crates/cmtraceopen-parser/src/sccm/models.rs | sed -n '370,410p'

echo '=== corrected corpus audit ==='
python3 - <<'PY'
import json, re
from pathlib import Path
from datetime import datetime

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
issues = []
for scenario_dir in sorted(p for p in root.iterdir() if p.is_dir()):
    scenario = scenario_dir.name
    manifest = json.loads((scenario_dir / "manifest.json").read_text())
    expected = json.loads((scenario_dir / "expected.json").read_text())
    captured = datetime.fromisoformat(manifest["bundle"]["capturedUtc"].replace("Z","+00:00"))
    artifacts = {a["artifactId"]: a for a in manifest["artifacts"]}
    rel_paths, fingerprints = set(), set()
    for a in manifest["artifacts"]:
        aid = a["artifactId"]
        if not fingerprints.add(a["pathFingerprint"]) if False else False:
            pass
        if a["pathFingerprint"] in fingerprints:
            issues.append(f"{scenario}/{aid}: duplicate pathFingerprint")
        fingerprints.add(a["pathFingerprint"])
        if a["captureState"] in {"captured", "capped", "parseFailed"}:
            data = (scenario_dir / a["relativePath"]).read_bytes()
            if a["relativePath"] in rel_paths:
                issues.append(f"{scenario}/{aid}: duplicate relativePath")
            rel_paths.add(a["relativePath"])
            if len(data) != a["bytesCopied"]:
                issues.append(f"{scenario}/{aid}: byte count mismatch")
    for txn in expected["transactions"]:
        for obs in txn["observations"]:
            for ev in obs["evidence"]:
                a = artifacts[ev["artifactId"]]
                line = (scenario_dir / a["relativePath"]).read_text().splitlines()[ev["startLine"] - 1]
                message = re.search(r'<!\[LOG\[(.*?)\]LOG\]!>', line).group(1)
                fields = dict(x.strip().split("=", 1) for x in message.split(";")[1:])
                required = {
                    "PackageId": txn["key"]["packageId"],
                    "ContentId": txn["key"]["contentId"],
                    "ContentVersion": str(txn["key"]["contentVersion"]),
                    "SiteCode": txn["key"]["siteCode"],
                    "DpHandle": txn["key"]["distributionPointHandle"],
                    "ProfileId": txn["key"]["extractionProfileId"],
                    "Phase": obs["phase"], "Disposition": obs["disposition"],
                    "Terminal": str(obs["terminal"]).lower(),
                }
                if any(fields.get(k) != v for k, v in required.items()):
                    issues.append(f"{scenario}/{obs['observationId']}: field mismatch")
                stamp = re.search(r'<time="([^"]+)" date="([^"]+)"', line)
                if stamp:
                    raw = f"{stamp.group(2)}T{stamp.group(1)}"
                    raw = raw[:-4] + raw[-4:-2] + ":" + raw[-2:]
                    if datetime.fromisoformat(raw) > captured:
                        issues.append(f"{scenario}/{obs['observationId']}: after capture")
print("audit issues:", len(issues))
print("\n".join(issues) if issues else "none")
PY

echo '=== static mutation conditions for the candidate gaps ==='
python3 - <<'PY'
import json
from pathlib import Path
root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
manifest = json.loads((root/"healthy-package/manifest.json").read_text())
site = manifest["artifacts"][0]
print("site artifact role:", site["producerRole"])
print("site producer host:", site["producerHostHandle"])
print("site workflow subject:", site["workflowSubjectHandle"])
print("validator checks an exact site-server host:", False)
expected = json.loads((root/"client-only-looking-request/expected.json").read_text())
obs = expected["sourceLocalObservations"][0]
print("source-local classification:", obs["classification"])
print("source-local validator requires cited artifact role to be client:", False)
print("source-local validator requires ignoredClientEvidence to cite logical evidence:", False)
PY

Length of output: 4861


🏁 Script executed:

#!/bin/bash
set -euo pipefail

contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'

echo '=== numbered topology validation ==='
cat -n "$contract" | sed -n '425,620p'
echo '=== numbered source-local validation ==='
cat -n "$contract" | sed -n '1210,1325p'
echo '=== normalizer implementation ==='
cat -n crates/cmtraceopen-parser/src/sccm/ingest.rs
echo '=== artifact model ==='
cat -n crates/cmtraceopen-parser/src/sccm/models.rs | sed -n '370,410p'

echo '=== corpus consistency audit ==='
python3 - <<'PY'
import json, re
from pathlib import Path
from datetime import datetime

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
issues = []
for scenario_dir in sorted(p for p in root.iterdir() if p.is_dir()):
    scenario = scenario_dir.name
    manifest = json.loads((scenario_dir / "manifest.json").read_text())
    expected = json.loads((scenario_dir / "expected.json").read_text())
    captured = datetime.fromisoformat(manifest["bundle"]["capturedUtc"].replace("Z", "+00:00"))
    artifacts = {a["artifactId"]: a for a in manifest["artifacts"]}
    rel_paths, fingerprints = set(), set()
    for a in manifest["artifacts"]:
        aid = a["artifactId"]
        if a["pathFingerprint"] in fingerprints:
            issues.append(f"{scenario}/{aid}: duplicate pathFingerprint")
        fingerprints.add(a["pathFingerprint"])
        if a["captureState"] in {"captured", "capped", "parseFailed"}:
            rel = a["relativePath"]
            if rel in rel_paths:
                issues.append(f"{scenario}/{aid}: duplicate relativePath")
            rel_paths.add(rel)
            data = (scenario_dir / rel).read_bytes()
            if len(data) != a["bytesCopied"]:
                issues.append(f"{scenario}/{aid}: byte count mismatch")
    for txn in expected["transactions"]:
        for obs in txn["observations"]:
            for ev in obs["evidence"]:
                a = artifacts[ev["artifactId"]]
                line = (scenario_dir / a["relativePath"]).read_text().splitlines()[ev["startLine"] - 1]
                message = re.search(r'<!\[LOG\[(.*?)\]LOG\]!>', line).group(1)
                fields = dict(x.strip().split("=", 1) for x in message.split(";")[1:])
                required = {
                    "PackageId": txn["key"]["packageId"],
                    "ContentId": txn["key"]["contentId"],
                    "ContentVersion": str(txn["key"]["contentVersion"]),
                    "SiteCode": txn["key"]["siteCode"],
                    "DpHandle": txn["key"]["distributionPointHandle"],
                    "ProfileId": txn["key"]["extractionProfileId"],
                    "Phase": obs["phase"],
                    "Disposition": obs["disposition"],
                    "Terminal": str(obs["terminal"]).lower(),
                }
                if any(fields.get(key) != value for key, value in required.items()):
                    issues.append(f"{scenario}/{obs['observationId']}: field mismatch")
                stamp = re.search(r'<time="([^"]+)" date="([^"]+)"', line)
                if stamp:
                    raw = f"{stamp.group(2)}T{stamp.group(1)}"
                    normalized = raw[:-4] + raw[-4:-2] + ":" + raw[-2:]
                    if datetime.fromisoformat(normalized) > captured:
                        issues.append(f"{scenario}/{obs['observationId']}: after bundle capture")
print(f"audit issues: {len(issues)}")
print("\n".join(issues) if issues else "none")
PY

Length of output: 21292


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import json, re
from pathlib import Path
from datetime import datetime

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
issues = []
for scenario_dir in sorted(p for p in root.iterdir() if p.is_dir()):
    scenario = scenario_dir.name
    manifest = json.loads((scenario_dir / "manifest.json").read_text())
    expected = json.loads((scenario_dir / "expected.json").read_text())
    captured = datetime.fromisoformat(manifest["bundle"]["capturedUtc"].replace("Z", "+00:00"))
    artifacts = {a["artifactId"]: a for a in manifest["artifacts"]}
    rel_paths, fingerprints = set(), set()

    for a in manifest["artifacts"]:
        aid = a["artifactId"]
        if a["pathFingerprint"] in fingerprints:
            issues.append(f"{scenario}/{aid}: duplicate pathFingerprint")
        fingerprints.add(a["pathFingerprint"])
        if a["captureState"] in {"captured", "capped", "parseFailed"}:
            rel = a["relativePath"]
            if rel in rel_paths:
                issues.append(f"{scenario}/{aid}: duplicate relativePath")
            rel_paths.add(rel)
            data = (scenario_dir / rel).read_bytes()
            if len(data) != a["bytesCopied"]:
                issues.append(f"{scenario}/{aid}: byte count mismatch")

    for txn in expected["transactions"]:
        for obs in txn["observations"]:
            for ev in obs["evidence"]:
                a = artifacts[ev["artifactId"]]
                line = (scenario_dir / a["relativePath"]).read_text().splitlines()[ev["startLine"] - 1]
                message = re.search(r'<!\[LOG\[(.*?)\]LOG\]!>', line).group(1)
                fields = dict(x.strip().split("=", 1) for x in message.split(";")[1:])
                required = {
                    "PackageId": txn["key"]["packageId"],
                    "ContentId": txn["key"]["contentId"],
                    "ContentVersion": str(txn["key"]["contentVersion"]),
                    "SiteCode": txn["key"]["siteCode"],
                    "DpHandle": txn["key"]["distributionPointHandle"],
                    "ProfileId": txn["key"]["extractionProfileId"],
                    "Phase": obs["phase"],
                    "Disposition": obs["disposition"],
                    "Terminal": str(obs["terminal"]).lower(),
                }
                if any(fields.get(key) != value for key, value in required.items()):
                    issues.append(f"{scenario}/{obs['observationId']}: field mismatch")
                stamp = re.search(r'<time="([^"]+)" date="([^"]+)"', line)
                if stamp:
                    timestamp = f"{stamp.group(2)}T{stamp.group(1)}".replace("+000", "+00:00")
                    if datetime.fromisoformat(timestamp) > captured:
                        issues.append(f"{scenario}/{obs['observationId']}: after bundle capture")

print(f"audit issues: {len(issues)}")
print("\n".join(issues) if issues else "none")
PY

Length of output: 3432


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import json, re
from pathlib import Path
from datetime import datetime

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
issues = []
for scenario_dir in sorted(p for p in root.iterdir() if p.is_dir()):
    scenario = scenario_dir.name
    manifest = json.loads((scenario_dir / "manifest.json").read_text())
    expected = json.loads((scenario_dir / "expected.json").read_text())
    captured = datetime.strptime(
        manifest["bundle"]["capturedUtc"], "%Y-%m-%dT%H:%M:%SZ"
    ).replace(tzinfo=None)
    artifacts = {a["artifactId"]: a for a in manifest["artifacts"]}
    rel_paths, fingerprints = set(), set()

    for a in manifest["artifacts"]:
        aid = a["artifactId"]
        if a["pathFingerprint"] in fingerprints:
            issues.append(f"{scenario}/{aid}: duplicate pathFingerprint")
        fingerprints.add(a["pathFingerprint"])
        if a["captureState"] in {"captured", "capped", "parseFailed"}:
            rel = a["relativePath"]
            if rel in rel_paths:
                issues.append(f"{scenario}/{aid}: duplicate relativePath")
            rel_paths.add(rel)
            if len((scenario_dir / rel).read_bytes()) != a["bytesCopied"]:
                issues.append(f"{scenario}/{aid}: byte count mismatch")

    for txn in expected["transactions"]:
        for obs in txn["observations"]:
            for ev in obs["evidence"]:
                a = artifacts[ev["artifactId"]]
                line = (scenario_dir / a["relativePath"]).read_text().splitlines()[ev["startLine"] - 1]
                message = re.search(r'<!\[LOG\[(.*?)\]LOG\]!>', line).group(1)
                fields = dict(x.strip().split("=", 1) for x in message.split(";")[1:])
                required = {
                    "PackageId": txn["key"]["packageId"],
                    "ContentId": txn["key"]["contentId"],
                    "ContentVersion": str(txn["key"]["contentVersion"]),
                    "SiteCode": txn["key"]["siteCode"],
                    "DpHandle": txn["key"]["distributionPointHandle"],
                    "ProfileId": txn["key"]["extractionProfileId"],
                    "Phase": obs["phase"],
                    "Disposition": obs["disposition"],
                    "Terminal": str(obs["terminal"]).lower(),
                }
                if any(fields.get(key) != value for key, value in required.items()):
                    issues.append(f"{scenario}/{obs['observationId']}: field mismatch")
                stamp = re.search(r'<time="([^"]+)" date="([^"]+)"', line)
                if stamp:
                    evidence_time = datetime.strptime(
                        f"{stamp.group(2)}T{stamp.group(1)}",
                        "%m-%d-%YT%H:%M:%S.%f%z",
                    ).replace(tzinfo=None)
                    if evidence_time > captured:
                        issues.append(f"{scenario}/{obs['observationId']}: after bundle capture")

print(f"audit issues: {len(issues)}")
print("\n".join(issues) if issues else "none")
PY

Length of output: 3834


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import json, re
from pathlib import Path
from datetime import datetime

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
issues = []
for scenario_dir in sorted(p for p in root.iterdir() if p.is_dir()):
    scenario = scenario_dir.name
    manifest = json.loads((scenario_dir / "manifest.json").read_text())
    expected = json.loads((scenario_dir / "expected.json").read_text())
    captured = datetime.strptime(manifest["bundle"]["capturedUtc"], "%Y-%m-%dT%H:%M:%SZ")
    artifacts = {a["artifactId"]: a for a in manifest["artifacts"]}
    rel_paths, fingerprints = set(), set()

    for a in manifest["artifacts"]:
        aid = a["artifactId"]
        if a["pathFingerprint"] in fingerprints:
            issues.append(f"{scenario}/{aid}: duplicate pathFingerprint")
        fingerprints.add(a["pathFingerprint"])
        if a["captureState"] in {"captured", "capped", "parseFailed"}:
            rel = a["relativePath"]
            if rel in rel_paths:
                issues.append(f"{scenario}/{aid}: duplicate relativePath")
            rel_paths.add(rel)
            if len((scenario_dir / rel).read_bytes()) != a["bytesCopied"]:
                issues.append(f"{scenario}/{aid}: byte count mismatch")

    for txn in expected["transactions"]:
        for obs in txn["observations"]:
            for ev in obs["evidence"]:
                a = artifacts[ev["artifactId"]]
                line = (scenario_dir / a["relativePath"]).read_text().splitlines()[ev["startLine"] - 1]
                message = re.search(r'<!\[LOG\[(.*?)\]LOG\]!>', line).group(1)
                fields = dict(x.strip().split("=", 1) for x in message.split(";")[1:])
                required = {
                    "PackageId": txn["key"]["packageId"],
                    "ContentId": txn["key"]["contentId"],
                    "ContentVersion": str(txn["key"]["contentVersion"]),
                    "SiteCode": txn["key"]["siteCode"],
                    "DpHandle": txn["key"]["distributionPointHandle"],
                    "ProfileId": txn["key"]["extractionProfileId"],
                    "Phase": obs["phase"],
                    "Disposition": obs["disposition"],
                    "Terminal": str(obs["terminal"]).lower(),
                }
                if any(fields.get(key) != value for key, value in required.items()):
                    issues.append(f"{scenario}/{obs['observationId']}: field mismatch")
                stamp = re.search(r'<time="([^"]+)" date="([^"]+)"', line)
                if stamp:
                    raw = f"{stamp.group(2)}T{stamp.group(1)}"
                    if not raw.endswith("+000"):
                        issues.append(f"{scenario}/{obs['observationId']}: unexpected nonzero offset")
                    else:
                        evidence_time = datetime.strptime(raw[:-4], "%m-%d-%YT%H:%M:%S.%f")
                        if evidence_time > captured:
                            issues.append(f"{scenario}/{obs['observationId']}: after bundle capture")

print(f"audit issues: {len(issues)}")
print("\n".join(issues) if issues else "none")
PY

Length of output: 3336


@adamgell, I completed a substantive static review of exact head 15b3474f8721a3453e8732e264e0d20464e37288.

I found two contract gaps.

  1. P1 — Preserve the producer-host and workflow-subject boundary.
    crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs, Line 459 accepts any safe: value as producerHostHandle. Line 465 requires host/subject equality only for distributionPoint producers.

    A mutation that changes a siteServer artifact, such as dp-healthy-01-distmgr, to use safe:dp:lab-dp-01 as its producerHostHandle still passes these checks. The artifact retains producerRole: "siteServer", so allowed_source accepts it. The DP-only equality condition does not run. The normalizer then exports the DP handle as the site-server evidence host.

    This permits a site-server physical producer to collapse onto its DP workflow subject. It conflicts with the required producer/subject topology and exact provenance. Require role-specific producer-host namespaces and identities. For example, require siteServer to use an approved safe:server: handle, client to use an approved safe:client: handle, and distributionPoint to use the exact subject DP handle. Add a mutation test for the site-server-to-DP host alias.

  2. P2 — Bind each source-local classification to its referenced artifact semantics.
    crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs, Lines 1227-1270 validate only the classification name, low confidence, and artifact existence. They do not validate the role, capture state, rotation state, or logical evidence of the referenced artifacts.

    Therefore, a future fixture can classify a server artifact as ignoredClientEvidence, classify a captured complete artifact as malformedEvidence, or classify unrelated artifacts as rotationSplit. The contract accepts these changes if the artifact IDs exist. This weakens the required client isolation and rotation/malformed fail-closed rules.

    Bind ignoredClientEvidence to client-role artifacts and cited client logical records. Bind malformedEvidence to parseFailed artifacts. Bind rotationSplit to incomplete fragments of the same rotation lineage. Add negative mutation tests for each invalid classification/artifact pairing.

The read-only fixture audit found no inconsistencies in copied byte counts, physical-path or fingerprint collisions, cited exact key fields, or evidence timestamps after the canonical bundle capture. I could not execute the Rust test suite in this sandbox.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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/tests/sccm_server_distribution_point_fixture_contract.rs`:
- Around line 660-668: Update the non-physical artifact validation branch in the
fixture contract test to reject artifacts containing collectionLimit, alongside
the existing physical-capture fields. Add a mutation case that injects
collectionLimit into an artifact with a non-captured state and assert that the
contract reports the violation.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 28cc4e38-f892-47ab-b985-aa21015983c9

📥 Commits

Reviewing files that changed from the base of the PR and between 25b3733 and 15b3474.

⛔ Files ignored due to path filters (24)
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/client-only-looking-request/evidence/client-content-control/current/DataTransferService.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/evidence/server-dp-distribution/dp-02/current/SMSDPProv.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/evidence/server-dp-distribution/dp/current/SMSDPProv.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/evidence/server-dp-distribution/site/current/PkgXferMgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/evidence/server-dp-distribution/site/current/distmgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/evidence/server-dp-distribution/site/dp-02/current/PkgXferMgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/evidence/server-dp-distribution/site/dp-02/current/distmgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/distribution-failure/evidence/server-dp-distribution/site/current/distmgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/healthy-package/evidence/server-dp-distribution/dp/current/SMSDPProv.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/healthy-package/evidence/server-dp-distribution/site/current/PkgXferMgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/healthy-package/evidence/server-dp-distribution/site/current/distmgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/incomplete/evidence/server-dp-distribution/site/current/distmgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/rotation-boundary/evidence/server-dp-distribution/dp/malformed/SMSDPProv.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/rotation-boundary/evidence/server-dp-distribution/site/current/distmgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/rotation-boundary/evidence/server-dp-distribution/site/lo_/distmgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/evidence/server-dp-distribution/dp/current/SMSDPProv.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/evidence/server-dp-distribution/site/current/PkgXferMgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/evidence/server-dp-distribution/site/current/distmgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/evidence/server-dp-serve/dp/current/SMSdpmon.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/transfer-retry/evidence/server-dp-distribution/site/current/PkgXferMgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/transfer-retry/evidence/server-dp-distribution/site/current/distmgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/validation-failure/evidence/server-dp-distribution/dp/current/SMSDPProv.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/validation-failure/evidence/server-dp-distribution/site/current/PkgXferMgr.log is excluded by !**/*.log
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/validation-failure/evidence/server-dp-distribution/site/current/distmgr.log is excluded by !**/*.log
📒 Files selected for processing (23)
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/README.md
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/absent-dp/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/absent-dp/manifest.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/client-only-looking-request/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/client-only-looking-request/manifest.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/manifest.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/distribution-failure/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/distribution-failure/manifest.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/healthy-package/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/healthy-package/manifest.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/incomplete/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/incomplete/manifest.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/rotation-boundary/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/rotation-boundary/manifest.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/manifest.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/transfer-retry/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/transfer-retry/manifest.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/validation-failure/expected.json
  • crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/validation-failure/manifest.json
  • crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs
  • docs/sccm/preparation/issue-329-distribution-point-corpus.md

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a fresh substantive exact-head review of 25b37333affde22b4ef8a19f4a5f3d89c082b599..d07ab1575d2d5a4360dc0f606064b8dbc6525170 for Issue #329. Verify the prior producer-host/workflow-subject P1, source-local classification P2, and nonphysical collectionLimit finding are structurally closed. Also review one-physical-capture/multi-DP record scoping, exact package/content/version/DP/profile binding, source-role-phase ownership, normalized timestamp/capture ordering, coverage/rotation/malformed semantics, collision-safe identities, deterministic output, bounded artifact requests, and prevention of client/DP causal claims. Run evidence-backed analysis; a status-only, skipped, incremental-only, or rate-limited response is not approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='25b37333affde22b4ef8a19f4a5f3d89c082b599'
head='d07ab1575d2d5a4360dc0f606064b8dbc6525170'
contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'
root='crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point'

git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"

echo '=== exact changed files ==='
git diff --name-status "$base" "$head"
echo '=== diffstat ==='
git diff --stat "$base" "$head"

echo '=== Rust contract outline ==='
ast-grep outline "$contract" --items all

echo '=== prior-finding and invariant locations ==='
rg -n -C 5 --type rust \
  'producerHostHandle|workflowSubjectHandle|collectionLimit|sourceLocalObservations|ignoredClientEvidence|malformedEvidence|rotationSplit|distributionPointHandle|pathFingerprint|relativePath|artifactRequests|causal' \
  "$contract"

echo '=== contract sections: manifest and topology ==='
cat -n "$contract" | sed -n '400,760p'
echo '=== contract sections: expected records and output ==='
cat -n "$contract" | sed -n '760,1250p'
echo '=== contract sections: source-local and mutation tests ==='
cat -n "$contract" | sed -n '1250,1900p'

echo '=== exact diff for contract and preparation document ==='
git diff --no-ext-diff --unified=40 "$base" "$head" -- \
  "$contract" \
  docs/sccm/preparation/issue-329-distribution-point-corpus.md

echo '=== static fixture corpus audit ==='
python3 - <<'PY'
import json, re
from pathlib import Path
from collections import defaultdict

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
problems = []
for d in sorted(p for p in root.iterdir() if p.is_dir()):
    scenario = d.name
    try:
        manifest = json.loads((d / "manifest.json").read_text())
        expected = json.loads((d / "expected.json").read_text())
    except Exception as exc:
        problems.append(f"{scenario}: JSON load failed: {exc}")
        continue

    artifacts = {a["artifactId"]: a for a in manifest.get("artifacts", [])}
    rels, fps = set(), set()
    host_subject_by_physical = defaultdict(set)

    for a in manifest.get("artifacts", []):
        aid = a["artifactId"]
        role = a.get("producerRole")
        host = a.get("producerHostHandle", "")
        subject = a.get("workflowSubjectHandle", "")
        state = a.get("captureState")
        limit = a.get("collectionLimit")

        expected_prefix = {
            "siteServer": "safe:server:",
            "client": "safe:client:",
            "distributionPoint": "safe:dp:",
        }.get(role)
        if expected_prefix and not host.startswith(expected_prefix):
            problems.append(f"{scenario}/{aid}: {role} host {host!r} lacks {expected_prefix!r}")
        if role == "distributionPoint" and host != subject:
            problems.append(f"{scenario}/{aid}: DP host/subject differ")
        if not isinstance(limit, dict) and limit is not None:
            problems.append(f"{scenario}/{aid}: collectionLimit is not an object")
        if isinstance(limit, dict) and state in {"absent", "accessDenied"} and any(
            key in limit for key in ("maxBytes", "bytesCopied", "lineCount")
        ):
            problems.append(f"{scenario}/{aid}: nonphysical {state} has physical limit fields")

        fp = a.get("pathFingerprint")
        if fp in fps:
            problems.append(f"{scenario}/{aid}: duplicate pathFingerprint")
        fps.add(fp)
        if state in {"captured", "capped", "parseFailed"}:
            rel = a.get("relativePath")
            if rel in rels:
                problems.append(f"{scenario}/{aid}: duplicate relativePath")
            rels.add(rel)
            if not isinstance(rel, str) or rel.startswith("/") or ".." in Path(rel).parts:
                problems.append(f"{scenario}/{aid}: unsafe relativePath")
            else:
                path = d / rel
                if not path.is_file():
                    problems.append(f"{scenario}/{aid}: missing physical evidence")
                elif a.get("bytesCopied") != len(path.read_bytes()):
                    problems.append(f"{scenario}/{aid}: copied byte count mismatch")

    # Validate cited transaction evidence against the raw CCM envelope and its artifact.
    for txn in expected.get("transactions", []):
        key = txn.get("key", {})
        for obs in txn.get("observations", []):
            for ev in obs.get("evidence", []):
                aid = ev.get("artifactId")
                a = artifacts.get(aid)
                if not a:
                    problems.append(f"{scenario}/{obs.get('observationId')}: unknown evidence artifact")
                    continue
                if a.get("producerRole") == "client":
                    problems.append(f"{scenario}/{obs.get('observationId')}: transaction cites client artifact")
                try:
                    line = (d / a["relativePath"]).read_text().splitlines()[ev["startLine"] - 1]
                    message = re.search(r'<!\[LOG\[(.*?)\]LOG\]!>', line).group(1)
                    fields = dict(part.strip().split("=", 1) for part in message.split(";")[1:])
                except Exception as exc:
                    problems.append(f"{scenario}/{obs.get('observationId')}: unreadable CCM evidence: {exc}")
                    continue
                required = {
                    "PackageId": key.get("packageId"),
                    "ContentId": key.get("contentId"),
                    "ContentVersion": str(key.get("contentVersion")),
                    "SiteCode": key.get("siteCode"),
                    "DpHandle": key.get("distributionPointHandle"),
                    "ProfileId": key.get("extractionProfileId"),
                    "Phase": obs.get("phase"),
                    "Disposition": obs.get("disposition"),
                    "Terminal": str(obs.get("terminal")).lower(),
                }
                for name, value in required.items():
                    if fields.get(name) != value:
                        problems.append(
                            f"{scenario}/{obs.get('observationId')}: {name}={fields.get(name)!r}, expected {value!r}"
                        )

    # Validate source-local classification binding from fixture values.
    for obs in expected.get("sourceLocalObservations", []):
        cls = obs.get("classification")
        cited = [artifacts.get(aid) for aid in obs.get("artifactIds", [])]
        if not cited or any(a is None for a in cited):
            problems.append(f"{scenario}/{cls}: missing source-local artifact")
            continue
        if cls == "ignoredClientEvidence" and any(a.get("producerRole") != "client" for a in cited):
            problems.append(f"{scenario}/{cls}: non-client artifact")
        if cls == "malformedEvidence" and any(a.get("captureState") != "parseFailed" for a in cited):
            problems.append(f"{scenario}/{cls}: artifact is not parseFailed")
        if cls == "rotationSplit":
            lineages = {a.get("rotation", {}).get("lineageId") for a in cited}
            if len(lineages) != 1 or None in lineages:
                problems.append(f"{scenario}/{cls}: artifacts lack one rotation lineage")

print(f"fixture audit problems: {len(problems)}")
print("\n".join(problems) if problems else "none")
PY

Length of output: 193978


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='25b37333affde22b4ef8a19f4a5f3d89c082b599'
head='d07ab1575d2d5a4360dc0f606064b8dbc6525170'
contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'
root='crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point'

echo '=== all exact-range pathFingerprint references ==='
git grep -n -E 'pathFingerprint|fingerprint' "$head" -- \
  crates/cmtraceopen-parser/tests \
  docs/sccm/preparation/issue-329-distribution-point-corpus.md || true

echo '=== validator region before artifact loop ==='
cat -n "$contract" | sed -n '330,430p'

echo '=== fixture artifact identity rows ==='
python3 - <<'PY'
import json
from pathlib import Path

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
for scenario_dir in sorted(p for p in root.iterdir() if p.is_dir()):
    manifest = json.loads((scenario_dir / "manifest.json").read_text())
    print(f"[{scenario_dir.name}]")
    for artifact in manifest["artifacts"]:
        print(
            " | ".join([
                artifact["artifactId"],
                artifact["pathFingerprint"],
                artifact["sanitizedSourcePath"],
                artifact["producerHostHandle"],
                artifact["rotation"]["kind"],
                str(artifact["rotation"].get("value", "")),
            ])
        )
PY

echo '=== structural mutation model for pathFingerprint acceptance ==='
python3 - <<'PY'
import json
from pathlib import Path

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
manifest = json.loads((root / "healthy-package" / "manifest.json").read_text())

def current_contract_fingerprint_check(artifact):
    # This matches the pathFingerprint predicate at contract Lines 493-498.
    value = artifact.get("pathFingerprint")
    return isinstance(value, str) and value.startswith("synthetic:")

first, second = manifest["artifacts"][:2]
duplicate = json.loads(json.dumps(manifest))
duplicate["artifacts"][1]["pathFingerprint"] = duplicate["artifacts"][0]["pathFingerprint"]

detached = json.loads(json.dumps(manifest))
detached["artifacts"][1]["pathFingerprint"] = "synthetic:unrelated-opaque-fingerprint"

print("baseline individual predicates:", [current_contract_fingerprint_check(a) for a in manifest["artifacts"]])
print("duplicate fingerprint predicates:", [current_contract_fingerprint_check(a) for a in duplicate["artifacts"]])
print("detached fingerprint predicates:", [current_contract_fingerprint_check(a) for a in detached["artifacts"]])
print("duplicate value:", duplicate["artifacts"][0]["pathFingerprint"])
print("detached value:", detached["artifacts"][1]["pathFingerprint"])
print("The shown contract stores no pathFingerprint set and derives physical identity without pathFingerprint.")
PY

Length of output: 182201


@adamgell I completed a fresh static review of exact head d07ab1575d2d5a4360dc0f606064b8dbc6525170.

I found no new actionable findings.

The prior findings are structurally closed.

  • P1 producer host and workflow subject: The contract now requires the exact site-server and client handles for their roles. It requires a DP producer host to equal its DP workflow subject. The site-server-to-DP-host mutation is rejected.
  • P2 source-local classification: ignoredClientEvidence, rotationSplit, and malformedEvidence now require their matching artifact role, coverage state, rotation semantics, and logical evidence rules. The negative relabeling mutations are present.
  • Nonphysical collectionLimit: Nonphysical states reject collectionLimit, relativePath, copied bytes, encoding, and rotation fragment facts. The absent-artifact collection-limit mutation is rejected.

I also verified these controls:

  • The multi-DP site-server logs use one physical capture. Each logical record must carry a declared exact DpHandle.
  • Transaction evidence binds exact package, content, version, site, DP, and extraction-profile fields.
  • Source and phase ownership is limited by the source catalog and phase_allowed_for_artifact.
  • The contract requires normalized UTC timestamps. It rejects evidence after artifact collection or bundle capture.
  • Coverage is an exact sorted projection of manifest states. Rotation fragments and malformed evidence remain noncorrelatable.
  • Physical evidence paths are bounded and unique. Physical source identities prevent duplicate captures for separate workflow subjects.
  • Transactions, observations, coverage rows, source-local observations, and artifact requests must be deterministically sorted.
  • Artifact requests use only catalogued source IDs and bounded reason codes with matching noncomplete coverage.
  • Client evidence cannot enter a DP transaction. The expected client causal-claim list must be empty.

The static corpus audit found no byte-count, physical-path, fingerprint, exact-field, or timestamp violations. I could not run the Rust test suite because this sandbox does not execute repository code.

You are interacting with an AI system.

@adamgell adamgell added test Testing related sccm SCCM/ConfigMgr related parser Log parser related enhancement New feature or request labels Jul 31, 2026
@adamgell adamgell added this to the SCCM End-to-End Diagnostics milestone Jul 31, 2026

@adamgell adamgell left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent exact-head review — BLOCKED

Reviewed exact 25b37333affde22b4ef8a19f4a5f3d89c082b599..d07ab1575d2d5a4360dc0f606064b8dbc6525170 in detached review worktree .worktrees/review-374-d07-exact. Keep PR #374 draft/open.

A permanent external-consumer mutation probe is RED with seven accepted fail-open states:

  • duplicate pathFingerprint;
  • dot-segment physical evidence alias;
  • unsafe identity-bearing sanitizedSourcePath;
  • unknown 5.00.TEST.* version retaining Exact profile output;
  • non-string topology role silently discarded;
  • noncanonical value on a Current rotation;
  • duplicate observation reusing the same physical evidence.

Five line-level P1 threads group those into path/provenance, version selection, typed topology, canonical rotation, and unique evidence-consumption fixes. The prior CodeRabbit corrections for producer role, source-local classifications, and nonphysical capture provenance do verify. CodeRabbit also produced a substantive exact-head no-new-findings result at #374 (comment), but the reproduced red probe supersedes it.

Independent gates at the committed exact head: focused 8/8, full parser, server intake, spine, default strict Clippy, Rust 1.88 wasm32, TypeScript, owned rustfmt, and diff checks pass. No production reducer, native collection, correlation, or live Windows acceptance is claimed.

Require permanent regressions for every accepted mutation, all exact-head gates, fresh substantive CodeRabbit, and a different independent PASS before readiness or merge.

@adamgell

Copy link
Copy Markdown
Owner Author

#329 executable-probe review fixes — exact head

Commit: 98a72fe8db7315497935d7382a5572e1f63a3f61

Scope: prep-only fixture-validator hardening. No production reducer, shared SCCM model, parser kind, native collector, correlator, or live Windows claim changed. The ten-scenario / 27-artifact / 22-evidence synthetic corpus is unchanged.

RED → GREEN: the new focused probes first failed 5 tests and reproduced every reviewed acceptance: duplicate fingerprint, dot-segment destination alias, unsafe sanitized path, unknown/malformed/prefix-collision version retaining Exact, non-string/unknown role, noncanonical rotation shapes, duplicate observation ID, and reused physical evidence. The exact correction is now 13/13 green.

Verification:

  • cargo test --locked -p cmtraceopen-parser --test sccm_server_distribution_point_fixture_contract — 13/13
  • cargo test --locked -p cmtraceopen-parser --test sccm_server_intake_fixture_contract — 1/1
  • cargo test --locked -p cmtraceopen-parser --test sccm_spine_contract — 61/61
  • cargo test --locked -p cmtraceopen-parser — 667/667
  • cargo clippy --locked -p cmtraceopen-parser --all-targets -- -D warnings — pass
  • cargo +1.88.0 check --locked -p cmtraceopen-parser --target wasm32-unknown-unknown — pass
  • npx tsc --noEmit — pass
  • all owned corpus JSON via jq empty — pass
  • owned Rust 1.88 formatting and git diff --check — pass

Repository-wide cargo fmt --check --all still reports the known 17 unrelated ESP/Tauri files; neither owned file is in that baseline.

All five exact-head independent review threads were answered with permanent regression evidence and resolved. The PR remains draft/unmerged pending fresh substantive exact-head CodeRabbit and the #318-first dependency gate.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a fresh substantive review of exact head 98a72fe8db7315497935d7382a5572e1f63a3f61, including the executable review-fix mutations and preserving the prep-only #329 boundary.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='98a72fe8db7315497935d7382a5572e1f63a3f61'
git cat-file -e "${head}^{commit}"
base="$(git rev-parse "${head}^")"
contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'

echo "=== range ==="
printf '%s..%s\n' "$base" "$head"
echo '=== commit ==='
git show -s --format=fuller "$head"
echo '=== changed files ==='
git diff --name-status "$base" "$head"
echo '=== diffstat ==='
git diff --stat "$base" "$head"

echo '=== changed Rust outlines ==='
git diff --name-only "$base" "$head" | while IFS= read -r path; do
  case "$path" in
    *.rs)
      echo "--- $path"
      ast-grep outline "$path" --items all
      ;;
  esac
done

echo '=== relevant validator and mutation-test locations ==='
rg -n -C 4 --type rust \
  'pathFingerprint|sanitizedSourcePath|relativePath|collectionLimit|producerHostHandle|workflowSubjectHandle|sourceLocalObservations|Exact|version|rotation|observationId|physical|mutation|assert.*err|assert.*fail' \
  "$contract"

echo '=== exact patch ==='
git diff --no-ext-diff --unified=80 "$base" "$head"

Length of output: 110834


🏁 Script executed:

#!/bin/bash
set -euo pipefail

contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'

echo '=== validator helpers and manifest validation ==='
sed -n '88,810p' "$contract"

echo '=== transaction and source-local validation ==='
sed -n '1000,1628p' "$contract"

echo '=== complete new executable probes ==='
sed -n '1960,2160p' "$contract"

echo '=== SccmRotation definition and serde attributes ==='
rg -n -C 10 --type rust 'enum SccmRotation|SccmRotation::Timestamped|SccmRotation::Numbered' crates

echo '=== static strengthened-corpus audit ==='
python3 - <<'PY'
import json, re
from pathlib import Path
from collections import Counter, defaultdict
from datetime import datetime

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
errors = []
all_paths = []
all_fingerprints = []

def safe_segments(path):
    return bool(path) and "\\" not in path and all(
        part not in ("", ".", "..") and re.fullmatch(r"[A-Za-z0-9._-]+", part)
        for part in path.split("/")
    )

for directory in sorted(p for p in root.iterdir() if p.is_dir()):
    manifest = json.loads((directory / "manifest.json").read_text())
    expected = json.loads((directory / "expected.json").read_text())
    scenario = directory.name
    artifacts = {a["artifactId"]: a for a in manifest["artifacts"]}
    seen_paths = set()
    seen_fingerprints = set()
    physical = set()

    for artifact in manifest["artifacts"]:
        aid = artifact["artifactId"]
        if artifact.get("sourceVersion") != "5.00.TEST.0001":
            errors.append(f"{scenario}/{aid}: sourceVersion is not exact")
        fingerprint = artifact.get("pathFingerprint", "")
        if not re.fullmatch(r"synthetic:[A-Za-z0-9._-]+", fingerprint):
            errors.append(f"{scenario}/{aid}: unsafe fingerprint")
        if fingerprint in seen_fingerprints:
            errors.append(f"{scenario}/{aid}: duplicate fingerprint")
        seen_fingerprints.add(fingerprint)
        all_fingerprints.append(fingerprint)

        source_path = artifact.get("sanitizedSourcePath", "")
        if not source_path.startswith("SYNTHETIC://") or not safe_segments(source_path[12:]):
            errors.append(f"{scenario}/{aid}: unsafe sanitized path")

        rotation = artifact.get("rotation", {})
        identity = (
            artifact.get("producerHostHandle"), source_path,
            artifact.get("originalBasename"), rotation.get("kind"),
            str(rotation.get("value", "")),
        )
        if identity in physical:
            errors.append(f"{scenario}/{aid}: duplicate physical identity")
        physical.add(identity)

        state = artifact.get("captureState")
        if state in {"captured", "capped", "parseFailed"}:
            relative = artifact.get("relativePath", "")
            if not relative.startswith("evidence/") or not safe_segments(relative[9:]):
                errors.append(f"{scenario}/{aid}: unsafe evidence path")
            if relative.split("/")[-1:] != [artifact.get("originalBasename")]:
                errors.append(f"{scenario}/{aid}: evidence basename mismatch")
            if relative in seen_paths:
                errors.append(f"{scenario}/{aid}: duplicate destination")
            seen_paths.add(relative)
            file_path = directory / relative
            if not file_path.is_file():
                errors.append(f"{scenario}/{aid}: no fixture file")
            elif len(file_path.read_bytes()) != artifact.get("bytesCopied"):
                errors.append(f"{scenario}/{aid}: bytesCopied mismatch")
        elif any(key in artifact for key in ("relativePath", "bytesCopied", "encoding", "collectionLimit")):
            errors.append(f"{scenario}/{aid}: nonphysical capture facts")
        all_paths.extend((scenario, p) for p in seen_paths)

    for txn in expected.get("transactions", []):
        consumed = set()
        observation_ids = set()
        for observation in txn.get("observations", []):
            oid = observation.get("observationId")
            if oid in observation_ids:
                errors.append(f"{scenario}: duplicate observationId {oid}")
            observation_ids.add(oid)
            for reference in observation.get("evidence", []):
                key = (reference.get("artifactId"), reference.get("startLine"), reference.get("endLine"))
                if key in consumed:
                    errors.append(f"{scenario}/{oid}: reused evidence")
                consumed.add(key)

print(f"static audit errors: {len(errors)}")
print("\n".join(errors) if errors else "none")
print(f"scenario-local unique fingerprint rows: {len(all_fingerprints)}")
PY

Length of output: 83902


@adamgell I completed a fresh static review of exact head 98a72fe8db7315497935d7382a5572e1f63a3f61.

I found one actionable issue.

P1 — Reject non-string values in distributionPointHandles

In crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs, the manifest validator builds distribution_point_handles with:

values
    .iter()
    .filter_map(Value::as_str)
    .map(str::to_owned)
    .collect::<Vec<_>>()

This silently discards non-string array values. For example, a mutation that appends 7 to an otherwise valid topology.distributionPointHandles array retains the same validated string-handle set. The sorting, uniqueness, primary-DP, producer-host, workflow-subject, and transaction-key checks then still pass.

This bypasses the strict typed DP-topology contract. It also differs from rolesObserved, which now rejects non-string and unknown values.

Require every distributionPointHandles item to be a string before normalization. Reject unsupported values instead of filtering them out. Add a negative mutation test that appends a number, or another non-string JSON value, to the valid handle array.

The executable probes otherwise close the reviewed issues:

  • The contract rejects duplicate fingerprints, dot-segment destination aliases, and unsafe sanitized paths.
  • The profile requires the exact 5.00.TEST.0001 source version.
  • The contract validates typed known roles and canonical rotation values.
  • The contract rejects duplicate observation IDs and repeated physical evidence references.
  • The patch remains within the preparation-only #329 boundary. It changes no production parser, reducer, model, collector, or correlator.
  • The static corpus audit found zero errors across the 27 artifact rows.

I could not execute the Rust test suite in this sandbox.

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

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

@adamgell I will perform a fresh substantive full review of exact head ee168ccfb05c926b95b8c0cef6d97bc53262da13 against codex/parser-family-skeleton.

I will treat all earlier approvals as stale. I will verify the three corrected boundaries and the full final-head diff.

✅ Action performed

Full 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 33 minutes.

@adamgell

Copy link
Copy Markdown
Owner Author

Independent-review correction pushed — exact ee168ccf

Commits:

Closed semantics:

  • every normalized CCM logical record must be consumed by an explicit transaction or source-local classification, so uncited later same-key terminal failure cannot leave stale high success;
  • every non-client artifact producer role must appear in typed rolesObserved; the check is intentionally one-way so absent/default-path coverage still does not prove a role missing;
  • roleAssessment.distributionPointObserved is a required Boolean and its typed value is the exact topology projection; missing/null/string/number fail closed.

Verification at exact head:

cargo fmt --check --all continues to report only the inherited 17 non-#329 files; the sole owned file passes scoped rustfmt. Local CodeRabbit CLI 0.7.1 was authenticated but rate-limited for one minute and is not counted as approval. Fresh hosted final-head request: #374 (comment).

All three handled review threads were replied to and resolved. Keep the PR draft/open pending a substantive exact-head CodeRabbit result and a different independent exact-head PASS. No production reducer, native capture, correlation, readiness, merge, closure, or live Windows acceptance is claimed.

@adamgell

Copy link
Copy Markdown
Owner Author

CodeRabbit correction-range result

Authenticated CodeRabbit CLI 0.7.1 completed a fresh review of exact range 9a63b6bd..ee168ccf and reported 0 findings for the sole changed file.

The hosted request was also acknowledged at #374 (comment), but it is fair-usage rate-limited for 33 minutes. That hosted status is not counted as approval. The draft stays blocked on a fresh hosted substantive final-head result plus a different independent exact-head PASS.

@adamgell adamgell left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent exact-head review — BLOCKED

Reviewed exact ee168cc against foundation a8a367c in clean isolated branch codex/review-329-ee16-independent. This is a semantic block on the #329 preparation contract; no production reducer, native capture, correlation, merge, readiness, or live Windows acceptance is being reviewed or claimed.

The three prior blockers verify at this head: all normalized CCM records must be consumed, non-client producer roles must occur in rolesObserved, and distributionPointObserved is a required Boolean exact topology projection. The committed #329 suite is 41/41 green.

A disposable external exact-head probe is nevertheless RED in two same-root cases. First, healthy-package can append and explicitly cite a later same-key serveOrReport/retrying/nonterminal record after the terminal success while retaining succeeded/success/high. Second, transfer-retry can append and cite a later same-key transfer/succeeded/nonterminal record while retaining deferred/blockedOrDeferred/medium. In both cases the validator returned Ok, so the negative probe assertions failed. The state guards aggregate whether a success, failure, or retry occurred anywhere, rather than requiring the reported outcome to agree with the latest normalized observation. This leaves stale high success and stale deferred outcomes possible.

Fresh exact-head gates: focused #329 41/41; server intake 1/1; spine 136/136; full parser pass; strict all-target Clippy pass; Rust 1.88 wasm32 check pass; TypeScript pass; 20/20 JSON files valid; scoped Rust formatting pass; range/worktree diff checks pass and status is clean. Repository-wide formatting reports 17 inherited non-#329 files. Hosted CodeRabbit and the local CLI are currently rate-limited, so neither is counted as approval.

GitHub does not allow the authenticated repository owner to submit REQUEST_CHANGES on the owner PR, so this COMMENTED review records the formal blocking disposition. Add permanent red-to-green regressions for latest-observation outcome selection, rerun exact-head gates, obtain substantive final-head CodeRabbit, then request a different independent PASS. Keep PR #374 draft/open and keep #333 content-to-DP blocked.

@adamgell

adamgell commented Jul 31, 2026

Copy link
Copy Markdown
Owner Author

Active correction owner — exact ee168cc

I own the isolated round-two #329 correction from exact ee168ccfb05c926b95b8c0cef6d97bc53262da13.

  • Worktree: .worktrees/sccm-329-ee16-round2
  • Branch: codex/sccm-329-ee16-round2
  • Owned contract: crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs plus the smallest validator change in that same contract
  • RED scope: later exact-key serveOrReport/retrying/nonterminal must invalidate stale success/high; later exact-key transfer/succeeded/nonterminal must invalidate stale deferred/blockedOrDeferred/medium
  • Push guard: PR test(sccm): prepare Distribution Point corpus #374 must remain exact ee168ccf; correction commits will be non-force fast-forward only after full gates

PR stays draft/open. #333 remains blocked. No production reducer, native capture, merge readiness, or live Windows acceptance is claimed.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a fresh substantive review of exact head 4f8bd3b6e89ab208932446756ed6a29596f8da4c, including both latest-observation regressions and the full evidence, coverage, topology, rotation, privacy, and deterministic-output contract. Treat every earlier approval as stale. A skipped, status-only, or rate-limited response is not approval.

@adamgell

Copy link
Copy Markdown
Owner Author

Latest-observation correction pushed — exact 4f8bd3b6

Commits:

Closed behavior: transaction success now requires the latest ordered exact-key observation to be terminal success; blocked/deferred now requires the latest observation to remain nonterminal retrying/deferred. The tests append real synthetic CCM logical records, cite their exact line ranges, and preserve an earlier retry followed by later terminal recovery.

Fixture matrix remains the ten sanitized scenarios: healthy package, distribution failure, transfer retry, validation failure, content-version mismatch, serve observed, client-only-looking request, rotation boundary, absent DP, and incomplete coverage.

Verification at exact head:

  • cargo test --locked -p cmtraceopen-parser --test sccm_server_distribution_point_fixture_contract -- --nocapture: 43/43;
  • server intake 1/1; SCCM spine 136/136; full parser 772/772;
  • strict all-target Clippy;
  • Rust 1.88.0 wasm32-unknown-unknown;
  • TypeScript no-emit; 20/20 fixture JSON; scoped rustfmt; range diff and clean status.

Repository-wide fmt still reports only the inherited 17 non-#329 files. The owned file is rustfmt-clean. The review thread is replied/resolved. Authenticated CodeRabbit CLI 0.7.1 is rate-limited for 10 minutes and is not approval. Fresh hosted exact-head request: #374 (comment).

Keep PR draft/open pending a substantive exact-head CodeRabbit result and a different independent exact-head PASS. #333 content-to-DP stays blocked. This slice remains synthetic preparation/source-contract work; no production reducer, native capture, merge readiness, issue closure, or live Windows acceptance is claimed.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='4f8bd3b6e89ab208932446756ed6a29596f8da4c'
contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'
root='crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point'
doc='docs/sccm/preparation/issue-329-distribution-point-corpus.md'

git cat-file -e "${head}^{commit}"
echo '=== exact head ==='
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$head"

echo '=== candidate PR bases and ancestry ==='
for base in \
  'a8a367c661cd17bd1e73b87724c143ec8565ffc7' \
  'ee168ccfb05c926b95b8c0cef6d97bc53262da13' \
  '9a63b6bd9494882c1006c17ec6b9e9af0bef91d9'
do
  if git cat-file -e "${base}^{commit}" 2>/dev/null; then
    if git merge-base --is-ancestor "$base" "$head"; then
      printf '%s is an ancestor of exact head\n' "$base"
    else
      printf '%s is not an ancestor of exact head\n' "$base"
    fi
  fi
done

base='a8a367c661cd17bd1e73b87724c143ec8565ffc7'
echo '=== full feature-range changed files ==='
git diff --name-status "$base" "$head"
echo '=== full feature-range diffstat ==='
git diff --stat "$base" "$head"
echo '=== correction-range changed files ==='
git diff --name-status 'ee168ccfb05c926b95b8c0cef6d97bc53262da13' "$head"

echo '=== changed paths outside declared scope ==='
git diff --name-only "$base" "$head" |
  awk -v contract="$contract" -v root="$root" -v doc="$doc" '
    $0 == contract || $0 == doc || index($0, root "/") == 1 { next }
    { print }
  '

echo '=== contract map ==='
ast-grep outline "$contract" --items all

echo '=== latest-observation, evidence, coverage, topology, privacy, ordering controls ==='
rg -n -C 8 --type rust \
  'latest|newest|observation|terminal|ServeOrReport|retrying|blockedOrDeferred|confidence|normalized|record.*consum|rolesObserved|distributionPointObserved|evidence_for|physical_evidence_for|coverageGapArtifactIds|artifactRequests|nextSourceId|rotationSplit|parseFailed|ClientHandle|RequestId|identity|sort|determin' \
  "$contract"

echo '=== exact correction diff ==='
git diff --no-ext-diff --unified=60 \
  'ee168ccfb05c926b95b8c0cef6d97bc53262da13' "$head" -- "$contract"

echo '=== targeted contract regions ==='
cat -n "$contract" | sed -n '900,1900p'
cat -n "$contract" | sed -n '2850,3600p'

Length of output: 232298


🏁 Script executed:

#!/bin/bash
set -euo pipefail

contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'
root='crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point'

echo '=== request, source-local, and final projection validation ==='
cat -n "$contract" | sed -n '1900,2185p'

echo '=== manifest topology, physical identity, and path validation ==='
cat -n "$contract" | sed -n '470,900p'

echo '=== schema-aligned raw fixture audit ==='
python3 - <<'PY'
import json
import re
from collections import Counter, defaultdict
from datetime import datetime
from pathlib import Path

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
problems = []
state_chain = ["receiveContent", "distribute", "transfer", "validate", "makeAvailable", "serveOrReport"]
physical_states = {"captured", "capped", "parseFailed"}
request_reason = {
    "absent": "coverageAbsent",
    "accessDenied": "coverageAccessDenied",
    "capped": "coverageCapped",
    "parseFailed": "coverageMalformed",
}
envelope = re.compile(r'<!\[LOG\[(.*?)\]LOG\]!>')
stamp = re.compile(r'<time="([^"]+)" date="([^"]+)"')

def incomplete(artifact):
    return (
        artifact["captureState"] != "captured"
        or artifact["rotation"].get("fragmentComplete") is False
    )

def reason(artifact):
    if artifact["captureState"] in request_reason:
        return request_reason[artifact["captureState"]]
    if artifact["rotation"].get("fragmentComplete") is False:
        return "coverageRotationSplit"
    return None

def ccm_fields(line):
    match = envelope.search(line)
    if not match:
        return None
    parts = [part.strip() for part in match.group(1).split(";")]
    if not parts or parts[0] != "SYNTHETIC FIXTURE":
        return None
    try:
        return dict(part.split("=", 1) for part in parts[1:])
    except ValueError:
        return None

for directory in sorted(path for path in root.iterdir() if path.is_dir()):
    scenario = directory.name
    manifest = json.loads((directory / "manifest.json").read_text())
    expected = json.loads((directory / "expected.json").read_text())
    artifacts = {item["artifactId"]: item for item in manifest["artifacts"]}
    captured = datetime.strptime(manifest["bundle"]["capturedUtc"], "%Y-%m-%dT%H:%M:%SZ")

    if expected["stateChain"] != state_chain or not all(isinstance(x, str) for x in expected["stateChain"]):
        problems.append(f"{scenario}: invalid stateChain")

    handles = manifest["topology"]["distributionPointHandles"]
    if handles != sorted(handles) or len(handles) != len(set(handles)):
        problems.append(f"{scenario}: unordered or duplicate DP topology")

    paths = set()
    fingerprints = set()
    raw_logical = set()
    for aid, artifact in artifacts.items():
        if artifact["pathFingerprint"].casefold() in fingerprints:
            problems.append(f"{scenario}/{aid}: fingerprint collision")
        fingerprints.add(artifact["pathFingerprint"].casefold())
        if artifact["captureState"] in physical_states:
            rel = artifact["relativePath"]
            if rel.casefold() in paths:
                problems.append(f"{scenario}/{aid}: evidence destination collision")
            paths.add(rel.casefold())
            data = (directory / rel).read_bytes()
            if len(data) != artifact["bytesCopied"]:
                problems.append(f"{scenario}/{aid}: bytesCopied mismatch")
            lines = data.decode("utf-8").splitlines()
            if artifact["captureState"] in {"captured", "capped"} and artifact["rotation"]["fragmentComplete"]:
                for n, line in enumerate(lines, 1):
                    if ccm_fields(line) is not None:
                        raw_logical.add((aid, n, n))

    consumed = set()
    seen_obs = set()
    for transaction in expected["transactions"]:
        key = transaction["key"]
        if key["distributionPointHandle"] not in handles:
            problems.append(f"{scenario}/{transaction['transactionId']}: DP outside topology")
        previous_time = None
        for observation in transaction["observations"]:
            oid = observation["observationId"]
            if oid in seen_obs:
                problems.append(f"{scenario}: duplicate observation ID {oid}")
            seen_obs.add(oid)
            for ref in observation["evidence"]:
                marker = (ref["artifactId"], ref["startLine"], ref["endLine"])
                if marker in consumed:
                    problems.append(f"{scenario}: reused transaction evidence {marker}")
                consumed.add(marker)
                artifact = artifacts.get(ref["artifactId"])
                if artifact is None or artifact["producerRole"] == "client":
                    problems.append(f"{scenario}/{oid}: invalid transaction artifact")
                    continue
                line = (directory / artifact["relativePath"]).read_text().splitlines()[ref["startLine"] - 1]
                fields = ccm_fields(line)
                if fields is None:
                    problems.append(f"{scenario}/{oid}: non-CCM transaction reference")
                    continue
                required = {
                    "PackageId": key["packageId"],
                    "ContentId": key["contentId"],
                    "ContentVersion": str(key["contentVersion"]),
                    "SiteCode": key["siteCode"],
                    "DpHandle": key["distributionPointHandle"],
                    "ProfileId": key["extractionProfileId"],
                    "Phase": observation["phase"],
                    "Disposition": observation["disposition"],
                    "Terminal": str(observation["terminal"]).lower(),
                }
                if any(fields.get(name) != value for name, value in required.items()):
                    problems.append(f"{scenario}/{oid}: exact evidence-field mismatch")
                match = stamp.search(line)
                if match:
                    event_time = datetime.strptime(
                        f"{match.group(2)}T{match.group(1)[:-4]}",
                        "%m-%d-%YT%H:%M:%S.%f",
                    )
                    if event_time > captured:
                        problems.append(f"{scenario}/{oid}: evidence after bundle capture")
                    if previous_time is not None and event_time < previous_time:
                        problems.append(f"{scenario}/{transaction['transactionId']}: evidence time regressed")
                    previous_time = event_time

    for observation in expected["sourceLocalObservations"]:
        oid = observation["observationId"]
        if oid in seen_obs:
            problems.append(f"{scenario}: duplicate source-local ID {oid}")
        seen_obs.add(oid)
        cited = set()
        for ref in observation["evidence"]:
            marker = (ref["artifactId"], ref["startLine"], ref["endLine"])
            if marker in consumed:
                problems.append(f"{scenario}: cross-class evidence reuse {marker}")
            consumed.add(marker)
            cited.add(ref["artifactId"])
        if cited != set(observation["artifactIds"]):
            problems.append(f"{scenario}/{oid}: source-local artifact/evidence mismatch")

    if raw_logical != consumed:
        problems.append(
            f"{scenario}: normalized logical consumption mismatch "
            f"unconsumed={sorted(raw_logical-consumed)!r} nonlogical={sorted(consumed-raw_logical)!r}"
        )

    actual_requests = [(row["sourceId"], row["reasonCode"]) for row in expected["artifactRequests"]]
    expected_requests = sorted({
        (artifact["sourceId"], reason(artifact))
        for artifact in artifacts.values()
        if artifact["producerRole"] != "client" and reason(artifact) is not None
    })
    if actual_requests != expected_requests:
        problems.append(f"{scenario}: artifact-request projection mismatch")

    for transaction in expected["transactions"]:
        gaps = transaction["coverageGapArtifactIds"]
        dp = transaction["key"]["distributionPointHandle"]
        required_gaps = sorted(
            aid for aid, artifact in artifacts.items()
            if artifact["sourceId"] == "server-dp-distribution"
            and incomplete(artifact)
            and (
                artifact.get("workflowSubjectHandle") == dp
                or (
                    artifact.get("workflowSubjectHandle") is None
                    and artifact.get("workflowSubjectBasis") == "manifestTopology"
                    and artifact["producerRole"] == "siteServer"
                )
            )
        )
        if sorted(gaps) != required_gaps:
            problems.append(f"{scenario}/{transaction['transactionId']}: exact DP gap mismatch")

    if expected["clientCausalClaims"] != []:
        problems.append(f"{scenario}: client causal claims present")

print(f"scenarios={len([p for p in root.iterdir() if p.is_dir()])}")
print(f"problems={len(problems)}")
print("\n".join(problems) if problems else "none")
PY

echo '=== latest-outcome regression test definitions ==='
sed -n '3315,3390p' "$contract"

Length of output: 46072


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='4f8bd3b6e89ab208932446756ed6a29596f8da4c'
contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'
root='crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point'

echo '=== corrected normalized-versus-physical evidence audit ==='
python3 - <<'PY'
import json, re
from pathlib import Path

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
ccm = re.compile(r'<!\[LOG\[(.*?)\]LOG\]!>')
problems = []

def is_ccm(line):
    match = ccm.search(line)
    return bool(match and match.group(1).split(";", 1)[0].strip() == "SYNTHETIC FIXTURE")

for directory in sorted(path for path in root.iterdir() if path.is_dir()):
    manifest = json.loads((directory / "manifest.json").read_text())
    expected = json.loads((directory / "expected.json").read_text())
    artifacts = {item["artifactId"]: item for item in manifest["artifacts"]}

    normalized = set()
    physical = set()
    for aid, artifact in artifacts.items():
        if artifact["captureState"] not in {"captured", "capped", "parseFailed"}:
            continue
        lines = (directory / artifact["relativePath"]).read_text().splitlines()
        for line_no, line in enumerate(lines, 1):
            physical.add((aid, line_no, line_no))
            if (
                artifact["captureState"] in {"captured", "capped"}
                and artifact["rotation"]["fragmentComplete"] is True
                and is_ccm(line)
            ):
                normalized.add((aid, line_no, line_no))

    transaction_refs = {
        (ref["artifactId"], ref["startLine"], ref["endLine"])
        for txn in expected["transactions"]
        for obs in txn["observations"]
        for ref in obs["evidence"]
    }
    source_local_refs = {
        (ref["artifactId"], ref["startLine"], ref["endLine"])
        for obs in expected["sourceLocalObservations"]
        for ref in obs["evidence"]
    }

    if transaction_refs - normalized:
        problems.append(f"{directory.name}: transaction references outside normalized evidence")
    if normalized - transaction_refs:
        problems.append(f"{directory.name}: normalized evidence lacks a transaction reference")
    if source_local_refs - physical:
        problems.append(f"{directory.name}: source-local references outside physical evidence")
    if transaction_refs & source_local_refs:
        problems.append(f"{directory.name}: evidence is reused across output classes")

print(f"scenarios={len([p for p in root.iterdir() if p.is_dir()])}")
print(f"problems={len(problems)}")
print("\n".join(problems) if problems else "none")
PY

echo '=== raw fixture boundary scan ==='
if rg -n -i \
  -e 'realuser|realrequest|real\.user@example\.com|secret=|C:\\\\Users|/home/|@[^ ]+' \
  "$root" -g '*.log' -g '*.json' -g '*.md'
then
  exit 1
else
  echo 'no prohibited identity, secret, or local-path marker found'
fi

echo '=== exact-head whitespace check ==='
git diff --check 'a8a367c661cd17bd1e73b87724c143ec8565ffc7' "$head"

echo '=== correction commit metadata ==='
git show -s --format='commit=%H%nparent=%P%nsubject=%s' "$head"

Length of output: 3782


@adamgell I completed a fresh substantive static review of exact head 4f8bd3b6e89ab208932446756ed6a29596f8da4c.

I found no new actionable issues.

The latest-observation correction is structurally closed.

  • A succeeded / success transaction now requires the last ordered observation to be terminal success.
  • A deferred / blockedOrDeferred transaction now requires the last ordered observation to be nonterminal deferred or retrying.
  • The regression later_same_key_retry_invalidates_stale_high_success rejects a later serveOrReport retry after terminal success.
  • The regression later_same_key_success_invalidates_stale_deferred_outcome rejects a deferred output after later same-key transfer success.
  • Normalized UTC ordering and phase ordering constrain the observation order used by these checks.

I rechecked the full contract boundary.

  • Transaction evidence binds exact package, content, version, site, DP handle, and extraction profile fields.
  • Transaction evidence cannot cite client artifacts.
  • All server normalized logical records require transaction consumption.
  • Client normalized evidence is consumed only by a noncorrelatable source-local observation.
  • Coverage gaps remain exact, DP-bound, fragment-aware, and linked to bounded server artifact requests.
  • Rotation splits require one physical log family and incomplete fragments.
  • Physical paths, fingerprints, rotation lineages, and observation IDs remain bounded synthetic identifiers.
  • The contract rejects identity-bearing raw bytes and public client/DP causal claims.
  • Output ordering and evidence single-use checks remain present.

The schema-aligned audit covered all ten scenarios. The only intermediate audit note was expected: client-only-looking-request has a client normalized record that belongs to source-local evidence, not a transaction. The corrected evidence distinction is consistent with the contract. The raw-boundary scan found no prohibited identity, secret, or local-path markers. git diff --check found no whitespace errors.

I could not execute Rust tests, Clippy, WASM, TypeScript, or formatting commands in this sandbox.

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

@adamgell

Copy link
Copy Markdown
Owner Author

CodeRabbit exact-head gate passed

Hosted CodeRabbit completed a substantive static review of exact 4f8bd3b6e89ab208932446756ed6a29596f8da4c and found no new actionable issues: #374 (comment).

It specifically verified both latest-observation guards, the two permanent regressions, exact key/evidence binding, normalized-record consumption, coverage and bounded requests, rotation, privacy, deterministic ordering, and the ten-scenario corpus. The local executable gates remain 43/43 focused and 772/772 parser-wide.

PR stays draft/open. The remaining gate is a different independent exact-head PASS. #333 remains blocked.

@adamgell

Copy link
Copy Markdown
Owner Author

Independent exact-head review is active for draft PR #374 at 4f8bd3b against a8a367c in fresh detached worktree .worktrees/review-329-4f8b-exact. This is review/probe-only: no implementation edits, commits, or pushes. Scope covers latest same-key outcome semantics in both directions, terminal evidence, exact keys/profile/topology, coverage non-outcomes, deterministic evidence and observation identities, privacy/bounds, synthetic-only provenance, parser purity/wasm, and #333 counterpart readiness without time-only causation. Focused 43 tests plus aggregate/static/adversarial probes and a formal exact-head PASS or BLOCK will follow.

@adamgell adamgell left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent exact-head review — BLOCKED

Reviewed exact 4f8bd3b against a8a367c in a fresh clean detached worktree. GitHub does not permit the authenticated repository owner to request changes on the owner PR, so this COMMENTED review records the same semantic BLOCK disposition.

One disposable executable probe remains RED. Starting from healthy-package, it appends a physically later same-key serveOrReport/retrying/nonterminal line after the terminal success but gives it the exact same normalized UTC. By assigning the safe ID 05-report-retry, inserting it before 06-report, and citing every normalized record, the validator returns Ok while retaining succeeded/success/high. The order check accepts equal UTC, and latest_outcome therefore follows caller-controlled observation-ID order instead of immutable evidence provenance. This violates the documented timestamp-order contract and lets stale high success survive a later physical retry.

Fresh exact-head gates are otherwise green: focused #329 43/43; server intake 1/1; spine 136/136; full parser pass; strict all-target Clippy; Rust 1.88.0 wasm32; frontend TypeScript/Vite build; 20/20 JSON files; 22/22 synthetic logs with the privacy-marker scan clean; scoped rustfmt; feature-range diff check; detached status clean. Repository-wide cargo fmt check reports 17 inherited files with zero #329 range overlap.

Hosted CodeRabbit posted a substantive exact-head CLEAN at #374 (comment), but its static analysis did not exercise this equal-time physical-order mutation. Keep PR #374 draft/open. Add a permanent red-to-green regression and a fail-closed immutable tie-order rule, rerun all gates, obtain fresh final-head CodeRabbit, then request a different independent review. #333 content-to-DP remains blocked; this review claims no production reducer, native collection, merge readiness, or live Windows acceptance.

@adamgell

Copy link
Copy Markdown
Owner Author

Correction claim — equal-UTC ordering P1

I am implementing the isolated TDD correction from exact 4f8bd3b on codex/sccm-329-4f8-equal-utc-fix. Owned file is the #329 distribution-point fixture contract only; fixtures will be temporary unless a permanent synthetic scenario addition is required.

Order: commit permanent failing same-artifact retry/recovery and cross-artifact ambiguity regressions; implement the smallest immutable provenance ordering or fail-closed ambiguity rule; run focused plus aggregate Rust/Clippy/wasm/frontend/static gates; guard remote exact head; push non-force; reply and resolve the P1; request fresh substantive CodeRabbit. This does not authorize production reducer/correlation/native code or #333 advancement.

@adamgell

Copy link
Copy Markdown
Owner Author

Equal-UTC ordering correction pushed — exact b45c4b6

The P1 executable blocker is corrected with an issue-scoped red/green pair:

  • RED 2e54a20fd87b9f8f51c6ecfba8bb0ad756804331 — four permanent regressions reproduce caller-controlled equal-time ordering for later retry, later recovery, cross-artifact ambiguity, and cross-rotation ambiguity.
  • GREEN b45c4b6 — equal normalized UTC is usable only when immutable evidence stays within one artifact and cited line ranges advance. Different-artifact/rotation ties fail closed. A positive test preserves valid forward same-artifact ties.

The remote branch and PR head were guarded at exact 4f8bd3b before a non-force push. The P1 thread was replied to and resolved: #374 (comment).

Fresh verification at exact b45c4b6:

Local CodeRabbit CLI 0.7.1 was authenticated but rate-limited for three minutes and is not counted as approval. A fresh substantive hosted exact-head review is being requested separately. Keep this PR draft/open; no production reducer, native collection, correlation, merge readiness, or live Windows validation is claimed. #333 content-to-DP remains blocked pending fresh CodeRabbit and a different independent exact-head PASS.

@adamgell

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Please perform a fresh substantive exact-head review of b45c4b6. Review the correction range 4f8bd3b..b45c4b6 in the context of the full #329 range from a8a367c.

Focus on the permanent RED/GREEN contract: equal normalized UTC must use immutable same-artifact forward line provenance; caller-controlled observation IDs must not choose the latest outcome; cross-artifact and current/rollback ties must fail closed; later retry cannot retain stale high success; later recovery cannot retain stale high failure; and valid same-artifact forward ties remain usable. Recheck exact package/content/version/site/DP/profile binding, terminal proof, coverage non-outcomes, deterministic identity/order, privacy/synthetic-only boundaries, parser purity/wasm compatibility, and #333 handoff without time-only causal claims.

Please report actionable issues against this exact SHA. A skipped, status-only, or prior-head review is not approval.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='a8a367c661cd17bd1e73b87724c143ec8565ffc7'
previous='4f8bd3b6e89ab208932446756ed6a29596f8da4c'
head='b45c4b610d001f6f0540d722212643cdc66b0a4e'
contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'
root='crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point'
doc='docs/sccm/preparation/issue-329-distribution-point-corpus.md'

for commit in "$base" "$previous" "$head"; do
  git cat-file -e "${commit}^{commit}"
done

echo '=== exact commits ==='
git show -s --format='base=%H%nsubject=%s' "$base"
git show -s --format='previous=%H%nparents=%P%nsubject=%s' "$previous"
git show -s --format='head=%H%nparents=%P%nsubject=%s' "$head"

echo '=== ancestry ==='
git merge-base --is-ancestor "$base" "$head" && echo 'base is an ancestor of head'
git merge-base --is-ancestor "$previous" "$head" && echo 'previous head is an ancestor of head'

echo '=== correction range ==='
git diff --name-status "$previous" "$head"
git diff --stat "$previous" "$head"
git diff --no-ext-diff --unified=70 "$previous" "$head" -- "$contract"

echo '=== full feature range ==='
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
echo '=== full-range paths outside declared scope ==='
git diff --name-only "$base" "$head" |
  awk -v contract="$contract" -v root="$root" -v doc="$doc" '
    $0 == contract || $0 == doc || index($0, root "/") == 1 { next }
    { print }
  '

echo '=== contract outline ==='
ast-grep outline "$contract" --items all

echo '=== ordering and contract control locations ==='
rg -n -C 10 --type rust \
  'equal|timestamp|collectedUtc|ordered|order|latest|newest|observationId|evidence_for|physical_evidence_for|startLine|endLine|terminal|ServeOrReport|retrying|blockedOrDeferred|coverageGapArtifactIds|artifactRequests|nextSourceId|rotationSplit|distributionPointHandle|extractionProfileId|rolesObserved|distributionPointObserved|ClientHandle|RequestId|identity|synthetic|mutation' \
  "$contract"

echo '=== targeted validation sections ==='
cat -n "$contract" | sed -n '850,2300p'
echo '=== targeted regression sections ==='
cat -n "$contract" | sed -n '3000,3800p'

echo '=== source normalizer references ==='
rg -n -C 4 --type rust '\bnormalize_ccm_artifact\s*\(' crates/cmtraceopen-parser

Length of output: 135586


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='a8a367c661cd17bd1e73b87724c143ec8565ffc7'
previous='4f8bd3b6e89ab208932446756ed6a29596f8da4c'
head='b45c4b610d001f6f0540d722212643cdc66b0a4e'
contract='crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs'
root='crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point'

echo '=== concise correction diff ==='
git diff --no-ext-diff --unified=35 "$previous" "$head" -- "$contract"

echo '=== helper definitions and evidence-reference validation ==='
rg -n -C 8 --type rust \
  '^fn (required_bool|required_array|required_string|required_nonempty_string|evidence_reference_key|artifact_has_incomplete_coverage|artifact_applies_to_distribution_point|coverage_request_reason|phase_allowed_for_artifact|raw_fixture_bytes_are_sanitized)' \
  "$contract"
cat -n "$contract" | sed -n '1,180p'
cat -n "$contract" | sed -n '360,850p'
cat -n "$contract" | sed -n '1450,1725p'

echo '=== observation evidence cardinality in committed fixtures ==='
python3 - <<'PY'
import json
from pathlib import Path
root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
for directory in sorted(path for path in root.iterdir() if path.is_dir()):
    expected = json.loads((directory / "expected.json").read_text())
    for transaction in expected["transactions"]:
        for observation in transaction["observations"]:
            refs = observation["evidence"]
            if len(refs) != 1:
                print(directory.name, transaction["transactionId"], observation["observationId"], len(refs))
PY

echo '=== schema-aligned fixture audit ==='
python3 - <<'PY'
import json, re
from collections import defaultdict
from datetime import datetime
from pathlib import Path

root = Path("crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point")
ccm = re.compile(r'<!\[LOG\[(.*?)\]LOG\]!>')
timestamp = re.compile(r'<time="([^"]+)" date="([^"]+)"')
problems = []
synthetic_marker = "SYNTHETIC FIXTURE"

def fields_for(line):
    match = ccm.search(line)
    if not match:
        return None
    parts = [part.strip() for part in match.group(1).split(";")]
    if not parts or parts[0] != synthetic_marker:
        return None
    try:
        return dict(part.split("=", 1) for part in parts[1:])
    except ValueError:
        return None

def utc_for(line):
    match = timestamp.search(line)
    if not match or not match.group(1).endswith("+000"):
        return None
    return datetime.strptime(
        f"{match.group(2)}T{match.group(1)[:-4]}", "%m-%d-%YT%H:%M:%S.%f"
    )

def incomplete(artifact):
    return artifact["captureState"] != "captured" or artifact["rotation"].get("fragmentComplete") is False

def reason(artifact):
    return {
        "absent": "coverageAbsent",
        "accessDenied": "coverageAccessDenied",
        "capped": "coverageCapped",
        "parseFailed": "coverageMalformed",
    }.get(artifact["captureState"]) or (
        "coverageRotationSplit"
        if artifact["captureState"] in {"captured", "capped"}
        and artifact["rotation"].get("fragmentComplete") is False
        else None
    )

for directory in sorted(path for path in root.iterdir() if path.is_dir()):
    manifest = json.loads((directory / "manifest.json").read_text())
    expected = json.loads((directory / "expected.json").read_text())
    artifacts = {item["artifactId"]: item for item in manifest["artifacts"]}
    capture = datetime.strptime(manifest["bundle"]["capturedUtc"], "%Y-%m-%dT%H:%M:%SZ")
    used, normalized, seen_ids = set(), set(), set()

    for aid, artifact in artifacts.items():
        if artifact["captureState"] not in {"captured", "capped", "parseFailed"}:
            continue
        path = directory / artifact["relativePath"]
        raw = path.read_text()
        if "SYNTHETIC FIXTURE" not in raw:
            problems.append(f"{directory.name}/{aid}: missing synthetic marker")
        for line_no, line in enumerate(raw.splitlines(), 1):
            parsed = fields_for(line)
            if parsed and artifact["captureState"] in {"captured", "capped"} and artifact["rotation"].get("fragmentComplete") is True:
                normalized.add((aid, line_no, line_no))

    for txn in expected["transactions"]:
        key = txn["key"]
        last_utc = None
        last_ref = None
        for obs in txn["observations"]:
            oid = obs["observationId"]
            if oid in seen_ids:
                problems.append(f"{directory.name}: duplicate observation ID {oid}")
            seen_ids.add(oid)
            for ref in obs["evidence"]:
                marker = (ref["artifactId"], ref["startLine"], ref["endLine"])
                if marker in used:
                    problems.append(f"{directory.name}: reused evidence {marker}")
                used.add(marker)
                artifact = artifacts.get(ref["artifactId"])
                if not artifact:
                    problems.append(f"{directory.name}/{oid}: unknown artifact")
                    continue
                try:
                    line = (directory / artifact["relativePath"]).read_text().splitlines()[ref["startLine"] - 1]
                except (KeyError, IndexError):
                    problems.append(f"{directory.name}/{oid}: unreadable cited line")
                    continue
                fields = fields_for(line)
                current = utc_for(line)
                if fields is None or current is None:
                    problems.append(f"{directory.name}/{oid}: invalid cited CCM line")
                    continue
                required = {
                    "PackageId": key["packageId"], "ContentId": key["contentId"],
                    "ContentVersion": str(key["contentVersion"]), "SiteCode": key["siteCode"],
                    "DpHandle": key["distributionPointHandle"], "ProfileId": key["extractionProfileId"],
                    "Phase": obs["phase"], "Disposition": obs["disposition"],
                    "Terminal": str(obs["terminal"]).lower(),
                }
                if any(fields.get(name) != value for name, value in required.items()):
                    problems.append(f"{directory.name}/{oid}: exact key or outcome mismatch")
                if current > capture:
                    problems.append(f"{directory.name}/{oid}: evidence after capture")
                if last_utc is not None and current < last_utc:
                    problems.append(f"{directory.name}/{txn['transactionId']}: timestamp regresses")
                if last_utc == current and (
                    ref["artifactId"] != last_ref[0] or ref["startLine"] <= last_ref[2]
                ):
                    problems.append(f"{directory.name}/{txn['transactionId']}: equal UTC lacks forward same-artifact provenance")
                last_utc, last_ref = current, marker

    for obs in expected["sourceLocalObservations"]:
        oid = obs["observationId"]
        if oid in seen_ids:
            problems.append(f"{directory.name}: duplicate source-local ID {oid}")
        seen_ids.add(oid)
        cited = set()
        for ref in obs["evidence"]:
            marker = (ref["artifactId"], ref["startLine"], ref["endLine"])
            if marker in used:
                problems.append(f"{directory.name}: reused source-local evidence {marker}")
            used.add(marker)
            cited.add(ref["artifactId"])
        if cited != set(obs["artifactIds"]):
            problems.append(f"{directory.name}/{oid}: source-local artifact closure mismatch")

    if normalized != {ref for ref in used if ref in normalized}:
        problems.append(f"{directory.name}: normalized records are not consumed exactly")

    expected_requests = sorted({
        (artifact["sourceId"], reason(artifact))
        for artifact in artifacts.values()
        if artifact["producerRole"] != "client" and reason(artifact) is not None
    })
    actual_requests = [(item["sourceId"], item["reasonCode"]) for item in expected["artifactRequests"]]
    if actual_requests != expected_requests:
        problems.append(f"{directory.name}: artifact request projection mismatch")

    for txn in expected["transactions"]:
        dp = txn["key"]["distributionPointHandle"]
        expected_gaps = sorted(
            aid for aid, artifact in artifacts.items()
            if artifact["sourceId"] == "server-dp-distribution"
            and incomplete(artifact)
            and (
                artifact.get("workflowSubjectHandle") == dp
                or (
                    artifact.get("workflowSubjectHandle") is None
                    and artifact.get("workflowSubjectBasis") == "manifestTopology"
                    and artifact["producerRole"] == "siteServer"
                )
            )
        )
        if txn["coverageGapArtifactIds"] != expected_gaps:
            problems.append(f"{directory.name}/{txn['transactionId']}: DP-bound gap mismatch")
    if expected["clientCausalClaims"] != []:
        problems.append(f"{directory.name}: client causal claims exist")

print(f"scenarios={len([p for p in root.iterdir() if p.is_dir()])}")
print(f"problems={len(problems)}")
print("\n".join(problems) if problems else "none")
PY

echo '=== raw synthetic-fixture boundary scan ==='
if rg -n -i \
  -e 'realuser|realrequest|real\.user@example\.com|secret=|C:\\Users|/home/|@[^ ]+' \
  "$root" -g '*.log' -g '*.json' -g '*.md'
then
  exit 1
else
  echo 'no prohibited identity, secret, local-path, or email marker found'
fi

echo '=== exact-head diff whitespace check ==='
git diff --check "$base" "$head"

Length of output: 80840


@adamgell I completed a substantive static review of exact head b45c4b610d001f6f0540d722212643cdc66b0a4e.

I found no new actionable issues.

The equal-UTC correction is structurally closed.

  • The validator uses normalized UTC as the primary ordering value.
  • When normalized UTC values are equal, the validator requires the next record to use the same artifact and a strictly later physical line range.
  • A different artifact at equal UTC fails validation.
  • A current/rollback tie uses different artifacts. It fails validation.
  • A lower or overlapping line range in the same artifact fails validation.
  • Observation IDs must be sorted for deterministic output. They do not resolve chronology or select the latest outcome.

The permanent regressions cover the requested cases.

  • A later same-artifact retry at equal UTC cannot retain stale high success.
  • A later same-artifact recovery at equal UTC cannot retain stale high confirmed failure.
  • A valid forward line order in the same artifact remains valid.
  • Equal-UTC outcomes across artifacts fail closed.
  • Equal-UTC outcomes across current and rollback rotations fail closed.

I also rechecked the full fixture-contract boundary.

  • Transaction citations bind the exact package, content ID, content version, site, DP handle, and extraction profile.
  • Terminal success requires the cited serveOrReport record.
  • Latest outcome checks prevent stale success and stale deferred output.
  • Coverage gaps remain exact, DP-bound, and fragment-aware.
  • Artifact requests remain bounded and exclude client-role artifacts.
  • Transaction and source-local evidence remain single-use and closed to physical evidence.
  • Normalized logical records require transaction or source-local consumption.
  • Fixture paths, fingerprints, rotation lineages, and observation IDs remain bounded synthetic values.
  • The raw fixture scan found no identity, secret, local-path, or email markers.
  • clientCausalClaims remains empty. The #333 handoff remains unperformed and not time-only eligible.

The schema-aligned audit covered all 10 scenarios. It reported zero problems. git diff --check reported no whitespace errors.

I could not run Rust tests, Clippy, WASM, TypeScript, or formatting commands in this sandbox.

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

@adamgell

Copy link
Copy Markdown
Owner Author

Hosted CodeRabbit exact-head gate — CLEAN

CodeRabbit completed a substantive static review of exact b45c4b6 and found no new actionable issues: #374 (comment).

It checked the full a8a367c..b45c4b6 feature range and the 4f8bd3b..b45c4b6 correction range, including all five equal-UTC provenance cases, latest-outcome behavior, exact keys/profile/topology, terminal proof, coverage/request boundaries, synthetic/privacy constraints, and the noncausal #333 handoff. CodeRabbit could not execute Rust/wasm/frontend commands; the separately reported local gate supplies those passing results.

This satisfies the hosted-review request, not final readiness. Keep the PR draft/open and #333 blocked until a different independent reviewer posts an exact-head PASS or BLOCK.

@adamgell

Copy link
Copy Markdown
Owner Author

Independent no-edit exact-head review active for b45c4b610d001f6f0540d722212643cdc66b0a4e in fresh detached worktree .worktrees/review-329-b45c-exact-r2.

I verified PR #374 is OPEN/draft and still points to this exact SHA. Review owns no implementation files and will not edit, commit, or push. Scope: full #329 DP/content contract plus the equal-UTC provenance correction; exact keys, identity collisions, rotation splits, topology/version/timestamp provenance, terminal evidence, coverage conservatism, privacy, deterministic serialization/reordering, pure Rust/wasm boundaries, focused/aggregate gates, and hosted CodeRabbit state. A formal exact-SHA PASS or BLOCK will follow.

@adamgell adamgell left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INDEPENDENT EXACT-HEAD REVIEW: PASS

Reviewed fresh detached head b45c4b610d001f6f0540d722212643cdc66b0a4e against base a8a367c661cd17bd1e73b87724c143ec8565ffc7; local, fetched remote, and PR head all matched immediately before this result. No edits or pushes were made.

Findings: none actionable.

Substantive checks:

  • full #329 DP/content source contract, role/topology provenance, coverage ceilings, deterministic expected output, and synthetic fixture safety;
  • corrected equal-UTC logic: a later physical line range is accepted only within the same artifact, while cross-artifact and cross-rotation ties fail closed;
  • absent, incomplete, capped, malformed, client-only-looking, content-version mismatch, rotation-boundary, transfer-retry, validation-failure, distribution-failure, healthy, and serve-observed cases;
  • no time-only or cross-side causal correlation is implemented or claimed.

Reproduced verification: focused #329 48/48; server intake 1/1; spine 136/136; parser aggregate 777/777; strict Clippy; Rust 1.88 wasm32; TypeScript; production build; 20/20 JSON; 22 synthetic logs; scoped rustfmt; git diff --check; sanitized fixture/preparation privacy scan. The production build emitted only the inherited ineffective dynamic-import warning. Global workspace fmt remains inherited outside this issue. Hosted CodeRabbit substantive exact-head review is also clean: #374 (comment)

Residual gates: this remains a preparation/source-contract PR. Production reducer work waits on stable #318/#335 interfaces; #333 correlation remains gated on stable source facts. Native Windows/lab acceptance has not been exercised and is not claimed. Keep the PR draft/open until those dependency and owner merge gates are intentionally handled.

@adamgell
adamgell marked this pull request as ready for review July 31, 2026 20:40
Copilot AI review requested due to automatic review settings July 31, 2026 20:40
@adamgell
adamgell merged commit f995f20 into codex/parser-family-skeleton Jul 31, 2026
1 check passed

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 adds a synthetic SCCM Server Distribution Point (DP) fixture corpus and a focused Rust fixture-contract test to validate provenance, topology, keying, coverage states, deterministic ordering, and conservative outcome rules for Issue #329 preparation (without adding any production reducer or collector logic).

Changes:

  • Added a 10-scenario synthetic DP/content evidence corpus (manifests, expected labels, and synthetic CCM log evidence).
  • Added a Rust fixture-contract test that normalizes evidence through the existing CCM logical-record envelope and fail-closes on adversarial mutations.
  • Added preparation documentation describing the intended contract boundaries and semantics.

Reviewed changes

Copilot reviewed 22 out of 45 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/sccm/preparation/issue-329-distribution-point-corpus.md Documents the intended DP corpus contract, boundaries, and semantics for #329 preparation.
crates/cmtraceopen-parser/tests/sccm_server_distribution_point_fixture_contract.rs Fixture-contract test validating DP corpus inputs/outputs, provenance, and fail-closed mutations.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/README.md Describes the DP synthetic fixture corpus and its interpretation.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/absent-dp/expected.json Expected output label for the absent-dp scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/absent-dp/manifest.json Manifest describing declared artifacts/topology for the absent-dp scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/client-only-looking-request/expected.json Expected output label for the client-only-looking-request scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/client-only-looking-request/manifest.json Manifest describing declared artifacts/topology for the client-only-looking-request scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/client-only-looking-request/evidence/client-content-control/current/DataTransferService.log Synthetic client control evidence used to ensure client-only lookalikes are ignored server-side.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/expected.json Expected output label for the content-version-mismatch multi-DP/multi-version scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/manifest.json Manifest describing multi-DP topology and artifact provenance for content-version-mismatch.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/evidence/server-dp-distribution/dp-02/current/SMSDPProv.log Synthetic DP02 provider evidence for content-version-mismatch.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/evidence/server-dp-distribution/dp/current/SMSDPProv.log Synthetic DP01 provider evidence for content-version-mismatch.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/evidence/server-dp-distribution/site/current/PkgXferMgr.log Synthetic site transfer evidence for content-version-mismatch.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/content-version-mismatch/evidence/server-dp-distribution/site/current/distmgr.log Synthetic site receive/distribute evidence for content-version-mismatch.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/distribution-failure/expected.json Expected output label for the distribution-failure scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/distribution-failure/manifest.json Manifest describing declared artifacts/topology for the distribution-failure scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/distribution-failure/evidence/server-dp-distribution/site/current/distmgr.log Synthetic site evidence for the distribution-failure scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/healthy-package/expected.json Expected output label for the healthy-package scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/healthy-package/manifest.json Manifest describing declared artifacts/topology for the healthy-package scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/healthy-package/evidence/server-dp-distribution/dp/current/SMSDPProv.log Synthetic DP provider evidence for the healthy-package scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/healthy-package/evidence/server-dp-distribution/site/current/PkgXferMgr.log Synthetic site transfer evidence for the healthy-package scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/healthy-package/evidence/server-dp-distribution/site/current/distmgr.log Synthetic site receive/distribute evidence for the healthy-package scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/incomplete/expected.json Expected output label for the incomplete scenario (coverage-gap driven).
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/incomplete/manifest.json Manifest describing incomplete coverage states for the incomplete scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/incomplete/evidence/server-dp-distribution/site/current/distmgr.log Synthetic site evidence for the incomplete scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/rotation-boundary/expected.json Expected output label for the rotation-boundary scenario (fragments/malformed).
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/rotation-boundary/manifest.json Manifest describing rotation fragment/malformed capture states for rotation-boundary.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/rotation-boundary/evidence/server-dp-distribution/dp/malformed/SMSDPProv.log Synthetic malformed DP provider evidence for rotation-boundary.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/rotation-boundary/evidence/server-dp-distribution/site/current/distmgr.log Synthetic current fragment evidence for rotation-boundary.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/rotation-boundary/evidence/server-dp-distribution/site/lo_/distmgr.log Synthetic .lo_ fragment evidence for rotation-boundary.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/expected.json Expected output label for the serve-observed scenario (supplemental serve evidence).
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/manifest.json Manifest describing supplemental bounded serving source for serve-observed.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/evidence/server-dp-distribution/dp/current/SMSDPProv.log Synthetic DP provider evidence for serve-observed.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/evidence/server-dp-distribution/site/current/PkgXferMgr.log Synthetic site transfer evidence for serve-observed.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/evidence/server-dp-distribution/site/current/distmgr.log Synthetic site receive/distribute evidence for serve-observed.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/serve-observed/evidence/server-dp-serve/dp/current/SMSdpmon.log Synthetic bounded DP serving/status evidence for serve-observed.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/transfer-retry/expected.json Expected output label for the transfer-retry scenario (deferred/retrying).
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/transfer-retry/manifest.json Manifest describing declared artifacts/topology for the transfer-retry scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/transfer-retry/evidence/server-dp-distribution/site/current/PkgXferMgr.log Synthetic transfer evidence for the transfer-retry scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/transfer-retry/evidence/server-dp-distribution/site/current/distmgr.log Synthetic receive/distribute evidence for the transfer-retry scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/validation-failure/expected.json Expected output label for the validation-failure scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/validation-failure/manifest.json Manifest describing declared artifacts/topology for the validation-failure scenario.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/validation-failure/evidence/server-dp-distribution/dp/current/SMSDPProv.log Synthetic provider validation-failure evidence for validation-failure.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/validation-failure/evidence/server-dp-distribution/site/current/PkgXferMgr.log Synthetic transfer evidence for validation-failure.
crates/cmtraceopen-parser/tests/fixtures/sccm/server/distribution_point/validation-failure/evidence/server-dp-distribution/site/current/distmgr.log Synthetic receive/distribute evidence for validation-failure.

Comment on lines +11 to +12
- `manifest.json` records physical producer, workflow subject, coverage,
rotation, bounded path, encoding, and exact byte-count provenance.
Comment on lines +55 to +58
- rotation kind, nonempty typed lineage, and typed fragment completeness for
physical captures;
- capture state, collection timestamp, encoding, byte policy, exact copied
byte count, and bounded relative evidence path; and
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