Add unit tests for the MCP prompt and tool zod schemas
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- testing
Research direction
Start in lib/assistant.js and find how loadMCP() registers the explain_flow prompt and predict_next tool; then inspect the existing test setup for its in-process client. Add the accepted and rejected input cases listed in the issue, checking rejection without asserting error wording. Done when the tests catch the reported schema-key regression and pass with zod 3.25.x and 4.x.
Written by the indexing model from the issue text.
Description
Description
The explain_flow prompt and predict_next tool schemas in lib/assistant.js have no unit test coverage. A broken schema key went unnoticed because CI stayed green: [z.string()]: z.any() in the predict_next sourceNode schema creates a literal "[object Object]" key, which became required under zod 4 and made every call fail (fixed in #456).
Proposal
Add tests that call the registered prompt and tool through the in-process client returned by loadMCP():
predict_nextaccepted: minimalsourceNode,sourceNodewith extra properties, with and withoutflow,sourcePort0 and above.predict_nextrejected: missingsourceNode, missing or non-stringid,flowitem withoutid, non-numbersourcePort.explain_flowaccepted: a valid node array, and the 23 and 100000 character bounds.explain_flowrejected: missingnodes, not starting with[or ending with], 22 and 100001 characters.- Wording: assert on rejection, not on error message text, so tests survive zod major upgrades.
Acceptance
Tests fail when a key like the one in #456 is reintroduced, and pass on both zod 3.25.x and 4.x.
- Dominant language
- JavaScript
- Stars
- 6
- Forks
- 5
- Avg merge
- 1d 5m
- Merged PRs (30d)
- 29
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FlowFuse/nr-assistant
-
task
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
FlowFuse/nr-assistant#457 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 80/100
FlowFuse/nr-assistant#422 ·
Maintainers usually reply within 1 day
-
area:ff-expert task
Difficulty 1/5 Under an hour Newbie friendliness 65/100
FlowFuse/nr-assistant#76 ·
Maintainers usually reply within 1 day
-
Add manual retry to assistant completionsPossibly taken @Steve-Mcl claimed this 5 days ago. Open
FlowFuse/nr-assistant#467 · 2 assignees ·
Maintainers usually reply within 1 day
-
MCP test gapOpentask
Difficulty 4/5 3-5 days Newbie friendliness 48/100
FlowFuse/nr-assistant#423 ·
Maintainers usually reply within 1 day
All issues in FlowFuse/nr-assistant
Similar issues
-
🐛 bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
LibreChat-AI/LibreChat#17887 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
liveshowy/webauthn_components#118 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
showdownjs/showdown#1113 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
dependents/node-precinct#167 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
volumio/volumio-plugins-sources-bookworm#279 · 1 comment ·
Maintainers usually reply within 1 day