Skip to content

fix(ui): check |* suffix before rendering wildcard in formatWithTemplate#512

Merged
streamer45 merged 3 commits into
mainfrom
devin/1779719251-fix-wildcard-template
May 26, 2026
Merged

fix(ui): check |* suffix before rendering wildcard in formatWithTemplate#512
streamer45 merged 3 commits into
mainfrom
devin/1779719251-fix-wildcard-template

Conversation

@staging-devin-ai-integration
Copy link
Copy Markdown
Contributor

@staging-devin-ai-integration staging-devin-ai-integration Bot commented May 25, 2026

Summary

  • formatWithTemplate captured the |* suffix via regex but never gated on it — any field with a wildcard_value rendered as * regardless of template syntax.
  • Now only {field|*} placeholders trigger wildcard rendering; plain {field} always shows the concrete value. Uses the regex capture group directly instead of a .includes() check.
  • Added two focused tests: one synthetic (mixed {field} / {field|*}) and one using the real RawVideo meta with pixel_format: null to document the user-facing regression.

Closes #463

Review & Validation

  • Verify the one-line condition change in formatWithTemplate (line 37: && star)
  • Confirm new tests would fail on the old code (revert the fix locally and run just test-ui)

Link to Devin session: https://staging.itsdev.in/sessions/f937c399d5244c269cfbe81e52072886
Requested by: @streamer45


Devin Review

Status Commit
🕐 Outdated f5a5fc3 (HEAD is e5e9b74)

Run Devin Review

Open in Devin Review (Staging)

The regex in formatWithTemplate captured the |* suffix but never
checked whether the placeholder actually included it, so any field
with a wildcard_value rendered as * regardless of the template syntax.

Now only placeholders written as {field|*} trigger wildcard rendering;
plain {field} placeholders always show the concrete value.

Signed-off-by: streamkit-devin <devin@streamkit.dev>
@staging-devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.38%. Comparing base (b2d01c2) to head (e5e9b74).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #512      +/-   ##
==========================================
- Coverage   79.39%   79.38%   -0.01%     
==========================================
  Files         232      232              
  Lines       66904    66904              
  Branches     1909     1909              
==========================================
- Hits        53117    53115       -2     
- Misses      13781    13783       +2     
  Partials        6        6              
Flag Coverage Δ
backend 79.11% <ø> (-0.01%) ⬇️
ui 82.06% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 85.27% <ø> (ø)
engine 83.59% <ø> (-0.10%) ⬇️
api 89.98% <ø> (ø)
nodes 75.33% <ø> (ø)
server 80.26% <ø> (ø)
plugin-native 83.47% <ø> (ø)
plugin-wasm 91.90% <ø> (ø)
ui-services 84.67% <ø> (ø)
ui-components 60.49% <ø> (ø)
Files with missing lines Coverage Δ
ui/src/utils/packetTypes.ts 90.96% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor Author

@staging-devin-ai-integration staging-devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 4 potential issues.

Open in Devin Review (Staging)
Debug

Playground

Comment thread ui/src/utils/packetTypes.test.ts Outdated
});

it('does not render wildcard when template placeholder omits |*', () => {
// Register a type whose template uses plain {width} (no |*) for a field with wildcard_value
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🟡 New tests add how-comments that repository rules explicitly forbid

AGENTS.md makes the comment guideline mandatory and lists “Line narration” plus “Diff-oriented comments” as comments not to write. The newly added test comments narrate exactly what the immediately following registry/test data does and explain this edit’s {field|*} behavior rather than a non-obvious constraint, so they violate that repository rule. The affected added comments are on ui/src/utils/packetTypes.test.ts:224, ui/src/utils/packetTypes.test.ts:241-242, and ui/src/utils/packetTypes.test.ts:250-251.

Suggested change
// Register a type whose template uses plain {width} (no |*) for a field with wildcard_value
Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed in 11841c3.

Comment thread ui/src/utils/packetTypes.test.ts Outdated
Comment on lines +241 to +242
// width=null matches wildcard_value but placeholder lacks |* — render literally
// height=null matches wildcard_value and placeholder has |* — render as *
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🟡 Additional wildcard test comments violate the no narration rule

AGENTS.md explicitly forbids comments that restate what the next lines do or explain the edit instead of a hidden constraint. These added comments describe that width=null/height=null match the wildcard and how {sample_format} differs from {sample_rate|*}, which is already expressed by the test setup and assertion, so they violate the repository’s mandatory comment rule.

Suggested change
// width=null matches wildcard_value but placeholder lacks |* — render literally
// height=null matches wildcard_value and placeholder has |* — render as *
Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed in 11841c3.

Comment thread ui/src/utils/packetTypes.test.ts Outdated
Comment on lines +250 to +251
// sample_rate=0 matches wildcard via {sample_rate|*}, but sample_format uses
// {sample_format} (no |*) so even a wildcard_value match renders literally
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🟡 Sample-rate wildcard test comments restate the assertion

The added comments above this assertion explain how the concrete values in the test are expected to render, which is directly visible from the input object and expected string. Because AGENTS.md explicitly forbids line narration and diff-oriented comments, these comments should not be added unless they explain a non-obvious constraint.

Suggested change
// sample_rate=0 matches wildcard via {sample_rate|*}, but sample_format uses
// {sample_format} (no |*) so even a wildcard_value match renders literally
Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed in 11841c3.

Comment thread ui/src/utils/packetTypes.ts Outdated
if (compat && compat.kind === 'structfieldwildcard') {
const rule = compat.fields.find((f) => f.name === field);
if (rule && 'wildcard_value' in rule) {
if (rule && 'wildcard_value' in rule && _m.includes('|*')) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

📝 Info: Wildcard display marker now has presentation-only semantics

The added _m.includes('|*') check means wildcard_value no longer automatically affects every placeholder in a template; it only affects placeholders explicitly marked with |*. That matches the metadata contract in crates/core/src/packet_meta.rs:38 and ui/src/types/generated/api-types.ts:147-150, while connection compatibility still uses wildcard_value without consulting the display template in ui/src/utils/packetTypes.ts:117-126 and crates/core/src/packet_meta.rs:225-249. I therefore did not flag the behavior change as a bug, but reviewers should be aware that new packet-type metadata must include |* anywhere the UI should render matching wildcard values as *.

Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Signed-off-by: streamkit-devin <devin@streamkit.dev>
- Thread the regex capture group as a callback arg instead of
  string .includes() on the full match.
- Drop two redundant tests already covered by existing assertions.
- Add a real-world regression test using the default RawVideo meta
  with pixel_format: null to document the user-facing fix.

Signed-off-by: streamkit-devin <devin@streamkit.dev>
@streamer45 streamer45 enabled auto-merge (squash) May 26, 2026 19:09
@streamer45 streamer45 merged commit 6bebdbb into main May 26, 2026
25 checks passed
@streamer45 streamer45 deleted the devin/1779719251-fix-wildcard-template branch May 26, 2026 19:14
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.

fix(ui): formatWithTemplate should honor |* template suffix for wildcard display

2 participants