Skip to content

fix(model): render DataModelPath via squash presentation#3673

Merged
Apollon77 merged 1 commit intomainfrom
fix/datamodelpath-squash-render
Apr 29, 2026
Merged

fix(model): render DataModelPath via squash presentation#3673
Apollon77 merged 1 commit intomainfrom
fix/datamodelpath-squash-render

Conversation

@Apollon77
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #3664. Client-side Write and Invoke log lines were rendering the path segment as \{}`(e.g.Write » @1:2•30d4 {} = "value"`).

DataModelPath.[Diagnostic.value] 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(...).

Fixed 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 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-verify
  • New Diagnostic rendering test in ExpandedPathTest.ts asserts on LogFormat.formats.plain output
  • Smoke-test in matter-server / matter-shell to confirm Write/Invoke client logs render path correctly on real devices

🤖 Generated with Claude Code

…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>
Copilot AI review requested due to automatic review settings April 29, 2026 07:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 from DataModelPath[Diagnostic.value] to avoid nested diagnostic wrappers.
  • Add a regression test that exercises the real Diagnostic.messageLogFormat.formats.plain formatter 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).

@Apollon77 Apollon77 merged commit 5cfede6 into main Apr 29, 2026
41 checks passed
@Apollon77 Apollon77 deleted the fix/datamodelpath-squash-render branch April 29, 2026 08:23
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