Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.

### Added

- **Canonical user-story tracker**: Inventory every chrome and workspace feature in `docs/qa/user-stories.csv` with expected behavior derived from the current code, plus fixture/RTL coverage for those surfaces.

- **Administrator restart with source restoration (#384)**: Application-wide restart as administrator on supported Windows builds, restoring open sources after elevation.
- **Company Portal macOS unified-log evidence (#390)**: Normalize Apple unified-log evidence for Company Portal on macOS so enrollment and portal diagnostics correlate without inventing outcomes.
- **Intune Device Inventory Agent log family (#397 / #354)**: Discover and parse the full Microsoft Device Inventory Agent log set under Program Files (harvester, Inventory Adaptor, and rotation-failure dialects) with known-sources entry, folder aggregation for `.log` / rotations / `.log_`, and logical-record-aware real-time tailing.
Expand All @@ -29,6 +31,9 @@ All notable changes to this project will be documented in this file.

### Fixed

- **Dialog landmarks**: Filter, Collect Diagnostics, Collection Complete, Update, and first-run file-association overlays expose `role="dialog"` / `aria-modal` so they are reachable as dialog landmarks.
- **Tab switch restores the selected log**: Cached tab switches apply the file snapshot before the sidebar folder listing, so swapping tabs no longer leaves the previous file on screen while the listing is in flight.

- **Unicode decimal digit panics (#413 / #502)**: Reject non-ASCII Unicode decimal fields in CCM and related time grammars so multi-byte digits cannot panic the parser mid-slice.
- **Signless CCM timestamp display (#410 / #504)**: Treat signless fractional tails as milliseconds (not fabricated timezone offsets); short fractions pad correctly for public `LogEntry` projection.
- **IPv6 redaction residual (#416 / #503)**: Redact bare unspecified IPv6 forms in macOS export paths without destroying C++ `std::` symbols.
Expand Down
124 changes: 124 additions & 0 deletions docs/qa/user-stories.csv

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src-tauri/src/commands/file_association.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tauri::{AppHandle, Manager};
#[cfg(target_os = "windows")]
const FILE_ASSOCIATION_PROG_ID: &str = "CMTraceOpen.LogFile";
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
const LOG_FILE_EXTENSIONS: &[&str] = &[".log", ".lo_", ".log_"];
const LOG_FILE_EXTENSIONS: &[&str] = &[".log", ".lo_", ".log_", ".cmtlog"];
const FILE_ASSOCIATION_PROMPT_FILE_NAME: &str = "file-association-preferences.json";

#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
Expand Down Expand Up @@ -288,7 +288,7 @@ mod tests {

#[test]
fn log_file_extensions_include_each_unique_rotation() {
assert_eq!(LOG_FILE_EXTENSIONS, &[".log", ".lo_", ".log_"]);
assert_eq!(LOG_FILE_EXTENSIONS, &[".log", ".lo_", ".log_", ".cmtlog"]);

let unique_extensions: HashSet<_> = LOG_FILE_EXTENSIONS.iter().copied().collect();
assert_eq!(unique_extensions.len(), LOG_FILE_EXTENSIONS.len());
Expand Down
32 changes: 31 additions & 1 deletion src/components/dialogs/AboutDialog.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from "@testing-library/react";
import { fireEvent, render, screen } from "@testing-library/react";
import { getIdentifier, getName, getTauriVersion, getVersion } from "@tauri-apps/api/app";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { AboutDialog } from "./AboutDialog";
Expand All @@ -24,6 +24,36 @@ describe("AboutDialog", () => {
getVersionMock.mockResolvedValue("1.3.2");
});

it("exposes a dialog landmark", async () => {
render(<AboutDialog isOpen onClose={() => {}} />);

const dialog = await screen.findByRole("dialog", { name: "About CMTrace Open" });
expect(dialog).toHaveAttribute("aria-modal", "true");
expect(await screen.findByText("CMTrace Open")).toBeVisible();
});

it("traps focus and restores focus to the opener", () => {
const opener = document.createElement("button");
document.body.append(opener);
opener.focus();

const view = render(<AboutDialog isOpen onClose={() => {}} />);
const dialog = screen.getByRole("dialog", { name: "About CMTrace Open" });
const ok = screen.getByRole("button", { name: "OK" });

expect(dialog).toHaveAttribute("tabindex", "-1");
expect(document.activeElement).toBe(ok);

fireEvent.keyDown(window, { key: "Tab" });
expect(document.activeElement).toBe(ok);
fireEvent.keyDown(window, { key: "Tab", shiftKey: true });
expect(document.activeElement).toBe(ok);

view.unmount();
expect(document.activeElement).toBe(opener);
opener.remove();
});

it("shows main channel app metadata", async () => {
render(<AboutDialog isOpen onClose={() => {}} />);

Expand Down
11 changes: 10 additions & 1 deletion src/components/dialogs/AboutDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { getIdentifier, getName, getTauriVersion, getVersion } from "@tauri-apps/api/app";
import { tokens } from "@fluentui/react-components";
import { useModalFocus } from "../../hooks/use-modal-focus";
import { getUpdateChannel, getUpdateChannelLabel } from "../../lib/update-channel";

interface AboutDialogProps {
Expand All @@ -13,9 +14,12 @@ export function AboutDialog({ isOpen, onClose }: AboutDialogProps) {
const [appVersion, setAppVersion] = useState("0.2.0");
const [tauriVersion, setTauriVersion] = useState("-");
const [identifier, setIdentifier] = useState("com.cmtrace.open");
const surfaceRef = useRef<HTMLDivElement>(null);
const updateChannel = getUpdateChannel(appVersion);
const updateChannelLabel = getUpdateChannelLabel(updateChannel);

useModalFocus(isOpen, surfaceRef);

useEffect(() => {
if (!isOpen) return;
const handleKey = (e: KeyboardEvent) => {
Expand Down Expand Up @@ -78,6 +82,11 @@ export function AboutDialog({ isOpen, onClose }: AboutDialogProps) {
}}
>
<div
ref={surfaceRef}
role="dialog"
aria-modal="true"
aria-label="About CMTrace Open"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
tabIndex={-1}
style={{
backgroundColor: tokens.colorNeutralBackground1,
color: tokens.colorNeutralForeground1,
Expand Down
101 changes: 101 additions & 0 deletions src/components/dialogs/CollectDiagnosticsDialog.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { CollectDiagnosticsDialog } from "./CollectDiagnosticsDialog";
import { CollectionCompleteDialog } from "./CollectionCompleteDialog";
import { useUiStore } from "../../stores/ui-store";
import { COLLECTION_PRESETS } from "../../lib/collection-categories";

const collectDiagnostics = vi.hoisted(() => vi.fn());

vi.mock("../../lib/commands", () => ({
collectDiagnostics,
}));

vi.mock("../../lib/log-source", () => ({
loadPathAsLogSource: vi.fn(),
}));

describe("CollectDiagnosticsDialog", () => {
afterEach(() => {
cleanup();
useUiStore.setState({ collectionProgress: null, collectionResult: null });
});

it("exposes a dialog landmark when open", () => {
render(<CollectDiagnosticsDialog isOpen onClose={() => {}} />);
const dialog = screen.getByRole("dialog", { name: "Collect Diagnostics" });
expect(dialog).toHaveAttribute("aria-modal", "true");
});

it("shows presets, category checkboxes, and starts collection", async () => {
collectDiagnostics.mockResolvedValue({
bundlePath: "C:/Users/Public/cmtrace-bundle",
bundleId: "bundle-1",
artifactCounts: { collected: 4, missing: 1, failed: 0, total: 5 },
durationMs: 1200,
gaps: [{ artifactId: "cbs", category: "general", reason: "not present" }],
});
const onClose = vi.fn();
render(<CollectDiagnosticsDialog isOpen onClose={onClose} />);

expect(screen.getByText("Collect Diagnostics")).toBeInTheDocument();
expect(screen.getByText("Quick Presets")).toBeInTheDocument();
for (const preset of COLLECTION_PRESETS) {
expect(screen.getByRole("button", { name: preset.label })).toBeInTheDocument();
}
expect(screen.getByText("Intune & MDM")).toBeInTheDocument();
expect(screen.getByText("Autopilot & Provisioning")).toBeInTheDocument();

fireEvent.click(screen.getByRole("button", { name: "Intune + Autopilot" }));
fireEvent.click(screen.getByRole("button", { name: "Collect" }));
expect(onClose).toHaveBeenCalled();
expect(collectDiagnostics).toHaveBeenCalled();
});
});

describe("CollectionCompleteDialog", () => {
afterEach(() => {
cleanup();
});

it("exposes a dialog landmark when complete", () => {
render(
<CollectionCompleteDialog
onClose={() => {}}
result={{
bundlePath: "C:/Users/Public/cmtrace-bundle",
bundleId: "bundle-1",
artifactCounts: { collected: 4, missing: 1, failed: 0, total: 5 },
durationMs: 1500,
gaps: [],
}}
/>,
);
const dialog = screen.getByRole("dialog", { name: "Collection Complete" });
expect(dialog).toHaveAttribute("aria-modal", "true");
});

it("shows counts, gaps, Close, and Open Bundle", () => {
const onClose = vi.fn();
render(
<CollectionCompleteDialog
onClose={onClose}
result={{
bundlePath: "C:/Users/Public/cmtrace-bundle",
bundleId: "bundle-1",
artifactCounts: { collected: 4, missing: 1, failed: 0, total: 5 },
durationMs: 1500,
gaps: [{ artifactId: "cbs", category: "general", reason: "CBS.log not present" }],
}}
/>,
);
expect(screen.getByText("Collection Complete")).toBeInTheDocument();
expect(screen.getByText("Collected")).toBeInTheDocument();
expect(screen.getByText("Missing")).toBeInTheDocument();
expect(screen.getByText("Failed")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: /Show 1 missing/i }));
expect(screen.getByText(/CBS.log not present/)).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Close" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Open Bundle" })).toBeInTheDocument();
});
});
3 changes: 3 additions & 0 deletions src/components/dialogs/CollectDiagnosticsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ export function CollectDiagnosticsDialog({ isOpen, onClose }: CollectDiagnostics
}}
>
<div
role="dialog"
aria-modal="true"
aria-label="Collect Diagnostics"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
style={{
width: "520px",
maxHeight: "80vh",
Expand Down
3 changes: 3 additions & 0 deletions src/components/dialogs/CollectionCompleteDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export function CollectionCompleteDialog({ result, onClose }: CollectionComplete
}}
>
<div
role="dialog"
aria-modal="true"
aria-label={isError ? "Collection Failed" : "Collection Complete"}
style={{
width: "420px",
backgroundColor: tokens.colorNeutralBackground1,
Expand Down
Loading
Loading