solidcraft-crash-safety
Installation
SKILL.md
Contains Shell Commands
This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.
Never crash
People trust SolidCraft with their designs. This outranks feature work.
In non-test code
- No
unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!. Every production crate root carries#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)];cargo xtask ciruns clippy with-D warnings. - No
unsafe(unsafe_code = "forbid"). The exceptions, in the app crate and incrates/threedx-client(which deny it instead), have no safe API:- macOS only:
crates/threedx-client/src/macos.rs(loads the 3Dconnexion driver's client framework at run time and calls through its function pointers), two functions inapps/solidcraft/src/open_documents.rs(macOS hands Finder files only to an Objective-C method), andapps/solidcraft/src/native_crash_macos.rs(the signal handler that records crashes inside native code, asnative_crash.rsdoes on Windows) - Windows only:
apps/solidcraft/src/native_crash.rs(the exception filter that records crashes inside native code such as graphics drivers),apps/solidcraft/src/native_frame.rs(the window procedure that answers the resize-border hit test of the window without OS decorations, and gives its class the icon the taskbar falls back on) andapps/solidcraft/src/space_mouse/windows_hid.rs(asks Plug and Play which HID interfaces are 3D mice, so no other device is sent anything)
- macOS only:
- Errors are
Result<T, E>through the crate's error type and?. An unfinished feature returns an error ("not supported yet: ..."); it never panics. - Input-derived numbers are hostile (command parameters, design files, control-channel input):
get()not[i], finite checks, caps on sizes and loop counts. - Everything that calls
truckgoes throughsolidcraft_kernel::guard, which turns a panic intoKernelError::Internal. Onlycrates/kernelmay usetruck. - Last resort:
Session::executeruns every command undercatch_unwind; an escaped panic restores the design and reportsEngineError::Internal. Do not rely on it. - Files are written with
crates/io/src/safe_write.rs(temporary file, flush, one rename), so a crash leaves the old file or the new one.
Proving a crash fix
- Every crash fix lands with a regression test.
hostile_params_never_panicincrates/engine/src/tests.rsruns every command with junk parameters; a new command gets this for free. - A crash report's
design.scandreplay.jsonare the test's starting point. Put the test in the area's existing test file (seeskills/solidcraft-tests/SKILL.md).