Skip to content

Add Cue Renumber feature for MagicQ console sync#1274

Open
Tim020 wants to merge 6 commits into
devfrom
feature/cue-renumber
Open

Add Cue Renumber feature for MagicQ console sync#1274
Tim020 wants to merge 6 commits into
devfrom
feature/cue-renumber

Conversation

@Tim020

@Tim020 Tim020 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New feature: Renumber Cues — resynchronises DigiScript cue identifiers after a MagicQ console renum/reorder operation
  • MagicQ CSV sync (Phase 3): Upload the pre-renum cue stack CSV export from MagicQ so DigiScript can simulate the exact sequential mapping MagicQ would produce for the full console cue stack — including cues intentionally omitted from the script
  • Dropzone UI: drag-and-drop or click-to-browse CSV upload with success/error visual states
  • Full stack: Backend endpoint + both Vue 3 (client-v3/) and Vue 2 (client/) UI with feature parity

How it works

MagicQ sorts all cues numerically and reassigns sequential integers starting at 1. By uploading the pre-renum CSV, DigiScript can correctly place its subset of cues even when some console cues don't exist in the script:

Console cues After MagicQ renum DigiScript before DigiScript after
1, 2, 2.1, 3, 4 1, 2, 3, 4, 5 1, 3 1, 4

DigiScript's "3" → "4" because cue 2.1 occupies position 3 in the full sequence.

Changes

Backend (server/)

  • controllers/api/constants.py — 4 new error constants
  • controllers/api/v1/show/cues.pyCueRenumberController (POST /api/v1/show/cues/renumber) with @requires_show, @no_live_session, RBAC per cue type, and correct fork pattern (forks cues shared across revisions, updates ALL current-revision associations)
  • test/controllers/api/v1/show/test_cues.pyTestCueRenumber class (11 tests)

Vue 3 frontend (client-v3/)

  • src/composables/useCueRenumber.tsparseMagicQCsv() (scans header for Cue id column, builds old-float→new-integer Map) + computeRenumber(cues, csvMapping) (53 unit tests)
  • src/stores/script.tsrenumberCues() Pinia action
  • src/components/show/config/cues/CueRenumberModal.vue — two-step modal: step 1 has CSV dropzone + cue type selection; step 2 shows Changed Cues table (editable) and Unmatched Cues opt-in
  • src/components/show/config/cues/CueEditor.vue — "Renumber Cues" toolbar button
  • e2e/tests/08-show-config-cues.spec.ts — 7 Playwright tests

Vue 2 frontend (client/)

  • src/js/cueRenumberUtils.ts — identical algorithm to Vue 3 (53 unit tests)
  • src/store/modules/script.tsRENUMBER_CUES Vuex action
  • src/vue_components/show/config/cues/CueRenumberModal.vue — Options API modal (same two-step flow)
  • src/vue_components/show/config/cues/CueEditor.vue — "Renumber Cues" toolbar button

Documentation

  • docs/pages/cue_config.md — "Renumbering Cues" section rewritten to describe the CSV upload workflow, how to export from MagicQ, and the sparse-cue example

Test plan

  • 11 backend tests pass (TestCueRenumber)
  • 53 Vitest unit tests pass for client-v3/ composable
  • 53 Vitest unit tests pass for client/ utility
  • TypeScript type checking passes for both clients
  • Linting passes for both clients and server (ruff)
  • Full Playwright E2E suite: 216/217 pass (1 pre-existing flaky WebSocket scroll sync test in spec 13, passes on retry, unrelated to this feature)
  • 7 new E2E tests all pass (toolbar button visible, modal step 1/2 flow, back/cancel)

🤖 Generated with Claude Code

Allows users to renumber cue identifiers using the MagicQ sequential
algorithm (sorting float idents, assigning integers 1, 2, 3…), keeping
DigiScript labels in sync after a MagicQ console renum operation.

- Backend: POST /api/v1/show/cues/renumber with fork-safe bulk update
  (forks cues shared across revisions, updates all current-rev lines)
- Algorithm composable/utility (Vue 3 + Vue 2): regex matching, sort,
  sequential assignment, deduplication by cue ID
- Two-step modal UI (both clients): type selection → preview with
  editable idents and opt-in unmatched section; full uniqueness validation
- 11 backend tests, 29 Vitest unit tests per client, 7 E2E tests
- Documentation update in docs/pages/cue_config.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Tim020 Tim020 added the claude Issues created by Claude label Jul 2, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation client Pull requests changing front end code server Pull requests changing back end code xlarge-diff client-v3 labels Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Client V3 Test Results

77 tests   77 ✅  0s ⏱️
 3 suites   0 💤
 1 files     0 ❌

Results for commit b2e537a.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Client Test Results

182 tests   182 ✅  0s ⏱️
  7 suites    0 💤
  1 files      0 ❌

Results for commit b2e537a.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Python Test Results

  1 files    1 suites   2m 18s ⏱️
715 tests 715 ✅ 0 💤 0 ❌
720 runs  720 ✅ 0 💤 0 ❌

Results for commit b2e537a.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Playwright E2E Results (firefox)

217 tests   217 ✅  2m 16s ⏱️
 14 suites    0 💤
  1 files      0 ❌

Results for commit b2e537a.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Playwright E2E Results (chromium)

217 tests   217 ✅  2m 14s ⏱️
 14 suites    0 💤
  1 files      0 ❌

Results for commit b2e537a.

♻️ This comment has been updated with latest results.

Tim020 and others added 5 commits July 3, 2026 00:08
Three bugs in the original renumber algorithm:
1. Per-type renumbering ran each selected cue type independently, causing
   each type to restart from 1. All selected types are now pooled into a
   single computeRenumber call before sequencing.
2. Cues with text suffixes (e.g. "2.1 - Blackout") were fully excluded.
   The new NUMERIC_PREFIX_REGEX extracts the leading numeric value and
   preserves the suffix. These cues consume a sequential slot and appear
   in the Unmatched section with a pre-computed suggestion (e.g.
   "3 - Blackout") that the user can opt into.
3. Replaces allMatchedByType Map with a flat allMatched array; step2Valid
   now filters by cue_type_id from the flat list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the sequential algorithm with a CSV-upload workflow so
DigiScript can simulate the exact MagicQ renum for a full console
cue stack — including cues intentionally omitted from the script.

- parseMagicQCsv: scans header row for "Cue id" column, builds
  old-float→new-integer Map from the exported pre-renum data
- computeRenumber now requires a csvMapping argument; cues whose
  prefix is absent from the map land in Unmatched with no suggestion
- Modal: method dropdown replaced with BFormFile CSV upload;
  "Next" gated on csvParsed && selectedTypeIds.length > 0
- Unmatched description updated to explain both reasons (not in CSV,
  no numeric prefix); text-suffix cues show pre-computed suggestion
- Tests updated across both clients; 53 new tests for parseMagicQCsv
  and the updated computeRenumber signature (76/181 total pass)
- Docs: Renumbering Cues section rewritten with CSV export steps
  and sparse-cue example

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the native BFormFile input (poor dark-mode appearance,
event.target null error in BVN) with a styled dropzone that:
- Shows upload icon + instructional text in the idle state
- Highlights on drag-over
- Shows filename + row count on success (with solid green border)
- Shows filename + error message on failure
- Supports both click-to-browse and drag-and-drop
- Clears the native file input value on modal close

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- NUMERIC_PREFIX_REGEX: add (?![\d.]) negative lookahead so 3-decimal
  idents like "1.111" don't match via regex backtracking (was (?!\d),
  which still matched "1.111" as prefix="1" + suffix=".111")
- Server validation: validate new_ident on stripped value so
  whitespace-only strings ("   ") are rejected with 400 rather than
  silently persisted as empty ident after strip()
- Vue 2 modal (BS4 compat): replace gap-2 with mr-2 per-button, and
  font-weight-semibold → font-weight-bold (BS5-only classes not in BS4)
- E2E tests: replace stale .modal.show select assertion with
  .csv-dropzone; upload a minimal CSV via setInputFiles before checking
  Next enables (csvParsed guard meant Next stayed disabled without it)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two files modified by earlier commits weren't auto-formatted before push,
causing CI prettier --check to fail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
12.2% Duplication on New Code (required ≤ 3%)
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 client-v3 documentation Improvements or additions to documentation server Pull requests changing back end code xlarge-diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant