Implement 0080 PromptGroup arity enforcement#228
Open
chris-colinsky wants to merge 1 commit into
Open
Conversation
PromptGroup already rejected fewer than two members, but with a bare ValueError that pydantic folds into a ValidationError carrying no error category, so the conformance harness had nothing to assert against. Add a categorized PromptGroupInvalid (new prompt_group_invalid category) and raise it from the arity validator. Because PromptGroupInvalid is a PromptError and not a ValueError, pydantic propagates it unwrapped from the model validator, so the caller sees .category. It is non-transient and exported from openarmature.prompts. Wire the rejection fixture 035: make PromptManagementFixture.backends optional (035 is cases-only with per-case backends, one case needing none) and rework the cases-runner to build per-case backends when a case declares its own backends key (else share the top-level, so 016 is unchanged) and to run a manager-less case's direct-target calls instead of skipping them (the empty-group construct needs no manager). Update the two arity unit tests, the concepts/prompts doc, and the 0.17.0 changelog entry.
There was a problem hiding this comment.
Pull request overview
Implements spec proposal 0080 behavior in the Python prompt-management layer by turning PromptGroup arity rejection into a categorized, surfaced PromptError (so conformance can assert on .category) and updating the conformance harness to run the newly-enabled fixture shape.
Changes:
- Add
PromptGroupInvalid/prompt_group_invalidcategory and raise it fromPromptGroupconstruction whenmembers < 2. - Un-defer prompt-management fixture 035 by making conformance fixtures support cases-only shapes with per-case backends and manager-less cases.
- Update unit tests, docs, proposal status metadata, and changelog to reflect the new categorized behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_prompts.py | Updates unit tests to expect PromptGroupInvalid and assert .category. |
| tests/conformance/test_prompt_management.py | Enables fixture 035 by supporting per-case backends and running manager-less case calls. |
| tests/conformance/harness/prompt_management.py | Makes PromptManagementFixture.backends optional via an empty-list default for cases-only fixtures. |
| src/openarmature/prompts/group.py | Raises PromptGroupInvalid (instead of ValueError) from the arity validator. |
| src/openarmature/prompts/errors.py | Adds PROMPT_GROUP_INVALID and PromptGroupInvalid with the canonical category string. |
| src/openarmature/prompts/init.py | Exports PROMPT_GROUP_INVALID and PromptGroupInvalid from openarmature.prompts. |
| docs/concepts/prompts.md | Documents the new construction-time PromptGroupInvalid behavior. |
| conformance.toml | Marks proposal 0080 as implemented since 0.17.0 and records rationale. |
| CHANGELOG.md | Adds a 0.17.0 entry describing PromptGroup arity enforcement and the new categorized error. |
Comment on lines
52
to
58
| assert PromptNotFound.category == "prompt_not_found" | ||
| assert PromptRenderError.category == "prompt_render_error" | ||
| assert PromptStoreUnavailable.category == "prompt_store_unavailable" | ||
| assert PromptGroupInvalid.category == "prompt_group_invalid" | ||
| assert PROMPT_NOT_FOUND == "prompt_not_found" | ||
| assert PROMPT_RENDER_ERROR == "prompt_render_error" | ||
| assert PROMPT_STORE_UNAVAILABLE == "prompt_store_unavailable" |
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.
Phase A of the v0.17.0 cycle (proposal 0080, prompt-management §10 / §11, spec v0.75.0). Closes Phase A Wave 1 (0087, 0086, 0080).
PromptGroupalready rejected fewer than two members, but as a bareValueErrorthat pydantic folds into aValidationErrorcarrying no error category, so the conformance harness had nothing to assert against. This makes the rejection a categorized error.Behavior
PromptGroupInvaliderror (newprompt_group_invalidcategory, prompt-management §11), raised from the arity validator at construction, before any render or LLM call.PromptGroupInvalidis aPromptErrorand not aValueError, pydantic propagates it unwrapped from the model validator, so the caller sees.category.PROMPT_TRANSIENT_CATEGORIES) and exported fromopenarmature.prompts.Conformance
Un-defers rejection fixture 035. Two harness changes carry its shape:
PromptManagementFixture.backendsis now optional (035 is cases-only with per-case backends, one case needing none).backendskey (else shares the top-level, so fixture 016 is unchanged) and runs a manager-less case's direct-target calls instead of skipping them (035's empty-groupconstruct_prompt_groupneeds no manager).Tests / docs
The two existing arity unit tests now expect
PromptGroupInvalidand assert.category; the category-map test covers it too. Fixture 035 (single-member + empty group) drives the end-to-end rejection. Docs name the error inconcepts/prompts.md; new 0080 entry under## [0.17.0].Reviewed with
/reviewand/adversarial-review(the cross-file check confirmed nosrc/code catchesValueErroraround group construction, so the raised-type change is safe). Full suite green.