Skip to content

Commit 90d0579

Browse files
HanSur94claude
andcommitted
feat: add functionSignatures.json for DashboardEngine editor tab-completion
Backward-compatible, additive: a new editor-metadata file with zero runtime effect — MATLAB reads it only for code completion, Octave ignores it. No existing signature, behavior, or serialization changes. Adds libs/Dashboard/functionSignatures.json covering the DashboardEngine constructor (Name + Theme/LiveInterval/InfoFile/ProgressMode/ ShowTimePanel) and addWidget. The addWidget `type` argument is modeled as a `choices` enum of all 19 built-in widget types, so the editor now suggests the valid types as the user types — surfacing the same list the run-1 unknown-type error lists, but at the point of entry. Common options (Position, Title, Tag, Label) are offered too. Proven: validateFunctionSignaturesJSON returns 0 messages (schema-valid; the optional positional Name uses the R2025b-required "ordered" kind, not the deprecated "optional"); runtime smoke confirms addWidget('number') still returns a NumberWidget and an unknown type still errors DashboardEngine:unknownType — the file is runtime-inert. No .m changed, so existing tests and examples are unaffected. Resolves audit finding F-3b. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8d7af2c commit 90d0579

2 files changed

Lines changed: 44 additions & 7 deletions

File tree

docs/.api-usability/audit-2026-06-24.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Friction was reproduced by running real code through the public API, not by read
1515
| Entry points with helpful "valid options" validation | DashboardEngine ctor ✅, attachPlantLog ✅, `addWidget` type ✅; Tag ctors ✅ (all six fixed) |
1616
| Confusing / dead-end errors (no recovery path) | **0** open (was 1) |
1717
| Methods that silently discard unknown options | **0** (was 4: addThreshold/Band/Marker/Shaded — now warn) |
18-
| Discoverability: `functionSignatures.json` for tab-completion | **present for FastSense** (ctor + add* + setScale); Dashboard/Tag pending |
18+
| Discoverability: `functionSignatures.json` for tab-completion | **FastSense** (ctor + add* + setScale) + **Dashboard** (ctor + addWidget type enum); Tag pending |
1919
| Lines-to-first-plot (example_basic) | ~4 (`FastSense``addLine``addThreshold``render`) — good |
2020

2121
## Findings (severity-ordered)
@@ -102,10 +102,22 @@ Friction was reproduced by running real code through the public API, not by read
102102
+ `run(fullfile(projectRoot,'install.m'))`. This is example-script bootstrap, not public-API
103103
friction, so it is informational only — no API change warranted.
104104

105+
### 🟢 F-3b — `DashboardEngine.addWidget` had no type tab-completion — ✅ RESOLVED (5th run)
106+
- **Fix (additive, new file — zero runtime change):** added `libs/Dashboard/functionSignatures.json`
107+
covering the `DashboardEngine` constructor (Name + Theme/LiveInterval/InfoFile/ProgressMode/
108+
ShowTimePanel) and `addWidget`, with the `type` argument modeled as a `choices` enum of all 19
109+
built-in widget types — so the editor now lists the valid types *as you type*, complementing the
110+
run-1 error-message fix at the point of entry. Common `addWidget` options (Position, Title, Tag,
111+
Label) are offered too.
112+
- **Proof:** `validateFunctionSignaturesJSON` returns **0 messages** (after switching the optional
113+
positional `Name` from the deprecated `"optional"` kind to `"ordered"`, which R2025b now requires);
114+
runtime smoke confirms `addWidget('number', ...)` still returns a `NumberWidget` and an unknown
115+
type still errors `DashboardEngine:unknownType` — the metadata file is runtime-inert.
116+
105117
## Next-worst additive finding for `/api-polish`
106-
**F-3b** — add `libs/Dashboard/functionSignatures.json` for `DashboardEngine.addWidget`, modeling the
107-
`type` argument as a `choices` enum of the registered widget types (derived from the same set
108-
`DashboardWidgetRegistry.types()` returns). This is the single highest-value completion: it surfaces
109-
the valid widget types *as the user types*, complementing the run-1 error-message fix. Purely
110-
additive (new file). After that, a Tag-constructor `functionSignatures.json` under
111-
`libs/SensorThreshold/`.
118+
**F-3c** — add `libs/SensorThreshold/functionSignatures.json` for the Tag constructors
119+
(`SensorTag`, `StateTag`, `MonitorTag`, `CompositeTag`, `DerivedTag`), completing the
120+
tab-completion coverage for the third core public surface. The valid name-value keys are already
121+
enumerated per class (from the run-2 work) — `Name`/`Units`/`Description`/`Labels`/`Metadata`/
122+
`Criticality`/`SourceRef` universals plus each class's extras (e.g. SensorTag `ID`/`Source`/`X`/`Y`,
123+
MonitorTag `MinDuration`/`Persist`/…). Purely additive (new file).
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"_schemaVersion": "1.0.0",
3+
4+
"DashboardEngine.DashboardEngine": {
5+
"inputs": [
6+
{"name": "Name", "kind": "ordered", "type": ["char"]},
7+
{"name": "Theme", "kind": "namevalue", "type": ["choices={'light','dark'}"]},
8+
{"name": "LiveInterval", "kind": "namevalue", "type": ["numeric", "scalar"]},
9+
{"name": "InfoFile", "kind": "namevalue", "type": ["char"]},
10+
{"name": "ProgressMode", "kind": "namevalue", "type": ["choices={'auto','on','off'}"]},
11+
{"name": "ShowTimePanel", "kind": "namevalue", "type": ["logical", "scalar"]}
12+
]
13+
},
14+
15+
"DashboardEngine.addWidget": {
16+
"inputs": [
17+
{"name": "obj", "kind": "required", "type": ["DashboardEngine"]},
18+
{"name": "type", "kind": "required", "type": ["choices={'barchart','chipbar','divider','fastsense','gauge','group','heatmap','histogram','iconcard','image','multistatus','number','rawaxes','scatter','sparkline','status','table','text','timeline'}"]},
19+
{"name": "Position", "kind": "namevalue", "type": ["numeric", "size=1,4"]},
20+
{"name": "Title", "kind": "namevalue", "type": ["char"]},
21+
{"name": "Tag", "kind": "namevalue"},
22+
{"name": "Label", "kind": "namevalue", "type": ["char"]}
23+
]
24+
}
25+
}

0 commit comments

Comments
 (0)