Register all sketch-constraint commands in the autocomplete registry

None of the 17 constraint commands (HCONSTRAINT, VCONSTRAINT,
PCONSTRAINT, QCONSTRAINT, ECONSTRAINT, TCONSTRAINT, NCONSTRAINT,
NRCONSTRAINT, LCONSTRAINT, FXCONSTRAINT, SYCONSTRAINT, CCONSTRAINT,
EDCONSTRAINT, CPCONSTRAINT, MPCONSTRAINT, OCCONSTRAINT, DCONSTRAINT,
ACONSTRAINT) carried an inventory::submit! registration, so they were
invisible to command-line autocomplete, the MCP commands listing, and
the ALIASEDIT shortcut editor (which rejects a custom shortcut target
that isn't in this same registry). Each constraint module now
registers itself, with a regression test pinning the full set.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Felix RiestraandClaude Sonnet 5 committed 2026-09-10 11:24:30 +02:00
1 parent 3d0a41b69a
commit 9f7972ee0d
7 files changed
+97 -1

No files matched your search

+40
View File
@@ -2445,3 +2445,43 @@ pub fn all_registered_command_names() -> Vec<&'static str> {
.flat_map(|r| r.names.iter().copied())
.collect()
}
#[cfg(test)]
mod constraint_registry_tests {
use super::*;
/// Regression guard: the whole `src/modules/draw/constrain/` family
/// (17 command ids, every one of the geometric/dimensional constraint
/// commands) predated `inventory::submit!` and was invisible to
/// command-line autocomplete and the MCP `commands` listing —
/// `docs/command_reference.md`'s own generator flagged this. Each
/// constraint module now registers itself; this pins that so the gap
/// can't silently reappear (e.g. a new constraint command added
/// without its own registration).
#[test]
fn every_constraint_command_is_in_the_autocomplete_registry() {
let names = all_registered_command_names();
for id in [
"CCONSTRAINT",
"EDCONSTRAINT",
"CPCONSTRAINT",
"MPCONSTRAINT",
"OCCONSTRAINT",
"HCONSTRAINT",
"VCONSTRAINT",
"PCONSTRAINT",
"QCONSTRAINT",
"ECONSTRAINT",
"TCONSTRAINT",
"NCONSTRAINT",
"NRCONSTRAINT",
"LCONSTRAINT",
"FXCONSTRAINT",
"SYCONSTRAINT",
"DCONSTRAINT",
"ACONSTRAINT",
] {
assert!(names.contains(&id), "{id} is missing from the command registry");
}
}
}