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
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
All notable changes to chainsaw are documented here. Each release corresponds to a
[milestone](https://github.com/rocketman-code/chainsaw/milestones?state=closed) on GitHub.

## [0.4.1] - 2026-02-27

Packaging fixes, Linux performance, cross-platform file watching.

### Added

- jemalloc as global allocator on Linux, reducing cold-build syscalls ~100x vs musl ([#178])

### Fixed

- REPL file watching silently degraded on Linux -- only macOS FSEvents backend was compiled ([#176])
- `tempfile` crate shipped in production binary despite being test-only ([#176])
- Bare `.unwrap()` calls in production code now document their invariants via `expect()` ([#176])

## [0.4.0] - 2026-02-22

Structured output layer, REPL polish, file watching.
Expand Down Expand Up @@ -168,6 +182,7 @@ First publish. Dependency graph analysis for TypeScript/JavaScript and Python.
- Python: C extension loader precedence matching CPython
- `--chain`/`--cut` when target is the entry point itself ([#69])

[0.4.1]: https://github.com/rocketman-code/chainsaw/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/rocketman-code/chainsaw/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/rocketman-code/chainsaw/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/rocketman-code/chainsaw/compare/819d7f1...v0.2.0
Expand Down Expand Up @@ -266,3 +281,5 @@ First publish. Dependency graph analysis for TypeScript/JavaScript and Python.
[#172]: https://github.com/rocketman-code/chainsaw/issues/172
[#173]: https://github.com/rocketman-code/chainsaw/pull/173
[#174]: https://github.com/rocketman-code/chainsaw/pull/174
[#176]: https://github.com/rocketman-code/chainsaw/issues/176
[#178]: https://github.com/rocketman-code/chainsaw/issues/178
54 changes: 27 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ tree-sitter = "0.24"
tree-sitter-python = "0.23"
crossbeam-queue = "0.3"
dashmap = "6"
tempfile = "3"
rustyline = "15"
gix = { version = "0.79.0", default-features = false, features = ["max-performance-safe"] }
notify = { version = "7", default-features = false, features = ["macos_fsevent"] }
notify = "7"

[target.'cfg(target_os = "linux")'.dependencies]
tikv-jemallocator = "0.6"
Expand All @@ -54,6 +53,7 @@ ignore = "0.4"
assert_cmd = "2"
predicates = "3"
proptest = "1"
tempfile = "3"

[[bench]]
name = "benchmarks"
Expand Down
17 changes: 12 additions & 5 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,13 @@ impl ParseCache {
if data.len() < HEADER_SIZE {
return Self::new();
}
let magic = u32::from_le_bytes(data[0..4].try_into().unwrap());
let version = u32::from_le_bytes(data[4..8].try_into().unwrap());
let magic = u32::from_le_bytes(data[0..4].try_into().expect("4-byte slice fits u32"));
let version = u32::from_le_bytes(data[4..8].try_into().expect("4-byte slice fits u32"));
if magic != CACHE_MAGIC || version != CACHE_VERSION {
return Self::new();
}
let graph_len = u64::from_le_bytes(data[8..16].try_into().unwrap()) as usize;
let graph_len =
u64::from_le_bytes(data[8..16].try_into().expect("8-byte slice fits u64")) as usize;
let graph_end = HEADER_SIZE + graph_len;
if data.len() < graph_end {
return Self::new();
Expand Down Expand Up @@ -288,7 +289,10 @@ impl ParseCache {
}

if changed_files.is_empty() {
let cached = self.cached_graph.take().unwrap();
let cached = self
.cached_graph
.take()
.expect("cached_graph populated by load");
return GraphCacheResult::Hit {
graph: cached.graph,
unresolvable_dynamic: cached.unresolvable_dynamic,
Expand All @@ -299,7 +303,10 @@ impl ParseCache {
}

// Files changed — extract graph and preserve mtimes for incremental save
let cached = self.cached_graph.take().unwrap();
let cached = self
.cached_graph
.take()
.expect("cached_graph populated by load");
self.stale_file_mtimes = Some(cached.file_mtimes);
self.stale_unresolved = Some(cached.unresolved_specifiers);
GraphCacheResult::Stale {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ fn save_snapshot(
sc: report::StderrColor,
) -> Result<(), Error> {
let snapshot = result.to_snapshot(entry_rel);
let data = serde_json::to_string_pretty(&snapshot).unwrap();
let data = serde_json::to_string_pretty(&snapshot).expect("snapshot serializes to JSON");
std::fs::write(path, &data).map_err(|e| Error::SnapshotWrite(path.to_path_buf(), e))?;
if !quiet {
eprintln!("{} to {}", sc.status("Snapshot saved"), path.display());
Expand Down
2 changes: 1 addition & 1 deletion src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ fn all_shortest_chains(
let mut capped = false;

for path in &partial_paths {
let &head = path.last().unwrap();
let &head = path.last().expect("partial paths are non-empty");
if head == entry {
next_partial.push(path.clone());
continue;
Expand Down
10 changes: 8 additions & 2 deletions src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,10 @@ fn dispatch_imports(session: &Session, path: &str, opts: &CommandOptions, sc: St
})
})
.collect();
println!("{}", serde_json::to_string_pretty(&entries).unwrap());
println!(
"{}",
serde_json::to_string_pretty(&entries).expect("entries serialize to JSON")
);
return;
}
if imports.is_empty() {
Expand Down Expand Up @@ -727,7 +730,10 @@ fn dispatch_importers(session: &Session, path: &str, opts: &CommandOptions, sc:
})
})
.collect();
println!("{}", serde_json::to_string_pretty(&entries).unwrap());
println!(
"{}",
serde_json::to_string_pretty(&entries).expect("entries serialize to JSON")
);
return;
}
if importers.is_empty() {
Expand Down
14 changes: 11 additions & 3 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ impl Session {
include_dynamic,
);
self.ensure_weights(include_dynamic);
let weights = &self.cached_weights.as_ref().unwrap().weights;
let weights = &self
.cached_weights
.as_ref()
.expect("ensure_weights populates cache")
.weights;
let cuts = query::find_cut_modules(
&self.graph,
&chains,
Expand Down Expand Up @@ -233,7 +237,7 @@ impl Session {
let snap_a = self
.cached_trace
.as_ref()
.unwrap()
.expect("ensure_trace populates cache")
.result
.to_snapshot(&self.entry_label());
let snap_b = query::trace(&self.graph, other_id, opts)
Expand Down Expand Up @@ -448,7 +452,11 @@ impl Session {
/// Trace and produce a display-ready report.
pub fn trace_report(&mut self, opts: &TraceOptions, top_modules: i32) -> TraceReport {
self.ensure_trace(opts);
let result = &self.cached_trace.as_ref().unwrap().result;
let result = &self
.cached_trace
.as_ref()
.expect("ensure_trace populates cache")
.result;
build_trace_report(
result,
&self.entry,
Expand Down
7 changes: 5 additions & 2 deletions src/walker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ fn concurrent_discover(
imports,
unresolvable_dynamic: result.unresolvable_dynamic,
};
results.lock().unwrap().push(file_result);
results
.lock()
.expect("results mutex not poisoned")
.push(file_result);

if active.fetch_sub(1, Ordering::AcqRel) == 1 {
// This was the last active item; all work is done
Expand All @@ -139,7 +142,7 @@ fn concurrent_discover(
}
});

let mut files = results.into_inner().unwrap();
let mut files = results.into_inner().expect("results mutex not poisoned");
files.par_sort_unstable_by(|a, b| a.path.cmp(&b.path));
let warnings = std::iter::from_fn(|| warnings.pop()).collect();
DiscoverResult { files, warnings }
Expand Down