fix(model): render DataModelPath via squash presentation#3673
Merged
Conversation
…ested Diagnostic.squash
The previous `[Diagnostic.value]` getter returned `Diagnostic.squash(result)` —
a wrapper diagnostic. The log formatter's `valueFor` only does a single-level
unwrap, so the squash wrapper made it past extraction but its inner items array
did not. The renderer's `case "squash"` then fell through to `serialize(...)`,
emitting `"{}"` for any DataModelPath wrapped in `Diagnostic.strong(...)`. This
broke Write/Invoke client diagnostics introduced earlier on this branch.
Fix by setting `[Diagnostic.presentation] = "squash"` directly on DataModelPath
and returning the items array from `[Diagnostic.value]`. The renderer now
unwraps the items array on the first pass and concatenates segments correctly.
Adds a render-level regression test that exercises the formatter chain.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes how DataModelPath renders through the diagnostic/log formatting chain so interaction paths no longer show up as {} in client-side Write/Invoke logs, aligning with the unified path logging introduced in #3664.
Changes:
- Set
DataModelPath[Diagnostic.presentation]to"squash"directly and return the raw items array fromDataModelPath[Diagnostic.value]to avoid nested diagnostic wrappers. - Add a regression test that exercises the real
Diagnostic.message→LogFormat.formats.plainformatter chain to ensure paths render inline correctly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/model/src/common/DataModelPath.ts | Adjusts diagnostic presentation/value so DataModelPath formats as a squashed sequence of segments without leaking wrapper objects into serialization. |
| packages/protocol/test/common/ExpandedPathTest.ts | Adds a formatter-chain regression test to prevent DataModelPath rendering regressions (e.g., {} output). |
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.
Summary
Follow-up to #3664. Client-side
WriteandInvokelog lines were rendering the path segment as\{}`(e.g.Write » @1:2•30d4 {} = "value"`).DataModelPath.[Diagnostic.value]returnedDiagnostic.squash(result)— a wrapper diagnostic. The log formatter'svalueForonly does a single-level unwrap, so the squash wrapper made it past extraction but its inner items array did not. The renderer'scase "squash"then fell through toserialize(...), emitting"{}"for anyDataModelPathwrapped inDiagnostic.strong(...).Fixed by setting
[Diagnostic.presentation] = "squash"directly onDataModelPathand returning the items array from[Diagnostic.value]. The renderer now unwraps the items array on the first pass and concatenates segments correctly.Adds a render-level regression test exercising the actual formatter chain.
Test plan
npm test -- -p packages/protocol(671 tests)npm test -- -p packages/node(935 tests)npm test -- -p packages/model(426 tests)npm run format-verifyDiagnostic renderingtest inExpandedPathTest.tsasserts onLogFormat.formats.plainoutput🤖 Generated with Claude Code