Skip to content

feat(launchpad): build building-edit-a-dashboard-together - #1200

Merged
rubenvdlinde merged 2 commits into
developmentfrom
quality/build-building-edit-a-dashboard-together
Nov 14, 2026
Merged

rubenvdlinde merged 2 commits into
developmentfrom
quality/build-building-edit-a-dashboard-together

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Builds the server half of openspec/changes/building-edit-a-dashboard-together. Changes to a widget now carry a version, a stale save is refused instead of silently overwriting, and a new widget never lands on top of another one. Presence and replacing the edit lock are not done yet (see below).

Tasks done

  • 1.2 Per-widget versions.

    • A migration (Version002013Date20261114090000) adds version (int, default 0) to launchpad_widget_placements. It is serialized on every placement, and <version> in info.xml is bumped so occ upgrade runs the migration.
    • PUT /api/widgets/{placementId} accepts version, the version the change was made on. WidgetPlacementMapper::claimVersion() compares and raises the version in one UPDATE statement, so of two saves on the same version exactly one wins.
    • The losing save gets 409 {error: "stale", message, placement}, where placement is the colleague's saved widget, so the editor can redo the change on top of it.
    • A save without version (today's client) still raises the version. The bulk position write in updatePositions() raises it too, so versions stay truthful whichever path wrote.
  • 1.3 Placement. PlacementService::addWidget() and addTileFromArray() keep the requested spot when it is free in the saved layout. Otherwise the widget goes to the first free spot, scanning row by row within the dashboard's gridColumns. A widget wider than the grid is clamped to the grid width. This is the new FreeSpotFinder.

  • 1.5 Unit tests. DashboardCoEditingTest covers:

    • two editors on different widgets: both changes are saved;
    • two editors on the same widget: the later save is refused with the colleague's version, then succeeds on top of it;
    • an unversioned save that raises the version;
    • placement after a colleague filled the first free spot, and the finder's edge cases.

    WidgetApiControllerActionsGoldenTest covers the 409 answer.

Tasks left, and why

  • 1.1 Presence ("Wie werkt er mee?", who edits since when) needs a presence store, endpoints and the edit-mode UI in Views.vue. It is not in this PR.
  • 1.4 Replacing the edit lock. The change says to replace the lock only once 1.1 to 1.3 work, so the lock stays as it is. The frontend still saves the whole layout through PUT /api/dashboard/{id}. Moving the store to versioned per-widget saves of only the changed widgets belongs with 1.4.
  • 2.1 e2e tests or reasoned excludes per scenario.

Test changes

These tests record exact shapes, so they now include the new field and statements:

  • the placement serialization goldens and the add-widget fixtures gain "version":0;
  • the mapper query golden gains version + 1 and the claimVersion statement (re-recorded with LAUNCHPAD_RECORD_GOLDEN=1);
  • RequestDataExtractorTest adds version to the placement fields it reads;
  • WidgetPlacementMapperCoverageTest adds the version raise to updatePositions.

No assertion was removed.

Checks

  • PHPUnit (phpunit.xml): development 4062 tests OK, this branch 4069 OK (13 skipped in both).
  • php -l is clean. phpcs reports no errors on the changed files; its warnings are existing missing @spec tags on WidgetPlacement. phpstan is clean on the changed files.
  • Hydra gates (--scope-to-diff): all pass except or-abstraction-anti-patterns, which names PermissionService and RoleFeaturePermissionService. This PR does not touch either file.

Generated by Claude Code

Each widget placement gets a version that every save raises. A save
on PUT /api/widgets/{id} that names the version it was made on claims
it in one statement; when a colleague saved that widget first the save
is refused with 409 and the colleague's version. Bulk position writes
raise the version too. A new widget or tile takes the spot asked for
when it is free in the saved layout, else the first free spot.

Assisted-by: ClaudeCode:claude-opus-5-5
…n runs [skip ci]

Assisted-by: ClaudeCode:claude-opus-5-5
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