Since #220 the compiler enforces several internal invariants with unconditional assert!s. The bindings (crates/mds-napi/src/lib.rs run_catching, crates/mds-wasm/src/lib.rs catch_panic, crates/mds-python/src/lib.rs guard) convert a panic into a typed mds::internal / internal compiler error and hide the payload unless the never-shipped debug-panics feature is on. The CLI has no catch_unwind or std::panic::set_hook: a tripped assert prints thread 'main' panicked at crates/mds-core/src/<file>:<line>:<col>: plus the message to stderr and exits 101.
Asymmetries: the assert's source location is disclosed only on the CLI; 101 is outside the documented exit-code table; mds watch dies instead of reporting and continuing.
Proposal: a hook in main.rs that prints mds: internal compiler error: <message> (message only, through sanitize_control_chars_wire) plus an issue-tracker pointer, keeps or documents exit 101, and catch_unwind around per-file compiles in watch. Not done in #220 because it changes CLI stderr contracts pinned by the cli_* suites.
Also: SECURITY.md (the "debug-panics" paragraph, ~line 83) says mds-core exposes debug-panics; only the three bindings do.
Refs #220, PR #388.
Since #220 the compiler enforces several internal invariants with unconditional
assert!s. The bindings (crates/mds-napi/src/lib.rsrun_catching,crates/mds-wasm/src/lib.rscatch_panic,crates/mds-python/src/lib.rsguard) convert a panic into a typedmds::internal/internal compiler errorand hide the payload unless the never-shippeddebug-panicsfeature is on. The CLI has nocatch_unwindorstd::panic::set_hook: a tripped assert printsthread 'main' panicked at crates/mds-core/src/<file>:<line>:<col>:plus the message to stderr and exits 101.Asymmetries: the assert's source location is disclosed only on the CLI; 101 is outside the documented exit-code table;
mds watchdies instead of reporting and continuing.Proposal: a hook in
main.rsthat printsmds: internal compiler error: <message>(message only, throughsanitize_control_chars_wire) plus an issue-tracker pointer, keeps or documents exit 101, andcatch_unwindaround per-file compiles inwatch. Not done in #220 because it changes CLI stderr contracts pinned by thecli_*suites.Also:
SECURITY.md(the "debug-panics" paragraph, ~line 83) says mds-core exposesdebug-panics; only the three bindings do.Refs #220, PR #388.