fix(bundler): let catalog remove delete a project source overriding a built-in - #4533
Open
jawwad-ali wants to merge 1 commit into
Open
fix(bundler): let catalog remove delete a project source overriding a built-in#4533jawwad-ali wants to merge 1 commit into
catalog remove delete a project source overriding a built-in#4533jawwad-ali wants to merge 1 commit into
Conversation
… a built-in
`remove_source` refused any built-in id before looking at what the project
config actually held:
if target in _BUILTIN_IDS:
raise BundlerError(
f"'{target}' is a built-in default source and cannot be deleted "
"(add a same-id source to override it instead)."
)
That message documents the override workflow -- and the same guard then made
the override permanent. Reproduced on main:
add_source -> OK (documented override). stored: ['community']
remove_source-> REFUSED: 'community' is a built-in default source and
cannot be deleted (add a same-id source to override it
instead).
STILL STORED : ['community']
The user could not undo their own project-scoped entry through the CLI at all;
the only way back was hand-editing the config the command exists to manage.
Now the built-in id is refused only when there is no project-scoped entry to
remove. Deleting the user's own entry simply restores the built-in default.
The existing CLI guard (tests/contract/test_bundle_cli.py
test_catalog_remove_builtin_is_refused) runs against a project with no such
entry and still passes unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <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.
Problem
remove_sourcerefuses any built-in id before looking at what the project config actually holds:The error message documents the supported override workflow — and the same guard then makes that override permanent.
Reproduction on current
main(c173bf1)The user follows the advice in the error message, then finds there is no CLI path back. The only remedy is hand-editing the very config file
bundle catalogexists to manage.Fix
Refuse a built-in id only when there is nothing project-scoped to remove:
A project-scoped entry is the user's own file and is theirs to delete; removing it simply restores the built-in default.
After the fix:
Verification
upstream/main→ passing with the fix.tests/contract/test_bundle_cli.py::test_catalog_remove_builtin_is_refusedruns against a project with no such entry and still passes unchanged — verified directly.tests/unit: 537 passed vs a clean-mainbaseline of 535 passed, with the same 2 pre-existing failures and none new.uvx ruff@0.15.0 check src tests→ cleanBehaviour change, disclosed: exactly one previously-failing input now succeeds —
catalog remove <builtin-id>when the project config genuinely contains an entry with that id. That is the defect being fixed. Nothing that previously succeeded changes.Written with assistance from Claude Code. Bug found, reproduced, and verified by me on current
main.🤖 Generated with Claude Code