Skip to content

fix(ui): handle null wildcard_value in formatWithTemplate#460

Merged
streamer45 merged 1 commit into
mainfrom
devin/1778957950-fix-null-wildcard
May 17, 2026
Merged

fix(ui): handle null wildcard_value in formatWithTemplate#460
streamer45 merged 1 commit into
mainfrom
devin/1778957950-fix-null-wildcard

Conversation

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

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

Summary

Fixes #443.

formatWithTemplate had a guard wildcard !== undefined && wildcard !== null that incorrectly excluded null-valued wildcards. The server registry uses null as a valid wildcard value for RawVideo, EncodedVideo, EncodedAudio, and Custom fields. When a field's value matched the wildcard, it should display as * but was showing the literal string "null".

Changed the guard to 'wildcard_value' in rule, matching the approach already used by canConnectPair in the same file.

Updated the corresponding test to expect 'Raw Video (*x*, Rgba8)' instead of the previous buggy 'Raw Video (nullxnull, Rgba8)'.

Review & Testing Checklist for Human

  • Verify that packet types with null wildcard fields (RawVideo, EncodedVideo, EncodedAudio, Custom) now render * instead of "null" in the pipeline editor UI
  • Confirm no regressions in pin compatibility display for non-null wildcard fields

Notes

Two-line code fix + test assertion update. The canConnectPair function in the same file already handled this correctly.

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


Devin Review

Status Commit
🕐 Outdated 0e17ec6 (HEAD is cea6991)

Run Devin Review

Open in Devin Review (Staging)

@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 and CI monitoring

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.91%. Comparing base (fad6274) to head (cea6991).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #460      +/-   ##
==========================================
- Coverage   65.91%   65.91%   -0.01%     
==========================================
  Files         217      217              
  Lines       57530    57529       -1     
  Branches     1597     1597              
==========================================
- Hits        37922    37921       -1     
  Misses      19602    19602              
  Partials        6        6              
Flag Coverage Δ
backend 64.99% <ø> (ø)
ui 75.07% <100.00%> (-0.01%) ⬇️

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

Components Coverage Δ
core 84.29% <ø> (ø)
engine 75.71% <ø> (ø)
api 84.73% <ø> (ø)
nodes 67.41% <ø> (ø)
server 57.16% <ø> (ø)
plugin-native 70.93% <ø> (ø)
plugin-wasm 6.37% <ø> (ø)
ui-services 74.73% <ø> (ø)
ui-components 60.49% <ø> (ø)
Files with missing lines Coverage Δ
ui/src/utils/packetTypes.ts 90.96% <100.00%> (-0.06%) ⬇️
🚀 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 1 potential issue.

Open in Devin Review (Staging)
Debug

Playground

Comment on lines +39 to +40
if (rule && 'wildcard_value' in rule) {
isWildcard = deepEqual(value, rule.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.

🟡 Null wildcards render as * even when the template did not request wildcard display

formatWithTemplate now treats any field rule that has wildcard_value: null as display-wildcarded, but the replacement callback still ignores whether the placeholder was written as {field|*} or plain {field}. The packet metadata contract says the |* suffix is what indicates wildcard display (crates/core/src/packet_meta.rs:46-48), so server/plugin metadata that includes a nullable wildcard field in a normal {field} placeholder will now render * instead of the literal field value. The built-in RawVideo dimensions happen to use {width|*}/{height|*}, but this shared formatter no longer honors the template syntax for null wildcards.

Suggested change
if (rule && 'wildcard_value' in rule) {
isWildcard = deepEqual(value, rule.wildcard_value);
if (rule && 'wildcard_value' in rule && _m.includes('|*')) {
isWildcard = deepEqual(value, rule.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.

Not a regression — the old code also never checked the |* capture group. The pre-existing regex (\|\*)? captures it but neither the old nor the new code uses it.

In practice this doesn't affect any current type: all fields with wildcard_value: null that appear in templates already use {field|*} (width, height, sample_rate, channels). Fields with null wildcards that don't use |* (codec_private, bitstream_format, profile, level) aren't referenced in any template.

Honoring |* would be a valid hardening for future extensibility but is a separate concern from fixing the null-exclusion bug. Happy to add it in a follow-up if the maintainer wants it.

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.

Filed #463 to track the |* suffix check as a follow-up.

The guard `wildcard !== undefined && wildcard !== null` incorrectly
excluded null-valued wildcards used by RawVideo, EncodedVideo,
EncodedAudio, and Custom fields. Use `'wildcard_value' in rule`
instead, matching the approach already used by `canConnectPair`.

Closes #443

Signed-off-by: Staging-Devin AI <166158716+staging-devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
@staging-devin-ai-integration staging-devin-ai-integration Bot force-pushed the devin/1778957950-fix-null-wildcard branch from d0a94a5 to cea6991 Compare May 17, 2026 18:11
@streamer45 streamer45 merged commit 45febdb into main May 17, 2026
25 checks passed
@streamer45 streamer45 deleted the devin/1778957950-fix-null-wildcard branch May 17, 2026 18:31
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.

ui: formatWithTemplate ignores null wildcard_value, rendering RawVideo wildcards as 'null' instead of '*'

1 participant