fix(ui): handle null wildcard_value in formatWithTemplate#460
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| if (rule && 'wildcard_value' in rule) { | ||
| isWildcard = deepEqual(value, rule.wildcard_value); |
There was a problem hiding this comment.
🟡 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.
| 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); |
Was this helpful? React with 👍 or 👎 to provide feedback.
Debug
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
d0a94a5 to
cea6991
Compare
Summary
Fixes #443.
formatWithTemplatehad a guardwildcard !== undefined && wildcard !== nullthat incorrectly excludednull-valued wildcards. The server registry usesnullas 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 bycanConnectPairin 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
*instead of"null"in the pipeline editor UINotes
Two-line code fix + test assertion update. The
canConnectPairfunction in the same file already handled this correctly.Link to Devin session: https://staging.itsdev.in/sessions/13a4a8f5837b4c6fbfb42b2931249d3b
Requested by: @streamer45
Devin Review
0e17ec6(HEAD iscea6991)