feat(installer): implement uninstall, fix update components on MacOS - #663
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches📝 Generate docstrings
Comment |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
scripts/install.sh (1)
379-388: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider a shared helper for the record row format.
The 4-column tab-delimited
printfused to write a record row is duplicated at the skip path (388) and the fresh-install path (428). This format is the uninstaller's sole contract (R7.3/R7.4), so keeping both writers in sync matters; a small helper removes the duplication risk.♻️ Proposed refactor
+write_record() { + printf '%s\t%s\t%s\t%s\n' "$1" "$2" "$3" "$4" >>"$records" +} + ... - printf '%s\t%s\t%s\t%s\n' "$comp" "$target_file" "$want" "$on_disk" >>"$records" + write_record "$comp" "$target_file" "$want" "$on_disk" ... - printf '%s\t%s\t%s\t%s\n' "$comp" "$target_file" "$want" "$(sha256 "$target_file")" >>"$records" + write_record "$comp" "$target_file" "$want" "$(sha256 "$target_file")"Also applies to: 425-428
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/install.sh` around lines 379 - 388, The 4-column tab-delimited record row format is duplicated between the skip path and the fresh-install path, so centralize it behind a shared helper in scripts/install.sh. Add a small helper used by the existing up-to-date branch and the install branch to emit the record row, keeping the uninstaller contract consistent and preventing the two `printf` call sites from drifting out of sync.scripts/install_test.sh (1)
429-440: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winMissing coverage for
--purgecombined with a kept (unremoved) entry.All purge scenarios here (
u5_plain/u5_purge) have a fully-clean footprint (no modified/foreign files), so they don't exercise the case wherekept_modified/kept_foreign> 0 and--purgeis also passed — exactly the scenario in thescripts/install.shdo_uninstallreview comment where the retained install record gets wiped by the purge step. Worth adding a scenario: seed an install, replace a recordedbinfile with a directory (foreign) or leave a modified file with--forceomitted, then run--uninstall --purge, and assert the record's fate matches intended behavior once the fix above lands.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/install_test.sh` around lines 429 - 440, Add coverage for the `--uninstall --purge` path when some install-record entries are intentionally kept, since the current `u5_plain`/`u5_purge` cases only cover fully clean trees. In `scripts/install_test.sh`, extend the `u5_install`/`u5_plain`/`u5_purge` flow with a scenario that introduces a kept entry such as a modified or foreign `bin` target, then runs `--uninstall --purge` and asserts the expected record and cache-tree outcome. Reference the `u5_plain`, `u5_purge`, and `run` helpers so the new test clearly exercises the `do_uninstall` behavior under kept entries.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/specs/07-spec-installer/07-spec-installer.md`:
- Around line 515-521: R8.2 currently says --purge removes the resolved state
tree in full, but that conflicts with the install-record retention rule from
R8.1 when kept_modified or kept_foreign entries remain. Update the R8.2 wording
in the spec to add an explicit carve-out for the state directory/record so purge
does not delete the inventory that was intentionally retained, and make the
exception consistent with the existing R8.1 and Design Considerations language.
In `@scripts/install.sh`:
- Around line 228-241: The --purge cleanup in install.sh is deleting the
retained install record by removing the entire state tree even when
kept_modified or kept_foreign caused the record to be preserved earlier. Update
the purge loop to avoid blindly purging resolve_prefix("state") when a record
must be retained, and keep the record-teardown logic in sync with the purge path
so the inventory remains available for later --force or manual cleanup. Use the
existing uninstall_purge block and the kept_modified/kept_foreign
record-retention flow to decide whether state should be skipped or handled
separately.
- Around line 243-260: The uninstall cleanup in install.sh prunes directories
via the bin/data/state/cache loop, but nothing reports which ones were actually
removed, so R8.4’s summary is incomplete. Update the uninstall path around the
rmdir loop and the final say summary to track pruned directories and include
that information in the reported outcome, using the existing uninstall flow
symbols like resolve_prefix, rmdir, say, and the removed/absent/kept counters.
---
Nitpick comments:
In `@scripts/install_test.sh`:
- Around line 429-440: Add coverage for the `--uninstall --purge` path when some
install-record entries are intentionally kept, since the current
`u5_plain`/`u5_purge` cases only cover fully clean trees. In
`scripts/install_test.sh`, extend the `u5_install`/`u5_plain`/`u5_purge` flow
with a scenario that introduces a kept entry such as a modified or foreign `bin`
target, then runs `--uninstall --purge` and asserts the expected record and
cache-tree outcome. Reference the `u5_plain`, `u5_purge`, and `run` helpers so
the new test clearly exercises the `do_uninstall` behavior under kept entries.
In `@scripts/install.sh`:
- Around line 379-388: The 4-column tab-delimited record row format is
duplicated between the skip path and the fresh-install path, so centralize it
behind a shared helper in scripts/install.sh. Add a small helper used by the
existing up-to-date branch and the install branch to emit the record row,
keeping the uninstaller contract consistent and preventing the two `printf` call
sites from drifting out of sync.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: acc98772-e329-4e53-bd21-15f4ac70e166
📒 Files selected for processing (3)
docs/specs/07-spec-installer/07-spec-installer.mdscripts/install.shscripts/install_test.sh
--uninstallSummary by CodeRabbit
New Features
--uninstallmode to the installer.--force,--purge, and--dry-runduring uninstall.Bug Fixes