Skip to content

Add tests across the packages, and fix what they found - #7

Merged
phatshambler merged 3 commits into
developfrom
test/coverage
Nov 17, 2026
Merged

phatshambler merged 3 commits into
developfrom
test/coverage

Conversation

@phatshambler

@phatshambler phatshambler commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Adds tests across the packages, a CI job for the MySQL store, and the fixes for the bugs the tests found, including the MySQL store's missing columns. It sits on #6: merge #6 first, then this one goes to develop.

Tests

From 82 to 147 tests (Node 24, with MySQL). Each new test was checked against a deliberate break of the code it covers (11 mutations, all caught but one that doesn't change behaviour).

  • @cuecue/app: the lifecycle (start, cue/uncue, stop and start again in the same session, end and a new session, reset, commands its state doesn't allow), the commands sent to outputs (cues, start, state, cue, uncue, end), the recovery of a started session and its cue from the store, define(), cues kept apart per session, interactions (ids, updates, ties to a cue with interaction: true, resetInteractions), inputs (validateCommand, inputCommands, transformCommand, removeInput). MemoryStore.
  • @cuecue/core: BasePlugin's lifecycle and events, BaseInput, the store parsers.
  • @cuecue/http: every API route (/cues, /cues/current, /cues/:id, /cues/:id/interactions, /cues/define, /uncue, /interactions with and without X-User-Id, /session/*, /app/state, /export/*.json and .csv), and HttpOutput's requests (method, headers, transformMessage, cancelled and refused commands).
  • @cuecue/osc: OscInput and OscOutput over UDP with node-osc: paths and commands, transformCommand (with several messages), acceptCommand, the arguments OSC can't carry.
  • @cuecue/socketio: ClientOutput → ServerInput and ServerOutput → ClientInput on real ports, commands.
  • @cuecue/store-mysql: against a real MySQL when MYSQL_TEST_* are set: items by id, matching, soft deletes, JSON data, and an application from start to end. CI runs them in a new job on MySQL 8.4, after the migrations. Locally, they ran on a throwaway MySQL 26.10.

Bugs found and fixed

  • A missing cue put the app in the cued state, and told the outputs so: the state machine doesn't cancel a transition when an async hook returns false. cue() now checks the cue first.

  • resetInteractions() deleted nothing with the memory store: it matched externalId, MySQL's column. It matches id, which the MySQL store maps to externalId.

  • GET /interactions with X-User-Id always returned []: getInteractionsByUser() matched a userId that interactions don't have, and getInteractionsByInteractionId() an interactionId. Both match the interaction's id, which is the user's with POST /interactions.

  • POST /cues/define with an array of cues defined the array as one cue. It takes an array or a single cue.

  • The MySQL store only stored the columns of its migrations: a cue with interaction, duration or after_duration failed with "Unknown column", and interactions had no cueId, so getInteractionsByCue() failed too. A new migration (20261117120000-extra.js) adds a JSON extra column to sessions, cues and interactions. The store reads each table's columns once (SHOW COLUMNS), keeps the other fields of an item in extra, gives them back as fields of the item, updates them with JSON_MERGE_PATCH, and finds items by them with JSON_EXTRACT. Without the migration, it says to run it. Apps on MySQL need to run the migrations (npm run migrate:up -w @cuecue/store-mysql); the migration goes down cleanly.

Checks

npm run format:check, npm run lint, npm run build, npm test: 147 tests on Node 24 with MySQL; 131 pass and 16 are skipped (Pingpong and MySQL) on Node 22. Changesets: fix-cues-and-interactions.md, mysql-extra-column.md.

🤖 Generated with Claude Code

phatshambler and others added 3 commits November 17, 2026 10:46
- Cueing a cue that doesn't exist no longer puts the app in the cued state
- resetInteractions() deletes interactions with the memory store too
- getInteractionsByUser() and getInteractionsByInteractionId() look
  interactions up by id: GET /interactions with X-User-Id found none
- POST /cues/define takes an array of cues

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- app: lifecycle, sessions and their recovery, cues, define, interactions,
  inputs; MemoryStore
- core: BasePlugin, BaseInput, store parsers
- http: every API route, HttpOutput requests
- osc and socketio: inputs and outputs over real ports
- store-mysql: against a real MySQL when MYSQL_TEST_* are set, run in CI on
  MySQL 8.4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A migration adds a JSON extra column to sessions, cues and interactions.
The store reads each table's columns once, keeps the other fields of an
item in extra, merges them back on read, and looks items up by them with
JSON_EXTRACT (an interaction's cueId). Cues with interaction, duration or
after_duration failed with "Unknown column", and getInteractionsByCue()
did too. Without the migration, the store says to run it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@phatshambler
phatshambler changed the base branch from fix/cli-osc-output to develop November 17, 2026 15:53
@phatshambler
phatshambler merged commit 21a2b16 into develop Nov 17, 2026
4 checks passed
@phatshambler
phatshambler deleted the test/coverage branch November 17, 2026 18:45
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.

1 participant