Skip to content

feat: [2271] Dashboard data store - Test harness for reading from the store - #2272

Merged
n-lark merged 4 commits into
249-data-storefrom
2271-data-store-tests
Oct 9, 2026
Merged

n-lark merged 4 commits into
249-data-storefrom
2271-data-store-tests

Conversation

@n-lark

@n-lark n-lark commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

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 hasExtraProps from ui_base.js into nodes/utils so the harness uses the real one rather than a copy. Behaviour is unchanged.

Test plan

  • data.js matches the reference after every step of all 315 sequences, including after the input and the returned value are mutated
  • Deliberately breaking data.js fails the harness: merge, ui_update stripping, point limit, filter, clear, has(), client scoping, and cloning on save, append or get
  • A harness that runs no steps fails

Related Issue(s)

Resolves #2271

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@n-lark n-lark self-assigned this Oct 1, 2026
@n-lark
n-lark added this pull request to stack #2258 October 1, 2026 19:28
@n-lark n-lark mentioned this pull request Oct 1, 2026
3 of 14 tasks
@n-lark n-lark linked an issue Oct 1, 2026 that may be closed by this pull request
4 tasks done
@ppawlowski ppawlowski changed the title [2271] Dashboard data store - Test harness for reading from the store feat: [2271] Dashboard data store - Test harness for reading from the store Oct 5, 2026

@cstns cstns left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Base automatically changed from 2239-data-store-presentation-add-errors to 249-data-store October 9, 2026 14:19
@n-lark

n-lark commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@cstns thanks - made these changes:

  1. Each step now mutates the input and the value get() returns, then compares again. A live get() or a save or append that doesn't clone now fails.
  2. Added scoped widgets to generate(). Removing the client-scoped check now fails 201 runs instead of 1.
  3. Moved hasExtraProps to nodes/utils so the harness uses the real one.

@n-lark
n-lark merged commit fd45995 into main Oct 9, 2026
5 checks passed
@n-lark
n-lark deleted the 2271-data-store-tests branch October 9, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard data store - Test harness for reading from the store

2 participants