Repository navigation
Harden all supported log parsers and add format contracts - #310
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Human review recommended
It changes multiple production parsers and introduces broad new contract coverage, so a final human review is warranted despite the strong test suite.
Pull request overview
This PR strengthens the Rust-side parser layer by adding an integration “contract matrix” test suite that locks in deterministic behavior (selection, framing, structured fields, encoding boundaries, and malformed-input recovery) across all 20 ParserKind variants plus the IME specialization, and it applies targeted hardening fixes in parsers uncovered by those contracts.
Changes:
- Added exhaustive supported-format contracts + sanitized fixtures for previously uncovered formats (plus encoding boundary checks).
- Hardened parser behaviors: plain IDs across blank lines, PSADT/Secure Boot success severity mapping, Secure Boot invalid timestamp recovery, Registry malformation accounting, and deterministic DNS Audit EVTX record conversion (with synthetic tests).
- Documented design + execution plan for the hardening effort.
File summaries
| File | Description |
|---|---|
| src-tauri/tests/parser_supported_formats.rs | Adds the end-to-end parser contract matrix covering selection metadata, representative fields, encoding boundaries, and key regressions (plain IDs, PSADT/Secure Boot severity, invalid timestamps, UTF-16LE Registry boundary). |
| src-tauri/tests/dns_audit_real.rs | Renames the optional real-EVTX smoke test to make “skips when fixture missing” intent explicit. |
| src-tauri/tests/corpus/timestamped/clean/mixed.log | Adds deterministic timestamped fixture (ISO, slash-date, syslog-ish, and time-only). |
| src-tauri/tests/corpus/simple/clean/basic.log | Corrects the Simple fixture to the supported field order used by the parser. |
| src-tauri/tests/corpus/secureboot/clean/SecureBootCertificateUpdate.log | Adds minimal Secure Boot fixture used by the supported-format contract. |
| src-tauri/tests/corpus/registry/clean/basic.reg | Adds sanitized Registry export fixture for detection/selection coverage. |
| src-tauri/tests/corpus/psadt/clean/Deploy-Application.log | Adds PSADT Legacy fixture for contract coverage (including Success mapping). |
| src-tauri/tests/corpus/patchmypc_detection/clean/detection.log | Adds Patch My PC Detection fixture for contract coverage. |
| src-tauri/tests/corpus/intune_macos/clean/IntuneMDMDaemon.log | Adds Intune macOS fixture for contract coverage. |
| src-tauri/tests/corpus/iis_w3c/clean/u_ex260329.log | Adds IIS W3C fixture to validate #Fields mapping and key extracted fields. |
| src-tauri/tests/corpus/dhcp/clean/DhcpSrvLog-Mon.log | Adds DHCP fixture covering IPv4 + IPv6 cases. |
| src-tauri/tests/corpus/cmtlog/clean/basic.cmtlog | Adds CmtLog fixture validating entry kinds, Success severity, and WhatIf mapping. |
| src-tauri/tests/corpus/burn/clean/bundle.log | Adds Burn fixture for contract coverage. |
| src-tauri/src/parser/dns_audit.rs | Extracts serialized-record parsing into a helper to enable deterministic CI unit tests and maintain stable EVTX iteration semantics. |
| docs/superpowers/specs/2026-07-29-log-parser-hardening-design.md | Adds the design spec documenting goals, constraints, contract matrix approach, and per-format requirements. |
| docs/superpowers/plans/2026-07-29-log-parser-hardening.md | Adds the implementation plan describing tasks, constraints, and verification commands. |
| crates/cmtraceopen-parser/src/parser/secureboot_log.rs | Maps SUCCESS → Severity::Success and ensures invalid structured timestamps fall back to plain entries while incrementing parse_errors. |
| crates/cmtraceopen-parser/src/parser/registry.rs | Makes malformed registry values observable via parse_errors without fabricating valid-looking values; tightens hex/numeric/string validation. |
| crates/cmtraceopen-parser/src/parser/psadt.rs | Maps explicit PSADT Success severity to Severity::Success and updates the related unit test expectation. |
| crates/cmtraceopen-parser/src/parser/plain.rs | Ensures emitted plain entry IDs remain contiguous even when blank lines are skipped. |
Review details
- Files reviewed: 11/20 changed files
- Comments generated: 0
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
adamgell
marked this pull request as ready for review
July 30, 2026 02:42
adamgell
added a commit
that referenced
this pull request
Jul 31, 2026
Vendors the gh-copilot-review-loop skill from jorgeasaurus/agent-skills so PR feedback can be cycled through Copilot until a clean review lands. Changes from upstream: - Repoint the state script at .claude/skills/... instead of $CODEX_HOME, which does not exist under Claude Code. - Document the existing --repo/--pr flags and record provenance. - Skip agents/openai.yaml (Codex UI metadata) and the committed review_state.cpython-314.pyc bytecode. - Ignore __pycache__ so running the script leaves the tree clean. Verified with py_compile on Python 3.14.5 and a live run against PR #310, which returned the correct head SHA, Copilot review count, and thread state. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
adamgell
added a commit
that referenced
this pull request
Jul 31, 2026
* chore(skills): add gh-copilot-review-loop skill Vendors the gh-copilot-review-loop skill from jorgeasaurus/agent-skills so PR feedback can be cycled through Copilot until a clean review lands. Changes from upstream: - Repoint the state script at .claude/skills/... instead of $CODEX_HOME, which does not exist under Claude Code. - Document the existing --repo/--pr flags and record provenance. - Skip agents/openai.yaml (Codex UI metadata) and the committed review_state.cpython-314.pyc bytecode. - Ignore __pycache__ so running the script leaves the tree clean. Verified with py_compile on Python 3.14.5 and a live run against PR #310, which returned the correct head SHA, Copilot review count, and thread state. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * ci: auto-label new issues and PRs by title pattern Mirrors the manual labeling scheme applied to the SCCM/Intune/JAMF epics: matches title keywords and conventional-commit prefixes to apply topic labels (sccm, intune, jamf, portal, device, apps, enrollment, windows, security, macos) plus a change-type label (feature, test, build, bug) and enhancement as a baseline. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix: address Copilot review feedback on PR #383 - Drop unneeded pull-requests:write permission from the labeling workflow; addLabels only needs issues:write. - Pin actions/github-script to a commit SHA to match this repo's supply-chain convention (see cmtrace-ci.yml). - Split review_state.py's reviews/threads pagination into independent loops so an exhausted cursor no longer resets the other connection back to page 1. - Exclude outdated threads from unresolved_thread_count so the script only reports the threads the loop workflow treats as actionable. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This was referenced Jul 31, 2026
adamgell
added a commit
that referenced
this pull request
Aug 2, 2026
…e restoration (#384) * chore(skills): add gh-copilot-review-loop skill Vendors the gh-copilot-review-loop skill from jorgeasaurus/agent-skills so PR feedback can be cycled through Copilot until a clean review lands. Changes from upstream: - Repoint the state script at .claude/skills/... instead of $CODEX_HOME, which does not exist under Claude Code. - Document the existing --repo/--pr flags and record provenance. - Skip agents/openai.yaml (Codex UI metadata) and the committed review_state.cpython-314.pyc bytecode. - Ignore __pycache__ so running the script leaves the tree clean. Verified with py_compile on Python 3.14.5 and a live run against PR #310, which returned the correct head SHA, Copilot review count, and thread state. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * chore(skills): add the batch-issue-prs workflow skill Captures the repeated request shape "work a batch of issues with /code-review, /coderabbit:autofix and /loop" so a fresh session starts with the scoping rules and the traps already known. The content is derived from failures actually hit while working #366, #367, and #376 in one session, not from hypotheses: - a subagent told to `git checkout -b` ran it in the shared worktree and would have switched the branch out from under uncommitted work; every code-writing agent now requires isolation: "worktree"; - `rustfmt src-tauri/src/lib.rs` followed its `mod` declarations and reformatted twelve unrelated files; - `cargo fmt --check` was treated as a CI gate on the strength of an issue's verification block; it is not one, and the tree has pre-existing drift, so satisfying it repo-wide means churning files the PR should not touch; - a helper was called by the name it plausibly should have had rather than the one it has, costing a compile cycle; - a stalled synthesis agent nearly became a blocker when its completed sub-results were already readable in journal.jsonl. Each of those is a red flag entry or a rationalization-table row rather than prose, because they are discipline failures: the rule was knowable and got skipped under time pressure. The description states triggering conditions only and deliberately omits any summary of the workflow, so the skill body is read rather than shortcut. (cherry picked from commit 9a8818ae8284a9d76b61f4e42fb1321ae68c1632) * feat(elevation): add the generic relaunch model and restore ticket Groundwork for application-wide restart as administrator (#376). The ESP banner currently owns the only ShellExecute/runas implementation, and it always routes to esp-diagnostics while discarding every source path, so no other workspace can use it. This adds the ownerless half of the mechanism: - `elevation::mod` defines the validated request contract: an AppWorkspace allowlist mirroring the frontend WorkspaceId union, an ElevationReason, and a RestoreTarget carrying at most one bounded, absolute, control-character-free path or one conservative catalog identifier. - `elevation::relaunch` owns the platform mechanics with no dependency on any product module, so it stays available when esp-diagnostics is compiled out. Child arguments are rebuilt from nothing: the fixed runas verb, the current executable, and at most one validated `--elevation-restore=<id>`. - `elevation::restore_ticket` handles the handoff. The child receives only an opaque identifier; the typed intent lives in a schema-versioned, expiring, size-bounded file under an app-owned per-user directory. It is claimed by rename so it is consumed exactly once, refuses symlinks and non-regular files, and is re-validated on read because per-user storage is still untrusted input. The Windows token elevation probe moves here from the ESP system provider so there is one owner; ESP delegates in a later commit. Nothing is wired to the menu, IPC, or frontend yet. 46 tests cover the failure matrix: unsupported platform, already elevated, UAC cancellation as an outcome rather than an error, sanitized launch failures, NUL in the executable, Win32 quoting of spaces/quotes/trailing backslashes, ticket traversal and separator rejection, schema mismatch, expiry, single-use consumption, unknown-field rejection, and proof that a positional path is never read as a ticket option. Refs #376 * feat(elevation): expose the generic elevation IPC and startup routing Wires the relaunch model from the previous commit to Tauri (#376): - `get_app_elevation_state` reports platform support and current elevation so callers can hide or disable the action instead of failing at the UAC step. - `restart_as_administrator` validates the request, answers the no-side-effect outcomes (unsupported platform, already elevated) before writing anything, mints a ticket, and exits the current process only after Windows confirms the elevated child started. Cancelled and failed launches discard the ticket rather than leaving it to expire. - `get_initial_elevation_restore` claims the ticket the elevated process was started with, prunes abandoned ones, and reports absence rather than an error for every unusable case: a failed restore must not stop the app from starting normally. Concurrency is bounded by an in-flight guard released on drop, so a double click or two workspaces racing the same prompt produce one UAC request. Startup parsing now recognises three argument kinds that never blend into each other: positional file-association paths, the legacy ESP workspace option, and `--elevation-restore=<id>`. A restore option that fails validation is dropped rather than demoted to a file path, so a tampered value can never be opened as evidence and never suppresses a legitimate positional open. Command errors keep their causes nested rather than flattened: both this enum and its sources are internally tagged on `kind` and would otherwise collide. 481 lib tests pass, clippy is clean. The new files are rustfmt-clean; the rest of the crate has pre-existing drift against rustfmt 1.8.0 and `cargo fmt` is not a CI gate, so unrelated files are deliberately left untouched. Refs #376 * feat(elevation): add the frontend coordinator and restore routing Completes the frontend half of application-wide elevation (#376). `src/lib/elevation.ts` is the single owner. Before this, the ESP banner held its own relaunch state in a local `useState` with a catch block that swallowed the error object entirely, and nothing outside the component could observe or reset it. The menu and the Access Denied prompt would each have grown a third and fourth copy of that. The coordinator never throws: every failure, cancellation, and unsupported platform is an outcome, so callers render one consistent message instead of inventing their own catch. Concurrent requests collapse — a second click is refused outright rather than queued, so UAC prompts cannot stack. The backend enforces this too; this is the front line that also keeps the UI honest. Wire types live in `src/types/elevation.ts` rather than beside the coordinator so the command wrappers can reference them without importing the coordinator that calls those wrappers. Startup routing now applies the documented precedence: positional file paths from an OS file association, then a valid restore ticket, then the legacy workspace argument, then default. A ticket restores exactly one workspace and at most one source; other tabs, filters, searches, and selected rows are not restored. Known sources resolve through the catalog by stable id rather than a persisted expanded path, so the elevated process opens what that source means now and a retired source degrades to a warning. `markElevationRetryAttempted` fires before restoration, not after: if the restored source is still denied, the failure must offer troubleshooting rather than a second prompt. That is the loop guard. The ESP banner now calls the coordinator with workspace esp-diagnostics and no source, matching the issue's contract. Its test asserts the generic command and payload so an ESP-specific relaunch cannot quietly return. 544 frontend tests pass (11 new coordinator tests, 9 new startup-routing tests); tsc is clean. ESLint is not configured in this repo, so the CLAUDE.md lint step does not apply. Refs #376 * feat(elevation): add the global Restart as Administrator menu action Elevation could only be reached from the ESP Diagnostics coverage banner. The generic backend command and frontend coordinator already existed, but nothing outside ESP could invoke them, so a user opening a protected log from the Log Explorer had no way to ask for elevation. Adds the application-wide entry point: - File > Restart as Administrator, present only in FILE_ORDER_WINDOWS so the item is absent rather than dead on macOS and Linux, and built disabled when the process is already elevated. - A single RestartAsAdministratorDialog that owns the confirmation step, so a menu click can never reach the backend without a second deliberate action, and UAC cannot appear unprompted. - buildElevationRequest, a pure builder that maps the active source to exactly one restore target and nothing else. The builder is separate from the coordinator because the menu, the upcoming Access Denied prompt, and the ESP banner all need the same request shape; putting it in the coordinator would make every caller reach into stores itself and drift. Known sources travel by stable source ID rather than expanded path, and confirmation copy uses the path's last segment so a screenshot of the prompt does not leak a full path. The enabled state is fixed at menu build time: a process cannot gain elevation without relaunching, so no menu-state round trip is warranted. Verified: cargo test --locked 841 passed 0 failed (839 before this change); npx vitest run 562 passed across 43 files; npx tsc --noEmit clean; cargo check --locked --all-targets clean. Refs #376 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(elevation): classify Access Denied and offer elevated retry Source failures reached the frontend as a bare string, so the only way to recognise a permission refusal was to regex the message. log-source.ts did exactly that, matching /access is denied|permission denied|os error 5/i, and it had two defects the issue calls out. Windows returns localized text, so the match silently fails on a non-English install. And any error whose message merely contains those words matched, which is the wrong basis for deciding whether to raise a UAC prompt. It also classified permission refusals as "missing", telling the user a protected file did not exist and sending them after the wrong problem. Backend: - AppError::AccessDenied carries a SourceOperation and bounded path, and is produced only from std::io::ErrorKind::PermissionDenied or the raw Windows codes 5 and 1314. Never from message text. - open_log_file re-probes the path only after a parse failure, because parser::parse_file flattens its error to a String and loses the OS kind. The success path pays nothing and the signature stays put. - list_log_folder stats the path instead of calling Path::exists, which collapses every failure to false and so hid denials as "not found". - Only AccessDenied crosses IPC as a structured payload. Every other variant keeps its string shape, so the call sites that still do String(error) cannot start rendering "[object Object]". A test pins this. Frontend: - The verdict travels in a WeakMap keyed by the normalized Error identity, the same trusted channel commands.ts already uses for messages. Lookup by identity cannot invoke a Proxy trap, so a hostile rejection cannot forge a verdict and talk the app into offering elevation. - Message extraction and classification were merged into one pass. Reading them separately probed the prototype twice, which doubled the hostile-Proxy trap count that an existing test pins at one. - offerElevationForSourceFailure is the only path from a source failure to the prompt, and refuses without a verdict, off Windows, when already elevated, after a retry, and when an offer is already open. The regex is kept as the fallback for failures that never reach the classifier, so unclassified errors keep their exact current behavior rather than silently changing category. Also adds docs/elevation-windows-acceptance.md. ShellExecute runas, the token probe, and UAC cancellation cannot be exercised off Windows, so the native steps are written down rather than claimed. Verified: cargo test --locked 852 passed 0 failed (841 before); cargo clippy --locked --all-targets -- -D warnings clean, and again with --no-default-features; npx vitest run 581 passed across 44 files; npx tsc --noEmit clean; git diff --check clean. Refs #376 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(elevation): retire the ESP relaunch duplicate and repair review findings Code review of #384 found seven real defects. All are fixed here. The in-flight guard cleared itself in a finally block that sat directly under a comment saying it must stay set after a launch. Because the ESP banner calls the coordinator directly rather than through the confirmation dialog, nothing else stopped a click landing during teardown from raising a second UAC prompt. The guard now latches on launch and a test covers it. ElevationCommandError reached the user as the bare word "Relaunch". It derived an internally-tagged Serialize whose payload was a kind plus a nested cause, but the frontend normalizer reads only own, top-level string properties and never recurses, so it humanized the variant name and discarded the real reason. It now serializes by hand with a flat message alongside the nested cause. This is the same defect PR #266 fixed as F2 and the same shape error.rs already handles for AccessDenied. src-tauri/src/esp/relaunch.rs held a second ShellExecuteExW/runas implementation and was still the live backing for restart_esp_as_administrator, so the application shipped two relaunch owners while the new module's header claimed to be the only one. The issue requires that no duplicate remain. The module is deleted and the command is now a compatibility wrapper that forwards to the generic elevation path and projects the result onto the ESP wire types, which move next to the command that serves them. The removed integration tests duplicated coverage the generic module already has: already-elevated, runas, unsafe arguments, cancellation, failure, unsupported platform, and argument quoting. RestoreTarget::Folder carried an aggregate flag that was never written and never read. It cannot work as designed: the frontend has no folder mode a false value could select, since opening a folder without a selected file always aggregates. Removed rather than left as plumbing a later reader would trust. Restoring the path already reproduces what opening that folder does. retry_attempted was set unconditionally and read by nobody; the loop guard actually keyed off the ticket's mere presence. The frontend now reads the field, so the guard has one source of truth, and the doc comment describes what the field is instead of what it is not. Two comments overstated their code. The dialog claimed to be the only path from a click to a backend call while the ESP banner bypasses it, and elevation-request.ts claimed the ESP banner used it when the banner built its request inline. The banner now uses the shared builder and the dialog comment names the exception. Verified: cargo test --locked across the workspace 1426 passed 0 failed; cargo clippy --locked --all-targets -- -D warnings clean; npx vitest run 582 passed across 44 files; npx tsc --noEmit clean; git diff --check clean. Confirmed a single ShellExecuteExW and a single "runas" remain, both in src-tauri/src/elevation/relaunch.rs. Refs #376 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(elevation): send known-source targets in camelCase and cap truncation Three more findings, from the repository owner and from Copilot. RestoreTarget::KnownSource crossed the IPC boundary as `source_id` while the frontend sent `sourceId`. `rename_all` on an enum renames the variants only; struct-variant fields need `rename_all_fields`. Every known-source elevation request therefore failed to deserialize before the handler body ran, and the restore-ticket read-back broke symmetrically. Neither clippy nor tsc can see across that boundary and no test pinned the JSON, so nothing caught it. This matters more than the general case: the known-source catalog is largely protected locations such as C:\Windows\CCM\Logs, which are exactly the sources that need elevation. Three tests now pin the literal wire shape, including that the snake_case form is rejected rather than tolerated, so the contract cannot drift back silently. A sweep for the same pattern across the crate found only one other candidate, TimelineEntry, which is already correct because it carries per-variant rename_all. bounded_path sliced MAX_ERROR_PATH_LEN bytes and then appended an ellipsis, so a truncated path could exceed the cap it exists to enforce. The original test encoded that overshoot as expected. It now reserves the marker's width before walking back to a char boundary, and the tests check the cap is real, that a path exactly at the cap is untouched, and that a multi-byte character straddling the cut is never split. markElevationRetryAttempted fired whenever a ticket was present, but a positional file association wins the precedence contest and returns without restoring. Latching the loop guard for a restore that never ran suppressed legitimate elevation offers for the rest of the session. It is now marked inside the branch that actually restores, still before the restore so a second denial cannot re-prompt. Also lifts every_ordered_menu_item_dispatches_an_action, suggested by the owner from the parallel #382 implementation. A hand-maintained id list in payload_for_menu_id cannot prove an item is missing from it, so the test walks the ORDER constants instead and asserts each clickable entry resolves to an action. It passes today, which confirms the new menu item is wired. Verified: cargo test --locked across the workspace 1432 passed 0 failed; cargo clippy --locked --all-targets -- -D warnings clean; npx vitest run 582 passed across 44 files; npx tsc --noEmit clean. Refs #376 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(elevation): trap dialog focus and report busy restarts Two findings from the second Copilot review. The restart confirmation set aria-modal="true" but implemented none of what that promises: focus never entered the modal, Tab walked straight into the application behind the overlay, and closing left focus on the body. It now moves focus in on open, cycles Tab within the surface, and restores focus to whatever opened it. Fluent's Dialog would supply all three, and four dialogs in this repo already use it, but its focus manager (tabster) calls getComputedStyle in a way the pinned jsdom build throws on, which fails every getByRole inside the surface and takes the whole dialog suite down. No existing test covers a Fluent Dialog, so this was not previously visible. The trap is therefore implemented directly. The ESP coverage banner mapped the coordinator's "busy" outcome onto its default branch, so a restart already in flight, whether raised by this banner, the global menu, or the Access Denied prompt, was reported as "could not be started". It now states that a restart is in progress and stops inviting another click. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): correct denial category and ticket cleanup Three findings from the third Copilot review. The text fallback in classifySourceError sorted "access is denied", "permission denied", and "os error 5" into the missing bucket, so any failure that never reached the structured classifier was reported as "Source path is missing or inaccessible". That is the exact misclassification this work exists to remove, and it sent the user hunting for a file sitting where they left it. Permission wording now falls through to a generic error. It still carries no verdict, so it never offers elevation off localized message text. restart_as_administrator wrote the restore ticket before spawning the relaunch, but a join error returned through ? without discarding it, leaving restore state on disk until the TTL sweep even though no relaunch happened. The join failure now discards the ticket first. The ESP banner disabled its button on the "busy" outcome, with nothing to re-enable it. A restart raised elsewhere that settled as cancelled or failed left the banner dead until a reload, so "busy" no longer disables. The coordinator already collapses a duplicate click. classifySourceError is now exported so the missing-versus-error split can be pinned directly rather than through a full source load. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(elevation): match two comments to what the code does describeElevationPrompt branches on the restore target, never on `reason`, so the comment claiming the reason changes the framing described behaviour that was not there. It now says what actually drives the copy, and why the two entry points deliberately read the same. The startup precedence comment said "Three launch intents" over a list of four. Dropped the count rather than correcting it, since the last entry is the absence of an intent rather than one more of them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): scope menu restarts and gate modal shortcuts Two findings from the fifth Copilot review, plus one from CodeRabbit on the modal added last commit. The File menu always attached useLogStore.activeSource to the restart request. activeSource survives a workspace switch, so restarting from ESP or Intune would restore whatever log happened to be loaded last instead of the workspace on screen. The source now rides along only when the log workspace is the active one. The Access Denied status line echoed getLogSourcePath(source) rather than the backend's own accessDenied.path. That bypassed the IPC length cap the bounded path exists to enforce, and for a known source it printed the catalog default instead of the path actually denied. It now prefers the bounded path and falls back to a pathless sentence. useKeyboard computed isDialogOpen without elevationPrompt, and consulted it only for list navigation, so Ctrl shortcuts still fired behind the restart modal. The prompt now returns early: it traps focus and dims the app, unlike the find bar and filter dialog that deliberately leave the surrounding shortcuts live. The dialog owns its own Escape handling, so the early return cannot strand it open. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): restore into the workspace that asked for it Two findings from the sixth Copilot review. restoreElevatedSource honoured the ticket's workspace only for workspace-only targets. Any file, folder, or known-source target fell through to ensureLogViewVisible, so an Access Denied raised inside ESP or Intune, which carries that workspace alongside the failed source, reopened the right source on the wrong screen. Routing is now unconditional; since ensureLogViewVisible is only ensureWorkspaceVisible("log", ...), the log path is unchanged. The startup catch still logged "failed to open initial file paths" though the hook handles three launch intents. A restore ticket that failed to reopen is exactly what someone is troubleshooting when they read that line, so it no longer names only file association. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): catch a broken contract in the ESP banner requestElevatedRestart is documented never to throw, but it deliberately rethrows if that contract is ever broken. The ESP banner awaited it bare, so such a throw left actionState stuck on "requesting", disabling the button permanently, and escaped as an unhandled promise rejection since the handler is passed straight to onClick. It now converts the throw into the failed outcome, matching RestartAsAdministratorDialog. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): hold the backend latch after a launch The IPC in-flight guard released on scope exit even when Windows had accepted the elevated child. app.exit(0) is not instantaneous, so a duplicate call landing in that window could mint a second restore ticket and raise a second UAC prompt during teardown. The guard now latches on a launched outcome and releases on every other path, including an early return or a panic, which is what the frontend coordinator already does. The doc comment claimed unconditional release, so it now describes the one exception. Latch coverage joins the existing guard test rather than adding a second one: REQUEST_IN_FLIGHT is process-global and parallel cases would race. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): stop naming Windows in the denial message is_os_access_denied classifies ErrorKind::PermissionDenied on every platform, so AccessDenied is reachable on macOS and Linux too, where "denied by Windows" was simply wrong. A root-owned log on either now reads the same accurate sentence. Only the Display text changes; the classification, the structured payload, and the elevation gating are untouched, and the offer is still refused off-Windows by the platform check in the coordinator. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): cancel WebView shortcuts behind the modal The early return added for the restart prompt suppressed the app's own Ctrl handlers but also skipped the preventDefault they used to call, so the WebView was still free to run find-in-page or zoom behind a modal the user cannot interact with. Ctrl and Cmd combos are now cancelled before returning. Plain keys stay untouched on purpose: the dialog's focus trap owns Tab and its own listener owns Escape, and cancelling either here would break the modal it is meant to protect. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * perf(elevation): select prompt openness as a boolean useKeyboard only needs to know whether the restart prompt is open, but it selected the prompt object, so the keydown listener re-registered on every identity change. Select the boolean instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): pin the workspace that hit the denial offerElevationForSourceFailure read activeWorkspace only after awaiting the elevation probe, an IPC round trip the user can switch workspaces during. The restart would then restore whichever workspace was on screen when the probe answered rather than the one whose source was refused. The store import moves ahead of the probe so the workspace is captured first. It stays a dynamic import because the store reaches the workspace registry, which reaches back here through log-source. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): do not replace an open confirmation The native menu handler set elevationPrompt unconditionally. Choosing Restart as Administrator while a confirmation was already on screen reset the dialog's submitting and failure state, because the dialog clears its UI whenever the prompt changes, and replaced an Access Denied recovery the user was part-way through with a bare explicit-menu prompt that had forgotten the source being recovered. The handler now returns when a prompt is open, matching the guard offerElevationForSourceFailure already applies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): anchor the not-found error codes The fallback classifier matched "os error 2" and "os error 3" as bare substrings, so "os error 21" (is-a-directory), "os error 32" (sharing violation), and anything else starting with those digits were reported as a missing source. Both codes are now anchored. Reported by CodeRabbit against the regex this branch rewrote. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): add macos-jamf to the restore allowlist AppWorkspace mirrors the frontend WorkspaceId union, but macos-jamf arrived on main after this branch forked and was never added here. The frontend could therefore build a perfectly valid ElevationRequest that the backend refused to deserialize. Added to the enum, to as_id, and to the parity test that exists to catch exactly this. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): classify a path by kind before calling it Access Denied A folder that reached the file lane was reported as Access Denied and raised a "Restart as administrator?" prompt that could never succeed. `classify_open_failure` re-probed a failed open with `fs::File::open` and returned AccessDenied whenever `is_os_access_denied` was true. That helper matches `ErrorKind::PermissionDenied` on every platform, before any cfg gate. On Windows `CreateFileW` without FILE_FLAG_BACKUP_SEMANTICS fails on a directory with ERROR_ACCESS_DENIED (5), and std maps 5 to PermissionDenied, so every directory reaching that lane became a permission verdict. Confirming the prompt re-attempted the same folder as a file with `fallbackToFolder: false` and failed outright. CI stayed green because on Unix `fs::File::open(dir)` succeeds and the failure collapses to Internal, so no `#[cfg(unix)]` test could see it. Establish the kind with `fs::metadata` before classifying, and return a distinct folder verdict. `fs::metadata` does pass FILE_FLAG_BACKUP_SEMANTICS on Windows, so the answer is the same on every host and the new test needs no platform gate. This mirrors what this branch already did for the folder lane, where `Path::exists` was replaced by a real stat plus `is_dir`; the file lane never got the same treatment. Class audit, not just the reported call site: - `loadPathAsLogSource` now establishes the path kind before choosing a lane. Placed there rather than in `use-app-actions` because all eight raw-path entry points (drag and drop, file association, elevation restore, session restore, recent entries, evidence bundle, deployment, collection complete) funnel through it. The Intune and ESP workspaces already probed the kind the same way. - `recoverFromSelectedFileLoadFailure` dropped the AccessDenied verdict, so a denied file inside a folder source was reported as a generic load failure with no route to elevation. It now keeps the verdict and offers elevation for the file that was actually refused. - `is_os_access_denied` documents that callers must establish the path kind first, so the next lane cannot repeat this. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(elevation): preserve scoped restore across UAC identities * docs(elevation): add native Windows acceptance gate * fix(elevation): address hosted review findings * fix(elevation): move startup restore I/O off command executor --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ParserKindvalues plus IME specializationWhy
Several supported formats lacked end-to-end contract coverage, allowing malformed records, encoding boundaries, severity mappings, and parser-selection regressions to go unnoticed. Registry parsing also converted some malformed or unsupported values into misleading valid-looking data.
Impact
Each supported format now has a deterministic parsing contract. Recoverable malformed structured input is observable through
parse_errors, valid edge cases remain accepted, and DNS Audit behavior is covered using synthetic serialized records. The existing Simple fixture was corrected to the actual supported field order.Validation
cargo test -p cmtraceopen-parser— passed (355 unit tests and 222 integration tests)cargo test -p cmtrace-open— passedcargo clippy -p cmtraceopen-parser -p cmtrace-open --all-targets --all-features -- -D warnings— passedrustfmt --checkfor every changed Rust file — passedgit diff --check a1bc8fe1..HEAD— passedRepository-wide
cargo fmt --all -- --checkcontinues to report pre-existing formatting drift in unrelated ESP/Graph files; no unrelated formatting was changed here.The optional real DNS Audit EVTX smoke test skips when its ignored local fixture is absent; deterministic DNS provider, event dispatch, field extraction, filtering, and malformed-record tests run in CI.