refactor(plugin-dsl)!: Change describe type to return structured DescribeSegment instead of string. Plugin authors will need to use the new factory functions to implement their describe methods instead of returning a string. This allows structured rendering of the describe result#1246
Merged
TimothyJones merged 6 commits intomainfrom Feb 12, 2026
Merged
refactor(plugin-dsl)!: Change describe type to return structured DescribeSegment instead of string. Plugin authors will need to use the new factory functions to implement their describe methods instead of returning a string. This allows structured rendering of the describe result#1246TimothyJones merged 6 commits intomainfrom
describe type to return structured DescribeSegment instead of string. Plugin authors will need to use the new factory functions to implement their describe methods instead of returning a string. This allows structured rendering of the describe result#1246TimothyJones merged 6 commits intomainfrom
Conversation
…f string The matcher `describe` functions now return a `DescribeSegment` tree instead of a flat string. This enables richer formatting of nested descriptions with proper indentation, while maintaining backwards compatibility through the `renderToString` helper for contexts that need a flat string (e.g., matcher lookup keys). New types and helpers in case-plugin-base: - `DescribeSegment` union type with message, nested, concat, and join variants - `renderToString()` to flatten a segment tree to a string - `describeMessage()`, `describeNested()`, `describeConcat()`, `describeJoin()` convenience constructors Updated across all 28 matcher executors in case-core, case-core-plugin-http, and case-core-plugin-function, plus all test files and consumers. https://claude.ai/code/session_01MtqZWBEma1bYKgzLfbUkom
Instead of a single describeNested function that takes explicit bracket
strings ('{}', '[]', '()'), use semantic helper functions:
- describeObject(content) wraps content in curly braces
- describeArray(content) wraps content in square brackets
- The parentheses case in HttpResponseMatcher now uses describeConcat
with message segments directly
The DescribeSegment type now has 'object' and 'array' kinds instead of
a single 'nested' kind with a brackets field.
https://claude.ai/code/session_01MtqZWBEma1bYKgzLfbUkom
DescribeSegment was defined in executors.types.ts which imports from context/types.ts, and context/types.ts imported DescribeSegment back from executors.types.ts, creating a dependency cycle. Move the type definition to describe.ts (which has no internal imports) and have both files import from there. https://claude.ai/code/session_01MtqZWBEma1bYKgzLfbUkom
Instead of requiring callers to compose describeJoin and describeConcat
manually, describeObject now takes an array of {key, value} entries and
describeArray takes an array of child segments. The comma-joining and
key: value formatting is handled internally by renderToString.
This makes the call sites much cleaner - ShapedObjectExecutor and
ShapedArrayExecutor no longer need describeJoin.
https://claude.ai/code/session_01MtqZWBEma1bYKgzLfbUkom
describe type to return structured DescribeSegment instead of string. Plugin authors will need to use the new factory functions to implement their describe methods instead of returning a string. This allows structured rendering of the describe result
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.
The matcher
describefunctions now return aDescribeSegmenttree insteadof a flat string. This enables richer formatting of nested descriptions with
proper indentation, while maintaining backwards compatibility through the
renderToStringhelper for contexts that need a flat string (e.g., matcherlookup keys).
New types and helpers in case-plugin-base:
DescribeSegmentunion type with message, nested, concat, and join variantsrenderToString()to flatten a segment tree to a stringdescribeMessage(),describeNested(),describeConcat(),describeJoin()convenience constructors
Updated across all 28 matcher executors in case-core, case-core-plugin-http,
and case-core-plugin-function, plus all test files and consumers.
https://claude.ai/code/session_01MtqZWBEma1bYKgzLfbUkom