Skip to content

fix(intune): narrow rotation failure detection - #509

Merged
adamgell merged 1 commit into
mainfrom
codex/issue-506-narrow-rotation-detection
Aug 5, 2026
Merged

adamgell merged 1 commit into
mainfrom
codex/issue-506-narrow-rotation-detection

Conversation

@adamgell

@adamgell adamgell commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Closes #506

Summary

  • stop treating generic Failed … and Unhandled … ISO headers as Device Inventory rotation failures
  • require a trailing token boundary or end after failed to rotate, rotation failed, and failed to roll
  • preserve registered phrase matching across case, punctuation, trailing whitespace, and phrase-at-end inputs
  • preserve ISO-header plus .NET exception evidence
  • cover direct detection, dispatcher routing, both relevant filename shapes, and severity semantics

Critic regressions

  • Failed to rollback transaction.
  • Rotation failedover to backup.
  • Failed to rotateCredentials.

All three remain generic timestamped content and informational under forced rotation parsing for both unrelated.log and IntuneDeviceInventory.log.

Validation

  • cargo test -p cmtraceopen-parser --test intune_device_inventory (24 passed)
  • cargo test -p cmtraceopen-parser
  • cargo clippy -p cmtraceopen-parser --all-targets -- -D warnings
  • scoped rustfmt --check
  • npx tsc --noEmit
  • git diff --check

Out of scope

Summary by CodeRabbit

  • Bug Fixes

    • Improved rotation-failure detection to recognize only explicit rotation-related messages.
    • Prevented generic failure messages from being incorrectly classified as device inventory rotation failures.
    • Preserved detection for registered rotation phrases and relevant exception messages.
    • Improved parser selection and error severity handling for rotation-related entries.
  • Documentation

    • Added implementation planning and library references for the updated detection behavior.
  • Tests

    • Added regression coverage for rotation detection, parser selection, and severity handling.

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request intune Microsoft Intune related parser Log parser related labels Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Rotation detection narrowing

Layer / File(s) Summary
Detection behavior and regression coverage
crates/cmtraceopen-parser/src/intune/device/windows/inventory/mod.rs, crates/cmtraceopen-parser/tests/intune_device_inventory.rs, docs/superpowers/plans/..., library.md
Generic failed and unhandled prefixes no longer classify records as rotation failures. Explicit rotation phrases and .NET exception evidence remain supported. Tests verify parser selection, specialization, severity, and record preservation. The implementation plan and library index were added.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: test, device

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes remove generic prefix detection, preserve registered phrases and exception evidence, and add direct-detection, routing, and severity coverage for issue #506.
Out of Scope Changes check ✅ Passed The code, regression tests, implementation plan, and library entry all support issue #506 and its stated implementation scope.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and accurately describes the Intune rotation-failure detection change.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-506-narrow-rotation-detection

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

@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: 4

🤖 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/intune_device_inventory.rs`:
- Around line 191-205: Update the fixture used by the exception-only test around
detect_dialect and parse_with_dispatcher so its ISO-header message is neutral
and contains no rotation wording such as “roll.” Preserve the .NET exception
continuation as the sole rotation signal, while keeping the existing dialect,
parser selection, specialization, and severity assertions unchanged.

In `@docs/superpowers/plans/2026-08-05-issue-506-rotation-detection-narrowing.md`:
- Line 19: Update the checklist line containing the `Failed ` and `Unhandled `
inline code spans so the trailing spaces are moved outside the backticks,
preserving the documented prefixes and meaning.
- Line 13: Update the “Task 1” and “Task 2” Markdown headings in the document
from level-three headings to level-two headings, preserving their existing
titles and content so heading levels follow the initial H1 sequentially.
- Around line 16-17: Update the plan’s references for
crates/cmtraceopen-parser/tests/intune_device_inventory.rs to list the final
ranges 125-161, 191-205, 243-262, and 500-522, replacing the outdated ranges.
Verify the documentation path and referenced test locations against the
repository before finalizing.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dc8e6881-2fc7-4d1d-8618-c64f8aae0f12

📥 Commits

Reviewing files that changed from the base of the PR and between 7acd264 and 0d42386.

📒 Files selected for processing (4)
  • crates/cmtraceopen-parser/src/intune/device/windows/inventory/mod.rs
  • crates/cmtraceopen-parser/tests/intune_device_inventory.rs
  • docs/superpowers/plans/2026-08-05-issue-506-rotation-detection-narrowing.md
  • library.md
💤 Files with no reviewable changes (1)
  • crates/cmtraceopen-parser/src/intune/device/windows/inventory/mod.rs

Comment on lines +191 to +205
for path in ["unrelated.log", "IntuneDeviceInventory.log"] {
assert_eq!(
detect_dialect(path, other_wording),
Some(DeviceInventoryLogDialect::RotationFailure)
);

let (result, selection) =
parse_with_dispatcher(other_wording, path, other_wording.len() as u64);
assert_eq!(selection.parser, ParserKind::IntuneDeviceInventory);
assert_eq!(
selection.specialization,
Some(ParserSpecialization::IntuneDeviceInventoryRotationFailure)
);
assert_eq!(result.entries[0].severity, Severity::Error);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the exception-only fixture independent of rotation wording.

The header used by this test contains Could not roll the inventory log over. A broad roll matcher could satisfy the test without exercising the .NET exception continuation. Use a neutral ISO-header message. Keep the exception continuation as the only rotation signal.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/cmtraceopen-parser/tests/intune_device_inventory.rs` around lines 191
- 205, Update the fixture used by the exception-only test around detect_dialect
and parse_with_dispatcher so its ISO-header message is neutral and contains no
rotation wording such as “roll.” Preserve the .NET exception continuation as the
sole rotation signal, while keeping the existing dialect, parser selection,
specialization, and severity assertions unchanged.


---

### Task 1: Pin the rotation-detection contract with failing tests

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use sequential Markdown heading levels.

The document starts with an H1. ### Task 1 and ### Task 2 skip the H2 level. Change both task headings to ##. This clears MD001.

Also applies to: 30-30

🧰 Tools
🪛 markdownlint-cli2 (0.23.2)

[warning] 13-13: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-08-05-issue-506-rotation-detection-narrowing.md`
at line 13, Update the “Task 1” and “Task 2” Markdown headings in the document
from level-three headings to level-two headings, preserving their existing
titles and content so heading levels follow the initial H1 sequentially.

Source: Linters/SAST tools

Comment on lines +16 to +17
- Modify: `crates/cmtraceopen-parser/tests/intune_device_inventory.rs:118-193`
- Modify: `crates/cmtraceopen-parser/tests/intune_device_inventory.rs:409-431`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the test ranges in the plan.

The plan lists 118-193 and 409-431. The final test file places the related changes at Line 125 through Line 161, Line 191 through Line 205, Line 243 through Line 262, and Line 500 through Line 522. Update the ranges so readers can locate all covered behaviors.

As per path instructions, verify documentation paths and references against the repository.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-08-05-issue-506-rotation-detection-narrowing.md`
around lines 16 - 17, Update the plan’s references for
crates/cmtraceopen-parser/tests/intune_device_inventory.rs to list the final
ranges 125-161, 191-205, 243-262, and 500-522, replacing the outdated ranges.
Verify the documentation path and referenced test locations against the
repository before finalizing.

Source: Path instructions

- Modify: `crates/cmtraceopen-parser/tests/intune_device_inventory.rs:118-193`
- Modify: `crates/cmtraceopen-parser/tests/intune_device_inventory.rs:409-431`

- [x] Add direct-detection cases proving ISO headers beginning with `Failed ` and `Unhandled ` return no Device Inventory dialect for both `unrelated.log` and `IntuneDeviceInventory.log`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove trailing spaces from inline code spans.

The Failed and Unhandled code spans contain trailing spaces. Move those spaces outside the backticks. This clears MD038 without changing the documented prefixes.

🧰 Tools
🪛 markdownlint-cli2 (0.23.2)

[warning] 19-19: Spaces inside code span elements

(MD038, no-space-in-code)


[warning] 19-19: Spaces inside code span elements

(MD038, no-space-in-code)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-08-05-issue-506-rotation-detection-narrowing.md`
at line 19, Update the checklist line containing the `Failed ` and `Unhandled `
inline code spans so the trailing spaces are moved outside the backticks,
preserving the documented prefixes and meaning.

Source: Linters/SAST tools

@adamgell
adamgell force-pushed the codex/issue-506-narrow-rotation-detection branch from 0d42386 to 6aba74b Compare August 5, 2026 09:21
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@adamgell
adamgell merged commit 162f1c2 into main Aug 5, 2026
16 checks passed
@adamgell
adamgell deleted the codex/issue-506-narrow-rotation-detection branch September 25, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request intune Microsoft Intune related parser Log parser related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Narrow Device Inventory rotation-failure detection

1 participant