Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4e3759f
Fix cloud phase timing and suspend settled polling (#126)
sh00kapic Dec 1, 2026
20d2373
Paginate findings across severity groups (#129)
sh00kapic Dec 1, 2026
0dda644
Validate cloud quotes and bind decisions to the reviewed job (#128)
sh00kapic Dec 1, 2026
6b83dfa
Keep parked quotes expiring while status polling is suspended
sh00kapic Dec 1, 2026
f5a9719
Protect update restarts and improve cloud, clone and support workflows
sh00kapic Dec 1, 2026
fd83f65
fix(cloud): release session between run requests
sh00kapic Dec 1, 2026
065c717
fix(cloud): stop interrupted runs and report platform outcomes
sh00kapic Dec 1, 2026
f43f87b
perf(analysis): index compilation databases per folder run
sh00kapic Dec 1, 2026
62b98da
Separate local history reports from session metadata
sh00kapic Dec 1, 2026
7809717
Load cloud reports independently and open older jobs by ID
sh00kapic Dec 1, 2026
f6888b1
fix(editor): bound file browsing and retain Monaco models safely
sh00kapic Dec 1, 2026
3111720
fix(workspace): preserve drafts and restore active context
sh00kapic Dec 1, 2026
905c3e3
Preserve finding provenance and open verified source checkouts
sh00kapic Dec 1, 2026
f9965f8
Bound retained history artifacts and distinguish malformed output
sh00kapic Dec 1, 2026
2b1e638
Verify staged clone cancellation and multi-root source navigation
sh00kapic Dec 1, 2026
5eece56
Parse report artifacts off the interface thread
sh00kapic Dec 1, 2026
904064b
perf(analysis): stream folder artifacts and bound previews
sh00kapic Dec 1, 2026
7e28088
fix(editor): scope shortcuts and restore Quick Open focus
sh00kapic Dec 1, 2026
8c4e91d
Open the exact revision verified for a cloud finding
sh00kapic Dec 1, 2026
7d044b2
Recover history report indexes after a desktop rollback
sh00kapic Dec 1, 2026
463561e
feat(analysis): expose active folder counts and validate large reports
sh00kapic Dec 1, 2026
88d08c0
Keep selected findings stable as reports arrive
sh00kapic Dec 1, 2026
4cfeb18
Journal full local artifacts retired with history rows
sh00kapic Dec 1, 2026
eeee742
Show retained raw reports when a preview is unavailable
sh00kapic Dec 1, 2026
bed6042
Propagate support receipt failures and verify update deferral during …
sh00kapic Dec 1, 2026
17ffe63
fix(desktop): recover cloud and local launch resource states
sh00kapic Dec 1, 2026
ae3b8fd
fix(cloud): scope cached resources to the account and API
sh00kapic Dec 1, 2026
ec02d7c
test(github): verify a real clone retries after authentication failure
sh00kapic Dec 1, 2026
c3aee7a
fix(desktop): show quota retries in Analyses and scope Settings
sh00kapic Dec 1, 2026
8aca57a
Release hidden analysis history and report elements on navigation
sh00kapic Dec 1, 2026
35e32a7
fix(editor): restore keyboard navigation out of Monaco
sh00kapic Dec 1, 2026
45a1be4
Serialize history reconciliation across Desktop processes
sh00kapic Dec 1, 2026
9fac809
Simplify empty SARIF result detection for the pinned Rust toolchain
sh00kapic Dec 1, 2026
929393a
Announce the settled keyboard selection in Quick Open
sh00kapic Dec 1, 2026
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
433 changes: 389 additions & 44 deletions desktop/App.test.tsx

Large diffs are not rendered by default.

884 changes: 684 additions & 200 deletions desktop/App.tsx

Large diffs are not rendered by default.

63 changes: 54 additions & 9 deletions desktop/bridge.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { invoke, isTauri } from "@tauri-apps/api/core";
import { Channel, invoke, isTauri } from "@tauri-apps/api/core";
import { translateError } from "./errors";
import type {
CloudPhase,
DeviceCode,
Document,
FileEntry,
Job,
LocalFolderProgress,
LocalResult,
LocalRun,
CloudReport,
ReportBody,
ToolStatus,
Workspace,
Expand Down Expand Up @@ -35,15 +37,26 @@ function call<T>(command: string, args?: Record<string, unknown>): Promise<T> {
return invoke<T>(command, args);
}
export const desktop = {
checkUpdate: () => call<string | null>("check_desktop_update"),
downloadUpdate: (
version: string,
receive: (value: { received: number; total: number | null }) => void,
) => {
const progress = new Channel<{ received: number; total: number | null }>();
progress.onmessage = receive;
return call<void>("download_desktop_update", { version, progress });
},
installUpdate: (version: string) =>
call<void>("install_desktop_update", { version }),
chooseWorkspace: () => call<Workspace | null>("choose_workspace"),
/** Starts a cloud run on the open folder; it stops at the quote. */
startCloudRun: (workspaceId: string, org: string, tools: string[] = []) =>
call<void>("cloud_run_start", { workspaceId, org, tools }),
cloudRunStatus: () => call<CloudPhase>("cloud_run_status"),
/** Approves the quote. This is the call that spends CTU. */
confirmCloudRun: (org: string) => call<void>("cloud_run_confirm", { org }),
confirmCloudRun: (job: string) => call<void>("cloud_run_confirm", { job }),
/** Stops a run, or refuses its quote; the organisation names the job. */
cancelCloudRun: (org?: string) => call<void>("cloud_run_cancel", { org }),
cancelCloudRun: (job?: string) => call<void>("cloud_run_cancel", { job }),
/** The folders and ctrace executable the previous session left behind. */
restoreSession: () =>
call<{ workspaces: Workspace[]; analyser: string | null }>(
Expand All @@ -55,10 +68,15 @@ export const desktop = {
closeWorkspace: (id: string) => call<Workspace[]>("close_workspace", { id }),
/** Where clones are kept, for Settings to show. */
cloneLocation: () => call<string>("clone_location"),
cloneRepository: (repository: string) =>
call<Workspace | null>("clone_repository", { repository }),
files: (workspaceId: string, path = "") =>
call<FileEntry[]>("list_files", { workspaceId, path }),
cloneRepository: (repository: string, existingOnly = false) =>
call<Workspace | null>("clone_repository", { repository, existingOnly }),
cancelClone: () => call<void>("cancel_clone"),
files: (workspaceId: string, path = "", offset = 0) =>
call<{ entries: FileEntry[]; total: number }>("list_files", {
workspaceId,
path,
offset,
}),
read: (workspaceId: string, path: string) =>
call<Document>("read_file", { workspaceId, path }),
save: (
Expand All @@ -67,6 +85,8 @@ export const desktop = {
content: string,
revision: string,
) => call<Document>("save_file", { workspaceId, path, content, revision }),
saveCopy: (workspaceId: string, path: string, content: string) =>
call<Document>("save_file_copy", { workspaceId, path, content }),
analyserStatus: () => call<AnalyserStatus>("analyser_status"),
installAnalyser: (version: string) =>
call<string>("install_analyser", { version }),
Expand All @@ -76,21 +96,46 @@ export const desktop = {
chooseAnalysisFile: (kind: keyof AnalysisOptions, clear = false) =>
call<AnalysisOptions>("choose_analysis_file", { kind, clear }),
/** Recent local runs of the open folder, newest first. */
verifyFindingSource: (
workspaceId: string,
path: string,
repository: string,
host: string,
commit: string,
) =>
call<Document>("verify_finding_source", {
workspaceId,
path,
repository,
host,
commit,
}),
localHistory: (workspaceId: string) =>
call<LocalRun[]>("local_history", { workspaceId }),
openLocalArtifacts: (runId: string) =>
call<void>("open_local_artifacts", { runId }),
localHistoryReport: (workspaceId: string, runId: string) =>
call<string | null>("local_history_report", { workspaceId, runId }),
/** Analyses every source file in the open folder, one after another. */
analyseLocalFolder: (workspaceId: string) =>
call<LocalResult>("analyse_local_folder", { workspaceId }),
localAnalysisProgress: () =>
call<LocalFolderProgress | null>("local_analysis_progress"),
analyseLocal: (workspaceId: string, path: string) =>
call<LocalResult>("analyse_local", { workspaceId, path }),
/** Every file of the folder, relative, for finding one by name. */
allFiles: (workspaceId: string) =>
call<string[]>("list_all_files", { workspaceId }),
call<{ paths: string[]; partial: boolean }>("list_all_files", {
workspaceId,
}),
/** Which of ctrace's external tools this machine has. */
probeTools: () => call<ToolStatus[]>("probe_tools"),
/** Repositories already cloned here, as owner/name. */
clonedRepositories: () => call<string[]>("cloned_repositories"),
/** Build files at the folder's root, for a tool-failure report. */
supportOs: () => call<string>("support_os"),
supportChooseFile: (workspaceId: string) =>
call<string | null>("support_choose_file", { workspaceId }),
supportCandidates: (workspaceId: string) =>
call<{ name: string; bytes: number }[]>("support_candidates", {
workspaceId,
Expand Down Expand Up @@ -135,7 +180,7 @@ export const desktop = {
cancelCloud: (org: string, id: string) =>
call<void>("cloud_cancel", { org, id }),
report: (org: string, id: string, run: string) =>
call<string>("cloud_report", { org, id, run }),
call<CloudReport>("cloud_report", { org, id, run }),
/** Opens GitHub's authorisation in the system browser; resolves with the URL. */
connectGitHub: () => call<string>("connect_github"),
openAccount: (page: "device" | "dashboard" | "repositories" | "settings") =>
Expand Down
91 changes: 91 additions & 0 deletions desktop/components/DesktopUpdate.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { useEffect, useState } from "react";
import { desktop, errorMessage, native } from "../bridge";

export function DesktopUpdate({
restart,
blocked,
}: {
restart: (version: string) => Promise<void>;
blocked: boolean;
}) {
const [version, setVersion] = useState<string | null>(null);
const [stage, setStage] = useState<"available" | "downloading" | "ready">(
"available",
);
const [progress, setProgress] = useState({
received: 0,
total: null as number | null,
});
const [error, setError] = useState("");
useEffect(() => {
if (!native) return;
let live = true;
void desktop
.checkUpdate()
.then((value) => {
if (live) setVersion(value);
})
.catch(() => {});
return () => {
live = false;
};
}, []);
if (!version) return null;
async function download(target: string) {
setStage("downloading");
setError("");
setProgress({ received: 0, total: null });
try {
await desktop.downloadUpdate(target, setProgress);
setStage("ready");
} catch (e) {
setStage("available");
setError(errorMessage(e));
}
}
return (
<section
className="notice update-notice"
aria-label="Mise à jour de CoreTrace"
>
<strong>CoreTrace {version}</strong>
{stage === "available" && (
<>
<button onClick={() => void download(version)}>
Télécharger la mise à jour
</button>
<button onClick={() => setVersion(null)}>Plus tard</button>
</>
)}
{stage === "downloading" && (
<>
<span>
Téléchargement · {(progress.received / 1048576).toFixed(1)} Mio
</span>
<progress
aria-label="Téléchargement de CoreTrace"
value={progress.total ? progress.received : undefined}
max={progress.total ?? undefined}
/>
</>
)}
{stage === "ready" && (
<>
<span>
{blocked
? "Terminez l’opération en cours pour redémarrer."
: "Mise à jour prête. Vous pouvez continuer à travailler."}
</span>
<button disabled={blocked} onClick={() => void restart(version)}>
Installer et redémarrer
</button>
</>
)}
{error && (
<span className="error" role="alert">
{error}
</span>
)}
</section>
);
}
66 changes: 66 additions & 0 deletions desktop/components/ToolCoverage.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { act, cleanup, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, beforeEach, expect, it, vi } from "vitest";
import { desktop } from "../bridge";
import { invalidateCoverage, ToolCoverage } from "./ToolCoverage";

vi.mock("../bridge", () => ({
native: true,
desktop: { probeTools: vi.fn() },
errorMessage: (error: unknown) => String(error),
}));
beforeEach(() => {
invalidateCoverage();
vi.resetAllMocks();
});
afterEach(cleanup);

it("distinguishes a pending probe, missing coverage and verified coverage", async () => {
let complete!: (rows: Awaited<ReturnType<typeof desktop.probeTools>>) => void;
vi.mocked(desktop.probeTools).mockImplementationOnce(
() =>
new Promise((resolve) => {
complete = resolve;
}),
);
const first = render(<ToolCoverage analyser="ctrace" />);
expect(screen.getByRole("status").textContent).toContain("Vérification");
await act(async () => complete([{ name: "flawfinder", found: false }]));
expect(screen.getByRole("status").textContent).toContain("flawfinder");
expect(screen.getByRole("status").textContent).not.toContain(
"Tous les outils",
);
first.unmount();
render(<ToolCoverage analyser="ctrace" />);
await screen.findByText("✗ flawfinder");
expect(desktop.probeTools).toHaveBeenCalledTimes(1);

vi.mocked(desktop.probeTools).mockResolvedValueOnce([
{ name: "flawfinder", found: true },
]);
act(invalidateCoverage);
await screen.findByText("Tous les outils vérifiés sont disponibles.");
expect(desktop.probeTools).toHaveBeenCalledTimes(2);
});

it.each(["empty", "failure"] as const)(
"makes an %s probe retryable without treating it as complete",
async (failure) => {
if (failure === "empty")
vi.mocked(desktop.probeTools).mockResolvedValueOnce([]);
else
vi.mocked(desktop.probeTools).mockRejectedValueOnce(new Error("timeout"));
vi.mocked(desktop.probeTools).mockResolvedValueOnce([
{ name: "cppcheck", found: true },
]);
render(<ToolCoverage analyser="ctrace" />);
expect((await screen.findByRole("alert")).textContent).toContain(
"indisponible",
);
expect(desktop.probeTools).toHaveBeenCalledTimes(1);
await userEvent.click(
screen.getByRole("button", { name: "Revérifier les outils" }),
);
await screen.findByText("Tous les outils vérifiés sont disponibles.");
},
);
88 changes: 88 additions & 0 deletions desktop/components/ToolCoverage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { useState, useEffect, useSyncExternalStore } from "react";
import { desktop, errorMessage, native } from "../bridge";
import type { ToolStatus } from "../types";

let cached: { key: string; probe: Promise<ToolStatus[]> } | undefined;
let revision = 0;
const listeners = new Set<() => void>();
const observe = (listener: () => void) => {
listeners.add(listener);
return () => {
listeners.delete(listener);
};
};
const getRevision = () => revision;

export function invalidateCoverage() {
cached = undefined;
revision++;
for (const listener of listeners) listener();
}
function probe(key: string) {
if (cached?.key === key) return cached.probe;
const pending = desktop
.probeTools()
.then((rows) => {
if (!rows.length) throw new Error("Aucun outil n’a pu être vérifié.");
return rows;
})
.catch((e) => {
if (cached?.probe === pending) cached = undefined;
throw e;
});
cached = { key, probe: pending };
return pending;
}
export function ToolCoverage({ analyser }: { analyser: string }) {
const configuration = useSyncExternalStore(observe, getRevision, getRevision);
const [attempt, setAttempt] = useState(0);
const [coverage, setCoverage] = useState<ToolStatus[] | null>(null);
const [error, setError] = useState("");
useEffect(() => {
if (!native) return;
let active = true;
setCoverage(null);
setError("");
void probe(analyser).then(
(rows) => {
if (active) setCoverage(rows);
},
(e) => {
if (active) setError(errorMessage(e));
},
);
return () => {
active = false;
};
}, [analyser, configuration, attempt]);
if (!native) return null;
if (error)
return (
<p role="alert">
Couverture des outils indisponible. {error}{" "}
<button onClick={() => setAttempt((n) => n + 1)}>
Revérifier les outils
</button>
</p>
);
return (
<p className="muted small tool-probe" role="status">
{coverage === null ? (
"Vérification des outils locaux…"
) : (
<>
{coverage.map((tool) => (
<span key={tool.name} className={tool.found ? "found" : "absent"}>
{tool.found ? "✓" : "✗"} {tool.name}
</span>
))}
{coverage.some((tool) => !tool.found) ? (
<span>— les outils absents ne produisent aucun résultat.</span>
) : (
<span>Tous les outils vérifiés sont disponibles.</span>
)}
</>
)}
</p>
);
}
Loading
Loading