Skip to content

4.6.0: comments keep their place; renderComposer returns { setValue } - #12

Merged
travisccook merged 5 commits into
mainfrom
value-editor-4.6.0
Oct 2, 2026
Merged

travisccook merged 5 commits into
mainfrom
value-editor-4.6.0

Conversation

@travisccook

Copy link
Copy Markdown
Owner

DroidNet's WCB stored-command value field is becoming a native textarea that stays in step with the row's builder in both directions. That needs two library changes.

Engine

  • Comments keep their place. parseWCBValue turns a *** fragment after an empty segment (^^***) into a standalone note step instead of the previous step's label; buildWCBValue writes a note step that follows another step as ^^***text (a note first in the value stays ***text).
  • A comment parsed from a single ^ after a delay, a labelled step or another note is marked inline: true and written back with one ^, so A^***c^***d, ;t500^***wait and ***a^***b still rebuild byte for byte.
  • A comment directly after a command or raw step (^***) is still that step's label. The WCB skips empty segments and comments alike, so the firmware runs the same commands.
  • + Note after a step now writes ^^*** instead of ^*** (which read back as the step's label).

UI

  • renderComposer returns { setValue(value) }: a no-op when the value equals the compiled steps; otherwise it re-parses, cancels a step being edited in the add bar, and re-renders the step list, length and safety note, keeping a half-filled add bar. It never calls onChange. Callers that ignore the return value are unaffected.

Tests

  • test/comment-steps.test.js: standalone comment parse and build, and the round-trip list (inline comment, comment on its own line, comment first, two comment lines, comment after a delay, a builder note after a command).
  • test/ui-set-value.test.js (jsdom): the handle's no-op, re-render, Add bar kept, edit cancelled, no onChange. Adds jest-environment-jsdom@^29.7.0 as a dev dependency.
  • The catalog-example and fixture round trips still pass.

npm run validate clean; npm test green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TpbbHNL9m8Gw9PAjSjiW3C

travisccook and others added 5 commits October 2, 2026 13:05
A *** fragment after an empty segment (^^***) is now a standalone note step on
its own line instead of the previous step's label, and buildWCBValue writes a
note step that follows another step as ^^***text (a note first in the value
stays ***text). A comment parsed from a single ^ after a delay, a labelled
step or another note carries inline: true and is written back with one ^, so
those values rebuild byte for byte too. A comment directly after a command or
raw step (^***) is still that step's label. The WCB skips empty segments and
comments alike, so the firmware runs the same commands.

DroidNet's stored-command field writes these spellings; a builder action now
changes only the step it touches.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpbbHNL9m8Gw9PAjSjiW3C
setValue hands the composer a host's new value: it does nothing when the value
equals the compiled steps; otherwise it re-parses them, cancels a step being
edited in the add bar, and re-renders the step list, length and safety note,
keeping a half-filled add bar. It never calls onChange. Callers that ignore the
return value are unaffected.

The composer test runs under jsdom (jest-environment-jsdom 29, a dev
dependency; Jest 28+ ships it separately).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpbbHNL9m8Gw9PAjSjiW3C
A board-read value such as 4T3^^4T92 rebuilds as 4T3^4T92, so it never equals
compiled() and every setValue call re-renders the list, shows the rebuilt
length and cancels a step being edited, without calling onChange. DroidNet's
stored-command field relies on that, so lock it down. The first test fails if
setValue short-circuits on a value that parses to the same steps.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpbbHNL9m8Gw9PAjSjiW3C
The composer reset its edit state in five places. Three wrote all four fields,
and the two in moveStep and the remove handler left editLabel and editWasAuto
stale (harmless only because loadStepIntoAddBar resets both). cancelEdit() now
does the whole reset for Cancel, Update, removing the edited step, reordering
and setValue.

test/ui-edit-cancel.test.js covers the four exits besides setValue (Cancel,
Update, remove, reorder), which had no coverage: each returns to Add mode with
no step highlighted, and the next Insert appends.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpbbHNL9m8Gw9PAjSjiW3C
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Review summary (advisory)

Checks

  • npm ci: OK (npm audit reports 5 vulnerabilities in dev dependencies; not blocking).
  • npm run validate: PASS. Every board and the cross-file merged catalog show ✓. The only output besides ✓ lines is the non-standard-category warnings, which were already there.
  • npm test: PASS. 17 of 17 suites and 498 of 498 tests passed.

Scope: No board files under libraries/boards/ changed, so the board-contribution rules (examples, placeholders, enums, unique ids, confidence) don't apply here. There is no safety-class mislabeling and no storedcommand issue, because no command definitions were touched.

Versioning: libraries/manifest.json:3, package.json and releases.json all move to 4.6.0 and agree with each other. A minor bump fits: the engine's note-serialization output changes and renderComposer gains a return value. No ids, templates or params change. releases.json releasedAt is 2026-10-02.

Engine (src/droidnet-command-library.js)

  • It stays DOM-free.
  • parseWCBValue and buildWCBValue now treat ^^*** as a standalone note and mark notes parsed from a single ^ with inline: true. Walking through the cases (label, note after a delay, note after a labelled step, note after a note, and a leading note), the parse→build round trip is byte-identical. The tests in test/comment-steps.test.js cover this.
  • The only deliberate non-identity is that an empty segment is dropped, except the one in ^^***. The docs and releases.json already say this.
  • Minor point: a hand-built {type:'comment'} step without inline that follows a step now serializes as ^^***. That is intended, since it fixes the old ^*** re-parse as a label.

UI (src/droidnet-command-library-ui.js)

  • It still goes through buildWCBValue and parseWCBValue.
  • cancelEdit() (~line 166) removes the duplicated reset code, and every exit path uses it.
  • setValue (~line 388) doesn't call onChange, does nothing when the value equals the compiled one, cancels any edit in progress, and keeps a half-filled add bar. This matches the new docs in docs/INTEGRATION_GUIDE.md.

Other: package.json adds jest-environment-jsdom as a devDependency for the new UI tests, and package-lock.json is updated to match. This is fine, but it is a large lockfile diff.

No blocking issues found. Looks good to merge from a correctness and safety standpoint.

@travisccook
travisccook merged commit 17a89ec into main Oct 2, 2026
2 checks passed
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