Add module removal report and remove-module command#171
Add module removal report and remove-module command#171yogthos merged 2 commits intokit-clj:masterfrom
Conversation
Implements the first phase of module removal (issue kit-clj#110) following maintainer guidance: persist installation manifests, generate human-readable removal reports, and auto-delete unchanged files while printing manual instructions for code injections. Key changes: - Enhanced install-log.edn to store detailed manifests (assets with SHA-256, injection descriptions, feature flags, timestamps) - Added removal-report, print-removal-report, and remove-module to public API - Added dependency checking to prevent removing modules that others depend on - Backward compatible with existing install-log.edn entries Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
There are a few minor issues that would be good to address here. There's a breaking change in The PR keeps installed-modules in the :refer list of api.clj (line 10-11 in the new code) but no longer calls it anywhere in api.clj. This is a dead import. There's a duplicate The PR marks track-installation as deprecated in the docstring and stops using it in api.clj, replacing it with build-installation-manifest + record-installation. However, it's still referred in the old code and it remains a macro that could be called by external consumers. Not necessarily wrong, but worth noting for eventual cleanup. I notice that build-installation-manifest is called after generator/generate writes assets. It then reads the files back from disk to compute SHA-256 hashes. This means the hash reflects what's on disk, which is correct for integrity checking. However, there's a subtle TOCTOU issue here if generate writes a file and then something modifies it before build-installation-manifest runs, the hash won't match the original generated content. In practice this is very unlikely but worth documenting. The The The PR adds opts to the destructuring: {:keys [ctx pending-modules installed-modules opts]}. However, installation-plan (line 94-102) already returns :opts in its result map, so this is correct. The issue is that the outer opts parameter shadows the destructured opts, which was intentional (to get the flat version), but could be confusing. Overall this is solid work with good test coverage and backward compatibility handling. The main concerns are the duplicate slurp-bytes, the dead import, and the potential for delete-file to throw on a missing file. |
Fix issues raised in PR kit-clj#171 review: remove duplicate slurp-bytes from generator.clj, remove dead installed-modules import from api.clj, use silent delete-file variant, log warning on dependency resolution errors, avoid opts shadowing, add installed-modules-log as separate function, and track missing files in removal report. Add 16 new tests covering sha256, installed-modules return type, module-manifest retrieval, describe-injection-for-removal branches, immediate-dependents, and missing file detection in removal reports. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks for the thorough review! All actionable items have been addressed in 4152a22: Fixed:
New tests (16 total):
All 35 tests pass (113 assertions, 0 failures). |
|
Thanks for the clean up. I'll try push out a new release in the near future. |
Summary
Implements the first phase of module removal (closes #110) following maintainer guidance from the issue discussion:
install-modulenow persists a detailed manifest per module — assets with SHA-256 checksums, injection descriptions, feature flags, and timestampsremoval-report/print-removal-report: Generates human-readable removal instructions. For files created by the module, compares current SHA-256 against the stored hash to determine if auto-deletion is safe. For code injections, prints what to manually removeremove-module: Auto-deletes unchanged files, prints manual steps for injections, checks reverse dependencies (with:force?and:dry?options)install-log.ednentries (bare:success/:failedkeywords) continue to work; removal reports degrade gracefully without SHA comparisonExample usage
Files changed
modules_log.cljrecord-installation,module-manifest,untrack-moduleapi.cljremoval-report,print-removal-report,remove-module; refactoredinstall-moduleto persist manifestsdependencies.cljimmediate-dependentsfor reverse dependency checkinggenerator.cljslurp-byteshelperproject.clj,generator_test.cljmodule-installed?helpersremoval_test.cljTest plan
install-modulecreates detailed manifest in install-log.ednremove-moduleauto-deletes unchanged files and cleans install log:force?overrides dependency check:dry?prints report without making changes🤖 Generated with Claude Code