feat(widget-config): always offer "Any" data source option#207
Conversation
Code review — feat(widget-config): always offer "Any" data source optionScope: Reviewers: correctness, testing, maintainability, project-standards (4 always-on; no conditional personas — small diff, no auth/API/reliability/data-mutation surface). P2 — should fix before merge
P3 — discretionary
Coverage
Verdict: Ready with fixes — address #1 (regression), #2 (lint policy), #3 (coverage), and #4 (consistency). #5/#6 are advisory. |
The Data Source dropdown offered a literal "default" only when a path had a single source, and dropped it entirely once a second source appeared — even resetting a saved "default" selection. That hid the most useful option (server-merged, priority-following, failover-capable value) exactly when multiple sources make it valuable. Always list "Any" (the stored 'default' value) first, with concrete sources below, regardless of source count. A fresh path defaults to "Any"; an existing selection is preserved. Applies to both the widget path source and the data-chart source. Stored config value stays 'default'; "Any" is only the display label, so no migration is needed. Closes #203 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fa1e8ee to
155cd12
Compare
Review findings addressedFolded into the branch (amended, force-pushed) rather than a follow-up commit, since each fix revises code the same commit introduced.
Also added a regression test for #1 that drives the public Advisory, not changed:
Verification: |
Why
In widget configuration, the Data Source dropdown behaved inconsistently depending on how many sources currently published a path:
default.defaultvanished entirely; only concrete source keys were offered, and a saveddefaultselection was silently reset (inpath-control-config), forcing the user to re-pick a concrete source.That hid
defaultexactly when it matters most. At the data layer,source === 'default'reads the server's merged, priority-selected value (data.service.tssubscribePath) — it follows Signal K source priority and automatically fails over between sources (e.g. two GPS units, one drops, the value keeps flowing). "Accept data from any source" is its actual behavior, and that's most useful with multiple sources.Closes #203.
What
'default'value) first, with concrete sources below, regardless of source count.default) is preserved — no more silent reset when a path gains a second source.path-control-config) and data-chart series (dataset-chart-options).'default'→ "Any"; the stored config value stays'default', so no migration and full back-compat with existing widgets.Verification
npm run lint— clean.npm run build:prod— succeeds (pre-existingpiexifjsCommonJS warning only).path-control-config.component.spec.ts— 5 passeddataset-chart-options.component.spec.ts— 4 passed