Repository navigation
fix(presets): reject malformed catalog entries before removal - #4992
Open
dlwlgnsrhy wants to merge 1 commit into
Open
dlwlgnsrhy wants to merge 1 commit into
dlwlgnsrhy wants to merge 1 commit into
Conversation
Validate each catalog entry before filtering so malformed configuration is reported without silently discarding entries or rewriting the original file. Add before/after regressions and valid-removal coverage. Assisted-by: Codex (model: GPT-6, autonomous)
dlwlgnsrhy
marked this pull request as ready for review
October 16, 2026 05:23
This branch has not been deployed
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.
Description
specify preset catalog remove <name>silently discards non-mapping configuration entries and interprets the shortened list as a successful removal. It can therefore rewrite a malformed file and report success even when the requested name does not exist.For example, with
.specify/preset-catalogs.ymlcontaining:specify preset catalog remove does-not-existon baselinef6e72bcexits 0, reports the nonexistent catalog as removed, and deletesbroken-entry. With this change, it reportsInvalid catalog entry at index 1: expected a mapping, got str, exits 1, and preserves the file byte-for-byte. Removing an existing name from the same malformed file is also rejected before any write.Validate all entries before filtering; use the same index/type error convention as the preset catalog loader. Valid removal behavior is unchanged. This is a constructed CLI reproduction, not a claim of an independently reported incident.
Testing
uv run specify --helpspecifyexecutable.venv/bin/python -m pytest tests -qFull run: 12,316 passed, 376 skipped, 11 failed in 710 seconds. The 11 failures were subprocess template-composition tests: the initial shell PATH did not include the project virtualenv, so child scripts selected the host Python, which has no PyYAML. Prepending this checkout's
.venv/binto PATH for the test process made all 11 previously failing cases pass (2.80 seconds), without any product-code changes. This was a targeted rerun, not a second full-suite run. No tests or assertions were disabled or weakened.Regression evidence on macOS arm64, Python 3.12.13, using the checkout's own environment after
uv sync --extra test:uvx ruff@0.15.0 check src testsandgit diff --checkpass.All execution above was performed by the agent; no human testing is claimed.
AI Disclosure
AI disclosure: Codex (GPT-6 family; exact deployment identifier and reasoning-effort setting unavailable), operating autonomously on behalf of @dlwlgnsrhy after the contributor selected and authorized the scope, investigated and reproduced the issue, authored the implementation and tests, ran validation, reviewed the diff, and drafted the commit message and this PR. No human authorship, testing, or line-by-line review is claimed. The commit carries an
Assisted-by:trailer.