Skip to content

Conversation

@Tim020
Copy link
Contributor

@Tim020 Tim020 commented Feb 11, 2026

No description provided.

Tim020 and others added 5 commits February 11, 2026 15:06
Adds the backend foundation for collaborative script editing (Phase 1 Batch 1):
- pycrdt dependency for CRDT/Yjs-compatible document sync
- ScriptDraft model following CompiledScript file-pointer pattern
- draft_script_path setting for draft file storage
- ERROR_SCRIPT_DRAFT_ACTIVE constant for 409 conflict responses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Chains from fbb1b6bd8707 (CrewAssignment). Creates script_drafts table
with unique constraint on revision_id and CASCADE delete from script_revisions.

Also fixes FK reference in ScriptDraft model (user table, not users).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 1 Batch 3 of collaborative editing:

- line_to_ydoc.py: Two-phase conversion (main thread DB query + background
  thread Y.Doc construction) with selectinload for N+1 avoidance
- script_room_manager.py: ScriptRoom (Y.Doc + client tracking + save lock)
  and RoomManager (lazy room creation, periodic checkpointing with atomic
  writes, idle eviction, stale draft cleanup)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 1 Batch 4 of collaborative editing:

- WebSocket: JOIN_SCRIPT_ROOM, LEAVE_SCRIPT_ROOM, YJS_SYNC (2-step),
  YJS_UPDATE, YJS_AWARENESS handlers with base64 binary transport
- on_close: Auto-remove client from collaborative editing rooms
- App server: Initialize RoomManager on startup, create draft_script_path
  directory, clean up stale draft records and unreferenced files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 tests covering:
- build_ydoc: empty script, single line, linked list traversal, multi-page,
  unordered input, multiple line parts, null handling
- Base64 round-trip: full state and incremental updates
- CRDT convergence: concurrent field edits, concurrent text inserts,
  offline edit and reconnect
- ScriptRoom: client add/remove, sync state, apply update, broadcast
  with sender exclusion, failed write resilience, dirty tracking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Tim020 Tim020 added the claude Issues created by Claude label Feb 11, 2026
@Tim020 Tim020 linked an issue Feb 11, 2026 that may be closed by this pull request
@github-actions github-actions bot added server Pull requests changing back end code xlarge-diff labels Feb 11, 2026
@github-actions
Copy link

github-actions bot commented Feb 11, 2026

Client Test Results

99 tests  ±0   99 ✅ ±0   0s ⏱️ ±0s
 4 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 7f75131. ± Comparison against base commit 697f892.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 11, 2026

Python Test Results

  1 files  ± 0    1 suites  ±0   54s ⏱️ +3s
536 tests +30  536 ✅ +30  0 💤 ±0  0 ❌ ±0 
541 runs  +30  541 ✅ +30  0 💤 ±0  0 ❌ ±0 

Results for commit 7f75131. ± Comparison against base commit 697f892.

♻️ This comment has been updated with latest results.

Tim020 and others added 6 commits February 11, 2026 15:26
Phase 2 Steps 2.1-2.4:
- yjs and lib0 dependencies
- ScriptDocProvider: custom Yjs provider using existing WebSocket
  connection with base64 binary transport and OP code messages
- useYjsBinding: Vue 2.7 reactive bindings for Y.Map, Y.Text, Y.Array
- scriptDraft Vuex module: room state, Y.Doc lifecycle, provider
  management, collaborator tracking
- WebSocket message routing: Yjs OPs handled in SOCKET_ONMESSAGE
  and dispatched to HANDLE_DRAFT_MESSAGE

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…5-2.6)

Add a dual-write bridge between Y.Doc and TMP_SCRIPT Vuex state so
existing ScriptLineEditor/ScriptLinePart components continue to work
unchanged while collaborative sync happens through the Y.Doc.

- Create yjsBridge.js with Y.Doc↔TMP_SCRIPT conversion utilities
- Join/leave draft room in ScriptEditor lifecycle hooks
- Set up observeDeep on Y.Doc pages for remote change propagation
- Use 'local-bridge' transaction origin to prevent observer loops
- Wire add/delete/update line operations to Y.Doc
- Sync from Y.Doc on page navigation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ScriptEditor.vue assumed CURRENT_REVISION was already populated in Vuex,
but it's only loaded by the ScriptRevisions component on a different route.
Adding GET_SCRIPT_REVISIONS to ScriptEditor's beforeMount ensures the
revision ID is available for joining the collaborative editing room.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove updateYDocLine bridge function — components now write directly
to Y.Map/Y.Text. ScriptLinePart gains yPartMap prop with:
- @input handler for keystroke-level Y.Text sync
- Y.Map writes for character/group dropdown changes
- Y.Text and Y.Map observers for remote change handling
- Lifecycle setup/teardown for observers

Export nullToZero/zeroToNull from yjsBridge for component use.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ScriptLineEditor gains yLineMap prop with:
- Y.Map writes for act_id, scene_id, stage_direction_style_id on change
- yPartMap pass-through to ScriptLinePart children via getYPartMap()
- addLinePart creates Y.Map structure in Y.Doc for new parts
- Y.Map observer for remote changes to line-level fields
- Lifecycle setup/teardown for observers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- lineChange() is now a no-op in collab mode (components write directly
  to Y.Map/Y.Text; observer handles TMP_SCRIPT sync)
- Remove syncingFromYDoc guard flag and local-bridge origin skip from
  the Y.Doc deep observer — all changes flow through to TMP_SCRIPT
- Add getYLineMap() and pass y-line-map prop to ScriptLineEditor
- Rework add/delete/insert line operations: build complete lineObj
  (with inherited act_id/scene_id) before writing to Y.Doc
- Extract addLineOfType() helper to reduce duplication across
  addNewLine, addStageDirection, addCueLine, addSpacing
- Remove addLineToYDoc/deleteLineFromYDoc wrappers (inlined)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the client Pull requests changing front end code label Feb 11, 2026
Server broadcasts ROOM_MEMBERS on client join/leave/disconnect so all
participants have an up-to-date collaborator list. Clients send
YJS_AWARENESS messages with their current editing position (page and
line index) which are relayed to other room members for line-level
presence tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude Issues created by Claude client Pull requests changing front end code server Pull requests changing back end code xlarge-diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collaborative script editing

1 participant