Skip to content

fix(wunderbaum): node classes as a Set and no_events for set_active_node - #62

Merged
LukasGold merged 4 commits into
mainfrom
fix/wunderbaum-node-classes-and-activate-loop
Sep 21, 2026
Merged

LukasGold merged 4 commits into
mainfrom
fix/wunderbaum-node-classes-and-activate-loop

Conversation

@LukasGold

Copy link
Copy Markdown
Contributor

Changes

  • wunderbaum.vue updateNode: convert classes to a Set through a new toClassSet() helper. An empty string or None clears the classes.
  • wunderbaum.vue setActiveNode and the setActiveNode action dispatch: forward noEvents to node.setActive().
  • wunderbaum.py set_active_node: new no_events: bool = False parameter.
  • wunderbaum.vue getSerializableSource: emit classes as a space-separated string.
  • vue/dist/wunderbaum_vue.mjs: rebuilt bundle.
  • New tests/panels/wunderbaum/test_wunderbaum_node_classes.py with 9 Playwright tests.
  • docs/panels/wunderbaum.md: one sentence on no_events.

Rationale

  • Wunderbaum stores node.classes as Set<string> | null and renders it with classList.add(...node.classes). updateNode assigned the raw string, so "highlighted" became 11 one-letter classes and "highlighted urgent" threw InvalidCharacterError.
  • set_active_node always fired activate. Two trees whose activate handlers mirror the active node into each other called each other without end.
  • getSerializableSource put the Set into the payload. JSON.stringify encodes a Set as {}, so classes loaded from the source were lost on every sync back to Python.

Compatibility

  • no_events defaults to False, so existing callers keep the old behaviour. The only caller in the repository, examples/usecases/wunderbaum_visnetwork.py#L419, is unchanged.
  • addNode and the source loader were not affected: the library's node constructor already converts classes through setClass().

Testing

  • pytest tests/panels/wunderbaum/test_wunderbaum_node_classes.py: 9 passed
  • pytest tests/panels/wunderbaum/: 84 passed, 1 xfailed
  • The new tests against the pre-fix code: 8 failed, 1 passed. The passing test covers the default activation path, which was not broken.
  • pre-commit run on the changed files: passed

Not in this PR

  • updateNodeSilent, used by batch_update and execute_step, ignores classes. This gap existed before this change.
  • docs/apidocs/panelini/panelini.panels.wunderbaum.wunderbaum.md still shows the old set_active_node signature until the next autodoc2 docs build.

- updateNode converts classes to a Set; a string was added one character at a time and a space threw InvalidCharacterError
- an empty classes value now clears a node's custom classes
- setActiveNode forwards noEvents so mirrored trees stop calling back
- set_active_node takes no_events, default False, so callers are unchanged
- getSerializableSource emits classes as a string; a Set encoded to {}
- 9 Playwright tests over two trees that mirror each other's activation
- covers both write paths into node.classes: updateNode and the loader
- 8 of the 9 fail against the pre-fix bundle
@github-actions

Copy link
Copy Markdown

Release preview

Merging this PR would release 1.0.1 (current: 1.0.0).

Changelog preview (truncated)
## v1.0.1 (2026-09-18)

### Bug Fixes

- **wunderbaum**: Correct node classes and add no_events to activation
  ([`d02ec44`](https://github.com/opensemanticworld/panelini/commit/d02ec44975fc83bb51b55e0f1b0e78a694e8becb))

### Documentation

- **wunderbaum**: Document no_events on set_active_node
  ([`9fc5794`](https://github.com/opensemanticworld/panelini/commit/9fc5794664f3dc750c4280c245fc921c69cbb9dc))

### Testing

- **wunderbaum**: Cover node classes and no_events activation
  ([`c6165aa`](https://github.com/opensemanticworld/panelini/commit/c6165aa7023ac8eb668384441a81274270a30f42))

- **wunderbaum**: State what the loop bound does and does not prove
  ([`d78eadb`](https://github.com/opensemanticworld/panelini/commit/d78eadb48f5fdc2fc1fd91ab757f3f03a79b4006))

Preview via python-semantic-release and conventional commits.

@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LukasGold
LukasGold merged commit 1568a44 into main Sep 21, 2026
17 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