aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-registry/src/installer_executor/filesystem.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-02 17:40:07 +0900
committernsfisis <nsfisis@gmail.com>2026-05-02 17:40:07 +0900
commit16e856a20307a3ca20524d96ea13348db7f2cffd (patch)
tree5a054afdd608bc39856fe0ff3a9cac2fda980cf7 /crates/mozart-registry/src/installer_executor/filesystem.rs
parent99a33b951502d3e80eb70f53551413b9dc0f4d6c (diff)
downloadphp-mozart-16e856a20307a3ca20524d96ea13348db7f2cffd.tar.gz
php-mozart-16e856a20307a3ca20524d96ea13348db7f2cffd.tar.zst
php-mozart-16e856a20307a3ca20524d96ea13348db7f2cffd.zip
feat(installer): add trace recorder and topo install order
Adds TraceRecorderExecutor (Composer's InstallationManagerMock analog), which records every install/update/uninstall as a string matching Composer's *Operation::__toString output (after strip_tags) - the load-bearing assertion target for in-process fixture tests. Two changes were needed to make the recorder useful: - InstallerExecutor::uninstall_package gains a version parameter, and install_from_lock now looks up both the uninstall and the Update-from-version from installed.json. Previously the Update path passed the new version as a placeholder; the recorder needs the real old version to emit `Upgrading pkg (old => new)`. - compute_operations now topologically sorts the lock contents (deps before dependents) before computing actions, mirroring Composer's Transaction::calculateOperations. Without this, packages would install in alphabetical order and the trace would diverge from Composer's expectation. Also adds crates/mozart/tests/installer_in_process.rs with the in-process harness scaffold: parses the same .test fixtures, builds a tempdir, calls commands::install::run / update::run with an empty RepositorySet (no Packagist) and a TraceRecorderExecutor, then asserts exit code + EXPECT trace. One fixture wired up: suggest_replaced - the original CI failure that motivated this whole DI refactor. It now passes on the in-process path because the empty RepositorySet makes b/b unreachable just like Composer's `'packagist' => false` test config, and the resolver finds c/c (which replaces b/b) via the inline package repo's eager preload. Step F will migrate every fixture currently in installer.rs to the new harness; remaining divergences (alias handling, output ordering, replace trace shape, etc.) will surface as individual follow-ups. All 136 existing spawn-based fixtures + 114 mozart-registry tests + 541 mozart lib tests still green; clippy clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart-registry/src/installer_executor/filesystem.rs')
-rw-r--r--crates/mozart-registry/src/installer_executor/filesystem.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/mozart-registry/src/installer_executor/filesystem.rs b/crates/mozart-registry/src/installer_executor/filesystem.rs
index 82acc42..e36006c 100644
--- a/crates/mozart-registry/src/installer_executor/filesystem.rs
+++ b/crates/mozart-registry/src/installer_executor/filesystem.rs
@@ -81,7 +81,12 @@ impl InstallerExecutor for FilesystemExecutor {
Ok(())
}
- fn uninstall_package(&mut self, name: &str, ctx: &ExecuteContext) -> anyhow::Result<()> {
+ fn uninstall_package(
+ &mut self,
+ name: &str,
+ _version: &str,
+ ctx: &ExecuteContext,
+ ) -> anyhow::Result<()> {
let pkg_dir = ctx.vendor_dir.join(name);
if pkg_dir.exists() {
std::fs::remove_dir_all(&pkg_dir)?;