Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
run: node scripts/check-desktop-version.cjs
- name: Verify bundle icons
run: node scripts/check-bundle-icons.cjs
- name: Decode the macOS bundle icon
if: runner.os == 'macOS'
run: iconutil -c iconset -o "$RUNNER_TEMP/CoreTrace.iconset" assets/ctrace.icns
- run: npm run check
- run: npm run format:check
- name: Show what Prettier would change
Expand Down Expand Up @@ -105,6 +108,12 @@ jobs:
run: node scripts/check-desktop-version.cjs
- name: Verify bundle icons
run: node scripts/check-bundle-icons.cjs
- name: Decode the macOS bundle icon
if: runner.os == 'macOS'
run: iconutil -c iconset -o "$RUNNER_TEMP/CoreTrace.iconset" assets/ctrace.icns
- name: Verify the official analyser installs and runs
if: runner.os == 'Linux' || (runner.os == 'macOS' && runner.arch == 'ARM64')
run: cargo test --manifest-path src-tauri/Cargo.toml --locked official_release_installs_and_produces_sarif -- --ignored
- name: Third-party notices
run: npm run notices
- name: Release notes
Expand Down
5 changes: 5 additions & 0 deletions DESIGN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CoreTrace Desktop design

CoreTrace is a French-language code and analysis workspace. Keep the existing charcoal surfaces, red primary accent, and compact editor typography. The CSS custom properties in `desktop/styles.css` define the runtime palette.

The workspace header names the active folder and keeps **Analyser** in the same place with or without a file open. Use the shared dialog, focus styles, and text labels for all launch surfaces. Keep the primary action next to the consequence it authorizes.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ production credentials are embedded in the preview.
Follow progress, cancel, inspect verified reports and open findings in the matching
workspace. Retrying an uncertain submission keeps its idempotency key until inputs
change or submission succeeds. Local edits are not uploaded by this workflow.
- **Local analysis:** Select your installed native `ctrace` executable in Settings,
with its analysis tools installed. Open a source file or a folder and run static
analysis. SARIF findings, stdout/stderr and cancellation are available.
- **Local analysis:** Open a C/C++ folder and choose **Analyser** in the code
workspace. On supported systems the first local run offers to download the
official CoreTrace analyser and shows the version and size before it starts.
Managed downloads cover Linux x64 (glibc 2.34+) and Apple Silicon (macOS 14+).
You can also choose an installed native `ctrace` executable in Settings.
Linux needs the system C library headers (for example `libc6-dev` on Ubuntu).
The analyser runs locally and the installed version works offline. Desktop
and analyser updates each require approval before downloading or installing.
SARIF findings, stdout/stderr and cancellation are available.
Settings also accepts a tool configuration (`--config`) and the project's
`compile_commands.json` (`--compile-commands`). The packaged configuration is
selected automatically next to a CoreTrace distribution. With a configuration, its tool
Expand Down Expand Up @@ -92,7 +98,8 @@ tags build and publish installers and signed update artifacts to GitHub Releases
navigation. Terminal, debugger, LSP, extensions, Git commit/push UI, WSL bridging and
local LLM integrations are not included. Local analysis can run on the active
file or open folder. Cloud analysis can run on a connected GitHub commit or
upload the open folder after you confirm the CTU quote.
on an open folder you choose to upload. The CTU quote requires your approval
before the analysis starts.

See the [migration and rollback guide](docs/tauri-migration.md) for the Electron
archive and the [original validation report](docs/desktop-validation.md).
7 changes: 7 additions & 0 deletions UX-CONTRACT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Analysis UX

- Analyse names a folder or supported source file and asks where to run. Local analysis requires no account. The first managed run discloses its required download, official version, and size before the user starts it.
- Cloud analysis discloses the upload before transfer and requires a second explicit approval for CTU. Failure offers a local retry.
- Analysis reads saved files. When the target contains edits, its action states that it saves them first. A save failure keeps the editor drafts and stops the launch.
- The run panel keeps progress, cancellation, recovery, and report access visible. Local reports belong to the workspace and run that created them.
- Updating Desktop or its analyser requires an explicit action for each. A managed analyser stays available offline after install, and a manually selected analyser remains the user's choice.
Binary file modified assets/ctrace.icns
Binary file not shown.
120 changes: 109 additions & 11 deletions desktop/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type CloseHandler = (event: {
}) => void | Promise<void>;
let closeHandler: CloseHandler | undefined;
const destroy = vi.fn(() => Promise.resolve());
const saveDrafts = vi.fn<() => Promise<void>>();

vi.mock("@tauri-apps/api/window", () => ({
getCurrentWindow: () => ({
Expand All @@ -37,11 +38,15 @@ vi.mock("./features/WorkspaceEditor", () => ({
WorkspaceEditor: forwardRef(function FakeEditor(
props: {
dirtyChanged: (dirty: boolean) => void;
run: (path: string) => void;
run: (path?: string) => void;
},
ref: React.Ref<{ open: () => Promise<void> }>,
) {
useImperativeHandle(ref, () => ({ open: vi.fn() }));
useImperativeHandle(ref, () => ({
open: vi.fn(),
saveDrafts,
hasDrafts: () => false,
}));
return (
<>
<button onClick={() => props.dirtyChanged(true)}>
Expand Down Expand Up @@ -72,6 +77,10 @@ vi.mock("./bridge", () => ({
closeWorkspace: vi.fn(),
cancelLocal: vi.fn(),
localHistory: vi.fn(),
analyserStatus: vi.fn(),
installAnalyser: vi.fn(),
analyseLocalFolder: vi.fn(),
probeTools: vi.fn(),
},
errorMessage: (e: unknown) => (e instanceof Error ? e.message : String(e)),
}));
Expand All @@ -86,6 +95,7 @@ beforeAll(() => {
});
beforeEach(() => {
vi.resetAllMocks();
saveDrafts.mockResolvedValue(undefined);
vi.mocked(desktop.status).mockResolvedValue({
signedIn: false,
baseUrl: "https://api.coretrace.fr/v1",
Expand All @@ -94,6 +104,22 @@ beforeEach(() => {
vi.mocked(desktop.restoreSession).mockRejectedValue(new Error("no session"));
vi.mocked(desktop.cloudRunStatus).mockResolvedValue({ phase: "idle" });
vi.mocked(desktop.localHistory).mockResolvedValue([]);
vi.mocked(desktop.analyserStatus).mockResolvedValue({
available: { version: "v0.85.0", bytes: 96_946_015 },
path: null,
installedVersion: null,
received: null,
});
vi.mocked(desktop.probeTools).mockResolvedValue([]);
vi.mocked(desktop.analyseLocalFolder).mockResolvedValue({
runId: "1",
exitCode: 0,
report: null,
warnings: [],
stdout: "",
stderr: "",
cancelled: false,
});
vi.mocked(desktop.closeWorkspace).mockResolvedValue([]);
vi.mocked(desktop.cancelLocal).mockResolvedValue();
closeHandler = undefined;
Expand Down Expand Up @@ -260,23 +286,95 @@ it("blocks a folder switch while an operation is already running, without asking
expect(desktop.chooseWorkspace).toHaveBeenCalledTimes(2);
});

it("sends a local run to Settings, with a reason, when no ctrace executable is chosen", async () => {
it("discloses the first download before consent then runs the selected folder", async () => {
const user = userEvent.setup();
render(
<ConfirmProvider>
<App />
</ConfirmProvider>,
);
await openWorkspaceA(user);

await user.click(screen.getByText("Lancer l’analyse sur ce fichier"));

vi.mocked(desktop.chooseWorkspace).mockResolvedValueOnce(workspaceA);
vi.mocked(desktop.installAnalyser).mockResolvedValueOnce(
"/app/analyser/bin/ctrace",
);
await user.click(
await screen.findByRole("button", { name: /Nouvelle analyse/ }),
);
const dialog = await screen.findByRole("dialog", {
name: "Analyser alpha ?",
});
expect(
await screen.findByText(
"Sélectionnez le programme ctrace avant de lancer une analyse locale.",
await within(dialog).findByText(
/doit télécharger son analyseur officiel.*v0.85.0.*97 Mo/,
),
).toBeDefined();
expect(screen.getByText("Paramètres").closest("button")?.className).toBe(
"active",
expect(desktop.installAnalyser).not.toHaveBeenCalled();
expect(desktop.analyseLocalFolder).not.toHaveBeenCalled();
await user.click(
within(dialog).getByRole("button", {
name: "Télécharger et analyser le dossier",
}),
);
await waitFor(() =>
expect(desktop.analyseLocalFolder).toHaveBeenCalledWith("w1"),
);
expect(desktop.installAnalyser).toHaveBeenCalledWith("v0.85.0");
});

it("uses an existing analyser without updating it for a new run", async () => {
vi.mocked(desktop.analyserStatus).mockResolvedValue({
available: { version: "v0.85.0", bytes: 96_946_015 },
path: "/app/analyser/bin/ctrace",
installedVersion: "v0.84.0",
received: null,
});
const user = userEvent.setup();
render(
<ConfirmProvider>
<App />
</ConfirmProvider>,
);
await openWorkspaceA(user);
await user.click(screen.getByRole("button", { name: /Nouvelle analyse/ }));
const dialog = await screen.findByRole("dialog", {
name: "Analyser alpha ?",
});
await user.click(
within(dialog).getByRole("button", { name: "Analyser le dossier" }),
);
await waitFor(() =>
expect(desktop.analyseLocalFolder).toHaveBeenCalledWith("w1"),
);
expect(desktop.installAnalyser).not.toHaveBeenCalled();
});

it("keeps the launch dialog and stops the run when saving fails", async () => {
vi.mocked(desktop.analyserStatus).mockResolvedValue({
available: null,
path: "/usr/local/bin/ctrace",
installedVersion: null,
received: null,
});
saveDrafts.mockRejectedValueOnce(new Error("Conflit d’enregistrement"));
const user = userEvent.setup();
render(
<ConfirmProvider>
<App />
</ConfirmProvider>,
);
await openWorkspaceA(user);
await user.click(screen.getByText("Modifier le fichier"));
await user.click(screen.getByRole("button", { name: /Nouvelle analyse/ }));
const dialog = await screen.findByRole("dialog", {
name: "Analyser alpha ?",
});
await user.click(
await within(dialog).findByRole("button", {
name: "Enregistrer et analyser le dossier",
}),
);
expect(
await within(dialog).findByText("Conflit d’enregistrement"),
).toBeDefined();
expect(desktop.analyseLocalFolder).not.toHaveBeenCalled();
});
Loading
Loading