patch: Graceful error when project type has no manifest support (closes #50)#51
Merged
Conversation
Closes #50. Before this change, running `fips-agents patch check`, `patch <category>`, or `patch all` against a project whose template type is not in the built-in category set (today: sandbox) AND does not ship a .fips-template.yaml manifest produced a Python traceback ending in ValueError. The user has no idea what went wrong. This change introduces a sentinel exception `PatchUnsupportedForProjectType`, raised by `_resolve_categories` when the manifest is unusable AND `get_categories_for_type` raises. Each CLI entry point catches it and emits a single-line ✗ message that explains: - the project type isn't patchable; - the template needs to ship a .fips-template.yaml manifest; - link to issue #45 for the schema. Three call sites updated: - `patch check` wraps `check_for_updates` and exits 1. - `patch_category` (used by every `patch <category>`) defers the pre-clone fast-fail when there's no built-in category set, then catches `PatchUnsupportedForProjectType` post-clone and returns `(False, message)` so the existing red ✗ rendering kicks in. - `patch all` wraps the pre-clone `get_available_categories` call and exits 1 with the clean message. Tests cover the new exception (4 unit cases) and end-to-end CLI behavior against a fake sandbox project — `patch check`, `patch chart`, and `patch all` all exit 1 with no traceback. A future-proofing test confirms that once the sandbox template ships its own manifest, `patch check` works against it without changes to the CLI. Assisted-by: Claude Code (Opus 4.7)
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.
Closes #50.
Before this change, running `fips-agents patch check`, `patch `, or `patch all` against a project whose template type is not in the built-in category set (today: sandbox) AND does not ship a `.fips-template.yaml` manifest produced a Python traceback ending in `ValueError`.
Fix
Sentinel exception `PatchUnsupportedForProjectType`, raised by `_resolve_categories` when the manifest is unusable AND `get_categories_for_type` raises. Three CLI entry points catch it and emit a single-line ✗ message:
```
$ fips-agents patch check
✗ Patching is not supported for project type 'sandbox'. The template repo
for this project type does not yet ship a .fips-template.yaml manifest, and
no built-in category set exists for it. See
#45 for the manifest
schema.
```
Same shape for `patch chart` and `patch all`. All exit 1.
Call site changes
Test plan
Out of scope