Skip to content

Implement 0080 PromptGroup arity enforcement#228

Open
chris-colinsky wants to merge 1 commit into
mainfrom
feature/0080-prompt-group-arity
Open

Implement 0080 PromptGroup arity enforcement#228
chris-colinsky wants to merge 1 commit into
mainfrom
feature/0080-prompt-group-arity

Conversation

@chris-colinsky

Copy link
Copy Markdown
Member

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).

PromptGroup already rejected fewer than two members, but as a bare ValueError that pydantic folds into a ValidationError carrying no error category, so the conformance harness had nothing to assert against. This makes the rejection a categorized error.

Behavior

  • New PromptGroupInvalid error (new prompt_group_invalid category, prompt-management §11), raised from the arity validator at construction, before any render or LLM call.
  • Because PromptGroupInvalid is a PromptError and not a ValueError, pydantic propagates it unwrapped from the model validator, so the caller sees .category.
  • Non-transient (not in PROMPT_TRANSIENT_CATEGORIES) and exported from openarmature.prompts.

Conformance

Un-defers rejection fixture 035. Two harness changes carry its shape:

  • PromptManagementFixture.backends is now optional (035 is cases-only with per-case backends, one case needing none).
  • The cases-runner builds per-case backends when a case declares its own backends key (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-group construct_prompt_group needs no manager).

Tests / docs

The two existing arity unit tests now expect PromptGroupInvalid and 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 in concepts/prompts.md; new 0080 entry under ## [0.17.0].

Reviewed with /review and /adversarial-review (the cross-file check confirmed no src/ code catches ValueError around group construction, so the raised-type change is safe). Full suite green.

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.
Copilot AI review requested due to automatic review settings July 22, 2026 03:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_invalid category and raise it from PromptGroup construction when members < 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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants