[fix] Make uninstallDependency idempotent, matching installDependency - #96
Merged
Conversation
installDependency() already treats "dependency already added at this
version" as a no-op success. uninstallDependency() treated the mirror
case ("not currently a dependency") as an error instead - an
asymmetry flagged in an internal spec-compliance audit. Removing a
dependency that's already gone reaches the same requested end state
as a successful removal, so it should succeed the same way most
package managers treat "already removed"/"already installed": as
idempotent success, not failure.
uninstallDependency() now mirrors installDependency()'s no-op pattern
(log, mark installed, return the file unchanged) instead of throwing.
Updated specification.md's Install/Uninstall dependency logic sections
to describe idempotent success for both cases instead of "return
error".
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
installDependency()already treats "dependency already added at this version" as a no-op success.uninstallDependency()treated the mirror case ("not currently a dependency") as an error instead — an asymmetry flagged in an internal spec-compliance audit.uninstallDependency()now mirrorsinstallDependency()'s no-op pattern (log, markinstalled, return the file unchanged) instead of throwing.specification.md's Install/Uninstall dependency logic sections to describe idempotent success for both cases instead of "return error".Test plan
npm run checkpasses (format, lint, build, tests — 193/193)installDependency/uninstallDependencya second time each, asserting idempotent success (same result, no throw) instead of an error🤖 Generated with Claude Code