feat(context): scenario taxonomy and request/response contract for adr_planning_context#21
Merged
Merged
Conversation
… for adr_planning_context Establishes the API design layer for scenario-aware context retrieval — the schema foundation that retrieval and rendering logic will build on. Introduces ContextScenario (4 scenarios), ChangeMode, and DetailLevel enums; ScopeHint, TargetRef, ContextRequest, ConstraintSummary, InspectReference, PacketMetadata, and ScenarioContextPacket Pydantic v2 models in adr_kit/context/models.py. Exports all 10 new types from the context package. Extends PlanningContextRequest with 5 backward-compatible optional scenario fields so existing callers require no changes. Validated by 41 new unit tests across two test files.
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.
Why
The
adr_planning_contextMCP tool currently accepts a free-textcontext_typefield, which gives callers no structured way to express what kind of planning scenario they are in. This PR establishes the typed API layer — scenario enum, request model, and response packet — that the retrieval and rendering logic will build on in subsequent items.Approach
Four named scenarios replace free-text
context_type:new_adr,amend_existing,replace_supersede, andexplore_options. Each maps to a projection of what context is relevant. The newContextScenario,ChangeMode, andDetailLevelenums, combined withContextRequestandScenarioContextPacketPydantic v2 models, form the contract hub.PlanningContextRequestgains five backward-compatible optional fields so no existing callers break — they continue working without changes. All ten new types are exported from the context package. The design favours progressive disclosure: callers can provide as little as a scenario name and get a useful response, or add scope hints and target refs for more precise projection.What Was Tested
PlanningContextRequestbackward-compatibility (all new fields optional with defaults, existing callers unaffected).Risks
Downstream callers using a free-text
context_typestring will eventually need to migrate to one of the four named scenarios once retrieval logic starts consuming the enum. No breakage today — the field remains backward-compatible — but migration will be required before the enum-driven retrieval is enabled.