STEP: bound assembly traversal, name imports after a lone body

A visit budget stops shared sub-assemblies from growing exponentially (with
a test); the loose-solid pass gets its own budget. An Import feature is
named after the root product, else its only body, else the file. Restores
a test function closed off by the rebase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
This commit is contained in:
bherbruckandClaude Opus 5.5 committed 2026-10-07 21:01:04 +00:00
1 parent d224fde7d4
commit b8d0fcc8e2
4 files changed
+45 -2

No files matched your search

+4 -2
View File
@@ -61,8 +61,10 @@ pub fn step_import_feature(bytes: &[u8], file: &str) -> Result<StepFeature> {
.filter(|s| !s.trim().is_empty())
.unwrap_or_else(|| "Import".into());
let generic = |n: &str| n.trim().is_empty() || n.starts_with('(') || n.eq_ignore_ascii_case("import") || n.eq_ignore_ascii_case("unnamed");
let name = match imp.tree.as_slice() {
[root] if !generic(&root.name) => root.name.clone(),
// The root product's name; else the only body's name; else the file name.
let name = match (imp.tree.as_slice(), imp.bodies.as_slice()) {
([root], _) if !generic(&root.name) => root.name.clone(),
(_, [only]) if !generic(&only.name) => only.name.clone(),
_ => stem,
};
let file_name = std::path::Path::new(file).file_name().map(|s| s.to_string_lossy().to_string()).unwrap_or_else(|| file.to_string());