From b59b82813cf484f02cf8b9ad281f548600912f2d Mon Sep 17 00:00:00 2001 From: Manfred Riem <15701806+mnriem@users.noreply.github.com> Date: Mon, 23 Mar 2026 15:15:28 -0500 Subject: [PATCH] fix: only delete manifest when full tracked set was processed When remove_tracked_files is called with an explicit files dict (subset), skip manifest deletion to avoid losing tracking of entries not in the subset. Manifest cleanup only runs when the full set is read from the manifest itself (files=None). --- src/specify_cli/agent_pack.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/specify_cli/agent_pack.py b/src/specify_cli/agent_pack.py index d77404bf2..c84e8f372 100644 --- a/src/specify_cli/agent_pack.py +++ b/src/specify_cli/agent_pack.py @@ -695,11 +695,12 @@ def remove_tracked_files( abs_path.unlink() removed.append(rel_path) - # Clean up the install manifest only when no tracked files remain - # on disk. Files already deleted by the user count as gone, not - # as "remaining" — only files that still exist and were skipped - # (e.g. modified without --force) prevent manifest cleanup. - if manifest_file.is_file(): + # Clean up the install manifest only when the full tracked set was + # processed (i.e. read from the manifest itself). When an explicit + # ``files`` dict is provided the caller may be passing a subset + # (e.g. only agent_files), so deleting the manifest could lose + # tracking of entries not in the subset. + if files is None and manifest_file.is_file(): still_on_disk = sum( 1 for rel_path in entries if (project_path / rel_path).is_file()