Skip to content

Park an unpushed vaadin/docs patch for the Collaboration Kit to Signals migration guide - #142

Closed
totally-not-ai[bot] wants to merge 7 commits into
mainfrom
docs/collaboration-kit-to-signals-migration-guide
Closed

Park an unpushed vaadin/docs patch for the Collaboration Kit to Signals migration guide#142
totally-not-ai[bot] wants to merge 7 commits into
mainfrom
docs/collaboration-kit-to-signals-migration-guide

Conversation

@totally-not-ai

@totally-not-ai totally-not-ai Bot commented Aug 21, 2026

Copy link
Copy Markdown

What this changes

This branch adds a single temporary directory, pending-vaadin-docs/, containing one commit that could not be pushed to its real home:

  • 0001-docs-give-collaborative-binder-users-a-real-migratio.patch — a rewrite of the field-highlighting section of the Collaboration Kit → Signals migration guide, formatted for git am.
  • README.md — where the patch belongs, how to apply it, and what has already been verified.

Nothing else in this repository is touched. The migration guide itself was staged here earlier in the branch and has since been removed: it now lives in vaadin/docs#5888, which is where documentation for this feature belongs. Only the follow-up patch remains, and only because it has nowhere else to sit yet.

Why

The guide was originally committed here because this was the repository the change could be committed to at the time. Once the vaadin/docs PR existed, the guide moved there. The GITHUB_TOKEN then expired between committing the field-highlighting rewrite and pushing it, so that last commit never reached the PR. Parking it as a patch file keeps the work from being lost.

What the parked patch says

The earlier text in the guide claimed the @vaadin/field-highlighter overlay couldn't be reused, because its Java wrapper isn't public API, and that a migration therefore couldn't match Collaboration Kit visually. That's wrong: the npm package has a documented static JavaScript API, and Collaboration Kit drives it purely through Element::executeJs, so application code can do the same and get an identical result.

The recipe in the patch follows Collaboration Kit's own implementation rather than reinventing it:

  • It extends FieldHighlighterInitializer instead of making a bare executeJs call. The @NpmPackage and @JsModule annotations for @vaadin/field-highlighter sit on that class, so a bare call leaves nothing referencing it — Flow's production scan drops the module and the custom element is undefined in production, while development mode works. Subclassing also re-runs init() on every attach; the one-shot call left a re-attached field without its focus observer, silently unreported from then on.
  • It listens for vaadin-highlight-show / vaadin-highlight-hide so composite fields report the right sub-field.
  • It removes entries by matching property and user, as FormManager does. Removing only the last inserted entry orphans the earlier one when two show events arrive without a hide between them — for example, moving between the parts of a DateTimePicker — leaving a highlight nobody can clear.
  • It notes that vaadin-field-highlighter-flow is declared provided by Collaboration Kit, so it's vaadin-core, not Collaboration Kit, that puts it on the classpath.

The patch also aligns DocumentState with the list-based editor model, moves the FormManager tip back to section level, and restores heading spacing. The CSS-only variant is kept as the no-dependency alternative.

Verification

Done against a fresh vaadin/docs checkout of the PR branch with the patch applied:

  • vale --config=.vale-pr.ini articles/tools/collaboration/migrating-to-signals.adoc — 0 errors, 0 warnings, 0 suggestions.
  • asciidoctor -a skip-front-matter renders the file with no warnings; every internal anchor resolves. Cross-file xref targets were checked by hand, since Asciidoctor on a single file resolves neither {articles} nor inter-document xrefs.

Follow-up

Once the patch is applied to vaadin/docs#5888, delete pending-vaadin-docs/. It is a holding place, not repository content.

Adds an AsciiDoc article that maps every Collaboration Kit concept to its
shared signals equivalent: topics to an application-scoped signal registry,
UserInfo to an application record, PresenceManager and CollaborationAvatarGroup
to a SharedListSignal bound with AvatarGroup.bindItems(), CollaborationBinder to
a SharedValueSignal with map()/updater() alongside a regular Binder, field
highlighting to CSS bindings, chat to a SharedListSignal with
MessageList.bindItems(), and the low-level map and list APIs operation by
operation. It also states what shared signals do not yet cover: clustering,
connection-scoped cleanup, and topic expiration.

The article targets the vaadin/docs repository, which cannot be pushed to from
here, so it is staged under docs/vaadin-docs/ mirroring its target path, with a
README describing how to copy it over.
…tion guide

- Pair retain/release across attach and detach in the topic registry example.
  Registering only a detach listener releases more times than it retains when a
  view is reattached, dropping shared state that is still in use. Adds a note
  about the grace period a re-attaching view needs.
- Stop presenting SharedMapSignal.verifyKey() as the counterpart of
  CollaborationMap.replace(). It verifies that a key maps to a given child
  signal, not that the entry holds an expected value; replace() or
  verifyValue() on the entry signal are the value-based equivalents.
- Remove the field highlight entry on blur only while it still belongs to the
  local user, in a transaction with verifyValue(), so that blurring does not
  clear an entry a second user has since written.
- Guard the nullable supervisor identifier in the entity-valued field example,
  and cache the identifier so the backend lookup does not run on every change
  to an unrelated form property.
…Kit migration

Adds a 'Gaps and Cases That Can't Be Migrated' section, split into three
groups, and retargets the early triage list at it.

Blockers: clustering, and session serialization. Serializing a shared signal
throws NotSerializableException, since every public constructor creates the
asynchronous tree that refuses serialization; both view fields and the lambdas
captured by bind*() keep the signal reachable from the session, so Kubernetes
Kit session replication cannot work.

Behavior that has to be rebuilt: connection-scoped cleanup and the beacon that
makes tab-close detection prompt, topic and entry expiration, automatic user
color assignment, the field highlighter overlay with multiple editors and
sub-field indexes, and the message persister fetch protocol.

API-level differences: no TypeReference overloads, so parameterized value types
have to be wrapped in a record; no previous value or change type in effects,
unlike MapChangeEvent and ListChangeEvent; no list emptiness conditions; no
cluster membership events.

Also adds a 'What Isn't a Gap' list for the features that carry over unchanged,
and extends the feature checklist with the new rows.
- ListChangeEvent tracks a change type, but the accessor and the enum are
  package-private, so subscribers cannot read it. Drop it from the gap and the
  checklist row: what signals actually lack is the previous value and the
  surrounding keys, both of which are public in Collaboration Kit.
- Narrow the automatic color allocation claim. Sequential allocation applies
  only to the local backend, the registry never shrinks so the eighth distinct
  user since startup collides with the first, and a non-local backend falls
  back to hashing the user id - the same approach the guide suggests.
- CollaborationBinder::forField takes the collection and element types as two
  Class arguments; TypeReference belongs to the topic API. Separate the two.
- Say in the README exactly how the cross-file xref targets were checked, since
  Asciidoctor on a single file resolves neither {articles} nor inter-document
  xrefs.
The guide now lives in vaadin/docs, where it belongs:
vaadin/docs#5888

It was staged here only because this was the repository the change could be
committed to at the time.
The GITHUB_TOKEN expired between committing and pushing the field-highlighting
rewrite for vaadin/docs#5888. Parking the patch here so the work survives; it
should be applied to that PR and this directory deleted.
Four problems in the recipe, all found by checking it against Collaboration
Kit's own implementation:

- The @NpmPackage and @jsmodule annotations for @vaadin/field-highlighter sit
  on FieldHighlighterInitializer. A bare executeJs call never references that
  class, so Flow's production scan drops the module and the custom element is
  undefined in production while development mode works. Removing Collaboration
  Kit removes the only thing that referenced it. The recipe now extends
  FieldHighlighterInitializer, as Collaboration Kit does.
- That also fixes initialization: FieldHighlighterInitializer.init() re-runs on
  every attach, whereas the one-shot executeJs left a re-attached field without
  the focus observer, silently unreported from then on.
- vaadin-highlight-hide removed only the last inserted entry. Two show events
  can arrive without a hide between them - moving between the parts of a
  DateTimePicker - orphaning the earlier entry and leaving a highlight nobody
  can clear. Removal now matches property and user, as FormManager does.
- Collaboration Kit declares vaadin-field-highlighter-flow as provided, so it
  is vaadin-core, not Collaboration Kit, that puts it on the classpath.

Also aligns DocumentState with the list-based editor model, moves the
FormManager tip back to the section level, and restores the heading spacing.

Verified by applying the regenerated patch to a fresh checkout of the PR
branch: Vale reports no errors, warnings, or suggestions, and Asciidoctor
renders the file cleanly.
@totally-not-ai totally-not-ai Bot changed the title docs: add a Collaboration Kit to Signals migration guide staged for vaadin/docs Park an unpushed vaadin/docs patch for the Collaboration Kit to Signals migration guide Aug 21, 2026
@totally-not-ai

Copy link
Copy Markdown
Author

Closing this. The migration guide belongs in vaadin/docs, and that's where it now lives: vaadin/docs#5888.

This PR only ever existed as a holding place — first for the guide itself, then for a patch that couldn't be pushed while a token was expired. That patch has been applied to vaadin/docs#5888, so this branch no longer changes anything in this repository.

Context for anyone following the migration work: vaadin/collaboration-kit#138 and vaadin/flow#23868.

@totally-not-ai totally-not-ai Bot closed this Aug 21, 2026
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.

0 participants