diff --git a/.specstory/history/2025-11-10_16-59Z-change-compression-method-to-7z.md b/.specstory/history/2025-11-10_16-59Z-change-compression-method-to-7z.md index f0ecc9b..e1ce95d 100644 --- a/.specstory/history/2025-11-10_16-59Z-change-compression-method-to-7z.md +++ b/.specstory/history/2025-11-10_16-59Z-change-compression-method-to-7z.md @@ -19134,7 +19134,6 @@ _**Agent (model default, mode Agent)**_ --- - The issue: `UpdateSequences.bat` is in `Renders\04 Securing Your Seam\`, so going up one level (`%script_dir%..`) gives `Renders\` instead of the project root. Checking the batch file logic: @@ -19160,7 +19159,6 @@ The issue: `UpdateSequences.bat` is in `Renders\04 Securing Your Seam\`, so goin --- - The issue: `UpdateSequences.bat` is in `Renders\04 Securing Your Seam\`, so going up one level (`..`) gives `Renders\` instead of the project root. `ZipSeqArchv.bat` works because it's directly in `Renders\`. Updating `UpdateSequences.bat` to go up two levels to reach the project root: @@ -19193,7 +19191,6 @@ Lines added: 1, lines removed: 1 --- - Fixed. `UpdateSequences.bat` is in subdirectories like `Renders\04 Securing Your Seam\`, so it needs to go up two levels to reach the project root, not one. The script now goes up two levels (`..\..`) to find `P:\250827_FestivalTurf\.config\config.json`. @@ -19202,3 +19199,205 @@ Redeploy with `ConfigLoader.ps1` to update all `UpdateSequences.bat` files in th --- +_**User (2025-11-11 19:15Z)**_ + +@2025-11-11_01-50Z-update-configloader-to-overwrite-gitattributes-and-gitignore.md we pulled some changes from home. the zipper is removing all non-7z archives, but it's not replacing them with new 7z archives. We need the zips to be kept if their metadata is still consistent, and only replaced with 7z if the metadata are not consistent. + +--- + +_**Agent (model default, mode Agent)**_ + + + +--- + + + +--- + + +Checking the upgrade logic from `.zip` to `.7z` to ensure `.zip` files are only replaced when metadata changes: + + +--- + + +
Tool use: **read_file** • Read file: zip_sequences.py + +
+
+ +--- + + + +--- + + +Checking the `zip_sequence` function for `.zip` deletion logic: + + +--- + + +
Tool use: **read_file** • Read file: zip_sequences.py + +
+
+ +--- + + + +--- + + +Fixing the logic: when a `.zip` exists, `.7z` doesn't, and metadata matches, keep the `.zip` and don't create a `.7z`. Updating the code: + + +--- + + +
Tool use: **read_file** • Read file: zip_sequences.py + +
+
+ +--- + + + +--- + + +Fixing the logic: when a `.zip` exists, `.7z` doesn't, and metadata matches, keep the `.zip` and don't create a `.7z`. Updating the code: + + +--- + + + +
Tool use: **code_edit** • Edit file: zip_sequences.py + +**Chunk 1** +Lines added: 3, lines removed: 2 + +```diff +@@ -650,14 +650,15 @@ + # Check if we need to upgrade from .zip to .7z + old_zip_path = None ++ old_stored_state = None + if ZIPPER_TYPE == "7z": + old_zip_path = zip_path.with_suffix(".zip") + if old_zip_path.exists(): + old_state_path = state_path_for(old_zip_path) + old_stored_state = load_state(old_state_path) +- # If old .zip exists and archive doesn't, we'll check state later ++ # If old .zip exists and .7z doesn't, use old .zip's state for comparison + if not zip_path.exists() and old_stored_state is not None: + stored_state = old_stored_state + +- # If archive exists and we have stored state, do quick check before computing full state ++ # If .7z archive exists and we have stored state, do quick check before computing full state + if zip_path.exists() and stored_state is not None: + # Quick check: if directory mtime is older than archive, likely unchanged +``` + +**Chunk 2** +Lines added: 1, lines removed: 1 + +```diff +@@ -667,5 +668,5 @@ + # If directory wasn't modified since archive was created, skip state computation + if dir_mtime <= archive_mtime: +- # Still need to check for old .zip cleanup ++ # Still need to check for old .zip cleanup (we have .7z, so .zip is obsolete) + if old_zip_path and old_zip_path.exists(): + old_zip_path.unlink(missing_ok=True) +``` + +**Chunk 3** +Lines added: 15, lines removed: 7 + +```diff +@@ -685,11 +686,19 @@ + # Check if state changed + if stored_state is not None and not state_changed(seq_state, stored_state): +- # Target archive is up to date, but we might still need to clean up old .zip +- if old_zip_path and old_zip_path.exists(): +- old_zip_path.unlink(missing_ok=True) +- old_state_path = state_path_for(old_zip_path) +- if old_state_path.exists(): +- old_state_path.unlink(missing_ok=True) +- continue ++ # Metadata matches stored state ++ if zip_path.exists(): ++ # .7z exists and is up to date, clean up old .zip if it exists ++ if old_zip_path and old_zip_path.exists(): ++ old_zip_path.unlink(missing_ok=True) ++ old_state_path = state_path_for(old_zip_path) ++ if old_state_path.exists(): ++ old_state_path.unlink(missing_ok=True) ++ elif old_zip_path and old_zip_path.exists() and old_stored_state is not None: ++ # .7z doesn't exist, but .zip exists and metadata matches ++ # Keep the .zip file, don't create .7z ++ continue ++ else: ++ # No archive exists, but state matches (shouldn't happen, but be safe) ++ continue + + work_items.append((seq_dir, zip_path, state_path, seq_state)) +``` + +
+ +
+ +--- + + + +--- + + +Checking for linting errors: + + +--- + + +
+ Tool use: **read_lints** • Read lints for 1 file + +Lint paths: + +- `zip_sequences.py` + +Lint results + + +**No lint errors found** +
+
+ +--- + + + +--- + + +Fixed the logic. The script now: + +1. **Keeps `.zip` files when metadata matches**: If a `.zip` exists, no `.7z` exists, and the metadata matches the current state, it keeps the `.zip` and does not create a `.7z`. + +2. **Only replaces `.zip` with `.7z` when metadata changes**: If the metadata doesn't match (files have changed), it creates a new `.7z` and deletes the old `.zip`. + +3. **Cleans up obsolete `.zip` files**: If a `.7z` already exists and is up-to-date, it deletes any old `.zip` files. + +The key change is on lines 696-699: when a `.zip` exists, no `.7z` exists, and the metadata matches, the script skips creating a `.7z` and keeps the `.zip` file. + +This ensures that `.zip` files are only replaced with `.7z` when the files have actually changed, not just because the script is running. + +--- + diff --git a/zip_sequences.py b/zip_sequences.py index a4b6580..4ae7101 100644 --- a/zip_sequences.py +++ b/zip_sequences.py @@ -649,16 +649,17 @@ def run_zip(requested_workers: int | None, *, verbose: bool) -> int: # Check if we need to upgrade from .zip to .7z old_zip_path = None + old_stored_state = None if ZIPPER_TYPE == "7z": old_zip_path = zip_path.with_suffix(".zip") if old_zip_path.exists(): old_state_path = state_path_for(old_zip_path) old_stored_state = load_state(old_state_path) - # If old .zip exists and archive doesn't, we'll check state later + # If old .zip exists and .7z doesn't, use old .zip's state for comparison if not zip_path.exists() and old_stored_state is not None: stored_state = old_stored_state - # If archive exists and we have stored state, do quick check before computing full state + # If .7z archive exists and we have stored state, do quick check before computing full state if zip_path.exists() and stored_state is not None: # Quick check: if directory mtime is older than archive, likely unchanged try: @@ -666,7 +667,7 @@ def run_zip(requested_workers: int | None, *, verbose: bool) -> int: archive_mtime = zip_path.stat().st_mtime_ns # If directory wasn't modified since archive was created, skip state computation if dir_mtime <= archive_mtime: - # Still need to check for old .zip cleanup + # Still need to check for old .zip cleanup (we have .7z, so .zip is obsolete) if old_zip_path and old_zip_path.exists(): old_zip_path.unlink(missing_ok=True) old_state_path = state_path_for(old_zip_path) @@ -684,13 +685,21 @@ def run_zip(requested_workers: int | None, *, verbose: bool) -> int: # Check if state changed if stored_state is not None and not state_changed(seq_state, stored_state): - # Target archive is up to date, but we might still need to clean up old .zip - if old_zip_path and old_zip_path.exists(): - old_zip_path.unlink(missing_ok=True) - old_state_path = state_path_for(old_zip_path) - if old_state_path.exists(): - old_state_path.unlink(missing_ok=True) - continue + # Metadata matches stored state + if zip_path.exists(): + # .7z exists and is up to date, clean up old .zip if it exists + if old_zip_path and old_zip_path.exists(): + old_zip_path.unlink(missing_ok=True) + old_state_path = state_path_for(old_zip_path) + if old_state_path.exists(): + old_state_path.unlink(missing_ok=True) + elif old_zip_path and old_zip_path.exists() and old_stored_state is not None: + # .7z doesn't exist, but .zip exists and metadata matches + # Keep the .zip file, don't create .7z + continue + else: + # No archive exists, but state matches (shouldn't happen, but be safe) + continue work_items.append((seq_dir, zip_path, state_path, seq_state))