Add glob-style wildcard support for Data Extractor item keys#3206
Add glob-style wildcard support for Data Extractor item keys#3206
Conversation
Replace ad-hoc key.split('__') + positional index access with an immutable StreamingKey value object. This centralizes the parsing logic for streaming key strings (DECOM__TLM__INST__PARAMS__VALUE1__CONVERTED, etc.) and makes field access self-documenting via named attributes.
- Add StreamingKey Data.define with .parse and #to_key_string
- Refactor StreamingObject#initialize to delegate parsing to StreamingKey
- Refactor StreamingApi#build_item_collection and #expand_all_packets
- Replace redundant object.key.split in LoggedStreamingThread#stream_items with direct attribute access
- Add streaming_key_spec.rb with 22 unit tests
Add support for glob patterns (*, ?, []) in Data Extractor packet and item name fields, allowing users to select multiple items with a single entry (e.g., TEMP* matches TEMP1, TEMP2, TEMP3). Backend: - Add StreamingKey#has_glob? to detect wildcard characters in key fields - Add StreamingApi#expand_item_globs to expand glob patterns into concrete item keys before streaming, supporting: - Item globs on a specific packet (HEALTH_STATUS/TEMP*) - Packet globs with concrete or glob items (HEALTH*/TEMP*) - LATEST + item globs (LATEST/TEMP*) - Wire expand_item_globs into add() and remove() flows Frontend: - Add allowGlob prop to TargetPacketItemChooser that switches packet and item selectors from v-autocomplete to v-combobox for free-text entry of glob patterns - Enable allow-glob on the Data Extractor chooser - Add keyMap fallback in buildHeaders() and createFile() so glob-expanded keys decode correctly
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3206 +/- ##
==========================================
+ Coverage 78.33% 78.36% +0.03%
==========================================
Files 674 675 +1
Lines 55402 55531 +129
Branches 728 728
==========================================
+ Hits 43401 43519 +118
- Misses 11923 11934 +11
Partials 78 78
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…lobs Remove unused local variable from destructuring to resolve code quality finding.
Use explicit RuntimeError class instead of raising a string literal, remove unnecessary regex escape characters, and add Angular-style commit message generator command. Co-Authored-By: Claude noreply@anthropic.com
Move require_relative statements before OpenC3.require_file calls to satisfy SonarCloud import ordering rule. Revert explicit RuntimeError class since raise already defaults to it. Co-Authored-By: Claude noreply@anthropic.com
|
Make wildcard/glob support opt-in via a checkbox in the Mode menu instead of always-on. Fix v-combobox returning full item objects instead of value strings in TargetPacketItemChooser. Add root justfile with dev server commands for all UI plugins. Co-Authored-By: Claude noreply@anthropic.com
…d off Watch the allowGlob prop and reset packet/item fields containing glob characters when wildcards are disabled, preventing stale wildcard patterns from being submitted. Add Ruby justfile for openc3/ core development commands. Co-Authored-By: Claude noreply@anthropic.com
Validate packet name against known packets before making get_tlm calls when Allow Wildcards is enabled. Prevents 500 errors from partial text input like "H" being sent as a packet name. Co-Authored-By: Claude noreply@anthropic.com
I made the change and then it complained about a redundant exception |
…oser Collapse multiline arrow functions onto single lines to satisfy the prettier/prettier eslint rule. Co-Authored-By: Claude noreply@anthropic.com
Add lint, lint-fix, lint-all, and lint-fix-all recipes to the root justfile. Document the requirement to run pnpm lint after editing Vue/JS files in CLAUDE.md. Fix prettier formatting for long find callback in TargetPacketItemChooser. Co-Authored-By: Claude noreply@anthropic.com
…ation Extract repeated patterns from expand_all_packets and expand_item_globs into reusable private helpers and StreamingKey methods to bring SonarCloud duplication under the 3% threshold. Co-Authored-By: Claude noreply@anthropic.com
ryan-pratt
left a comment
There was a problem hiding this comment.
Looks fine, just not sure if we need to add a feature item to the backlog re my comment on the API calls
| # This file may also be used under the terms of a commercial license | ||
| # if purchased from OpenC3, Inc. | ||
|
|
||
| StreamingKey = Data.define(:stream_mode, :cmd_or_tlm, :target_name, :packet_name, :item_name, :value_type, :reduced_type) do |
There was a problem hiding this comment.
Nice, this is a good refactor
| if (value !== null) { | ||
| this.updatePacketDetails(value) | ||
| if (this.allowGlob && typeof value === 'string') { | ||
| // In glob mode, only call the API if the value matches a known packet |
There was a problem hiding this comment.
The API calls get important info e.g. whether a command is hazardous. I don't really understand the ux for using a glob for commands, so maybe this is fine as-is, but we might want to add the ability in the API to check for hazardous commands matched by a glob.
There was a problem hiding this comment.
That's a good point it's safe today because allowGlob defaults to false on the prop, so tools have to explicitly opt in and only Data Extractor is setting to true. I will add
globEnabled: function () {
return this.allowGlob && this.mode === 'tlm'
}
to make sure the mode is only telemetry.
When glob mode is active, free-text packet names skip the updatePacketDetails API call where hazardous command metadata is fetched. Gate glob behind mode === 'tlm' so command tools can never bypass hazardous checks. Co-Authored-By: Claude noreply@anthropic.com
|







Summary
*,?,[]) for packet and item names in the Data Extractor, allowing users to add multiple items with a single entry*— matches any number of characters. TEMP* matches TEMP1, TEMP2, TEMP_ANYTHING?— matches exactly one character. TEMP? matches TEMP1, TEMP2 but not TEMP10 or TEMP[]— matches one character from a set. TEMP[13] matches TEMP1 and TEMP3 but not TEMP2allowGlobprop onTargetPacketItemChooserChanges
StreamingKey— addhas_glob?methodStreamingApi— addexpand_item_globs(), wired intoadd()andremove()TargetPacketItemChooser— newallowGlobprop switches packet/item selectors tov-comboboxDataExtractor.vue— enableallow-glob, addkeyMapfallback for expanded keyshas_glob?andexpand_item_globsTest plan
cd openc3-cosmos-cmd-tlm-api && OPENC3_DEVEL=../openc3 bundle exec rspec spec/models/streaming_key_spec.rb spec/models/streaming_api_spec.rbTEMP*in the item field, click Add Item, process — verify all matching TEMP items appear in the outputHEALTH*as packet,*as item — verify all items from matching packets streamTEMP*— verify expansion worksUsing
justjust build-deps-force && just dev-data-extractorCloses #2973