Skip to content

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
claude/refactor-describe-type-yOsvC
Feb 12, 2026

Conversation

@TimothyJones
Copy link
Member

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

claude and others added 6 commits February 8, 2026 05:02
…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
@TimothyJones TimothyJones changed the title Refactor describe type to return structured DescribeSegment instead of string 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 Feb 12, 2026
@TimothyJones TimothyJones enabled auto-merge (squash) February 12, 2026 13:36
@TimothyJones TimothyJones merged commit de9546b into main Feb 12, 2026
14 checks passed
@TimothyJones TimothyJones deleted the claude/refactor-describe-type-yOsvC branch February 12, 2026 13:42
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