Repository navigation
feat: [2271] Dashboard data store - Test harness for reading from the store - #2272
Conversation
cstns
left a comment
There was a problem hiding this comment.
Nice harness. I broke data.js a few ways and it catches merge, ui_update, point limit, filter, clear and has() changes easily.
One gap worth closing before the next PR leans on it: aliasing bugs pass untouched. Making get() return the live stored object, or saving an array without cloning, still gives 315 passing, since nothing mutates an object after handing it over or reading it back. Reading from the proxy store is exactly where that kind of bug would show up (onChange in ui_base mutates what datastore.get() returns), so a step that mutates the returned object and compares again might be worth adding.
Optional: client scoped saving is only covered by the one handwritten scenario (removing that check fails 1 of 315), so adding a scoped widget to generate() could help. And hasExtraProps is copied from ui_base rather than required, so it could drift.
…ts, and move hasExtraProps to utils
|
@cstns thanks - made these changes:
|
Description
First of three PRs that move reads onto the data store (#2239). The store has only ever received copies of what the legacy datastore works out, so there's no way yet to prove it behaves the same. This adds the test harness that will.
A copy of today's legacy datastore acts as the reference, and sequences of datastore calls modeled on every core widget are run through both and compared after every step. After each step the harness also mutates what it passed in and what
get()returned, then compares again, so a datastore that keeps or hands out its own objects fails. This PR proves the harness catches breakage; the next one uses it to check the store.The only production change moves
hasExtraPropsfromui_base.jsintonodes/utilsso the harness uses the real one rather than a copy. Behaviour is unchanged.Test plan
data.jsmatches the reference after every step of all 315 sequences, including after the input and the returned value are mutateddata.jsfails the harness: merge,ui_updatestripping, point limit, filter, clear,has(), client scoping, and cloning on save, append orgetRelated Issue(s)
Resolves #2271
Checklist
flowforge.yml?FlowFuse/helmto update ConfigMap TemplateFlowFuse/CloudProjectto update values for Staging/ProductionLabels
area:migrationlabel