Skip to content

feat(modtools): bulk versionTitle rename#3197

Open
dcschreiber wants to merge 2 commits intofeature/sc-36475/modtools-pr1-backendfrom
feature/modtools-bulk-rename-version-title
Open

feat(modtools): bulk versionTitle rename#3197
dcschreiber wants to merge 2 commits intofeature/sc-36475/modtools-pr1-backendfrom
feature/modtools-bulk-rename-version-title

Conversation

@dcschreiber
Copy link
Copy Markdown
Contributor

@dcschreiber dcschreiber commented Mar 29, 2026

Summary

  • Allow bulk versionTitle rename in the Bulk Version Editor (modtools)
  • Add 5 missing cascade handlers for versionTitle changes (marked_up_text_chunks, linker_output, links, topic_links, user_history, profiles)
  • Frontend confirmation dialog lists side effects that cannot be auto-fixed

How it works

The API accepts an optional newVersionTitle param. It pre-checks all indices for duplicate conflicts, applies metadata updates first, then renames. Version.save() fires attributeChange handlers via track_pkeys, cascading to all registered collections automatically. After a successful rename, the frontend auto-refreshes the search with the new title.

Test plan

  • pytest sefaria/tests/modtools_test.py (new rename + cascade tests)
  • Manual: search a versionTitle, enter new title, confirm rename dialog, verify refresh
  • Verify old title returns no results; check cascade in mongo

dcschreiber and others added 2 commits March 29, 2026 13:33
Add the ability to rename versionTitle across multiple indices in the
bulk version editor. This was previously blocked because versionTitle
is part of the Version model's composite primary key, but the model
layer already supports renaming via track_pkeys + dependency handlers.

Backend:
- Extend version_bulk_edit_api to accept optional newVersionTitle
- Pre-check for duplicates across all indices before any modification
- Apply metadata updates first, then rename (two-phase per version)
- Version.save() fires existing attributeChange handlers automatically

New cascade handlers for versionTitle changes:
- marked_up_text_chunks + linker_output (versionTitle is a pkey)
- links.charLevelData + links.versions (essay-type)
- topic_links.charLevelData
- user_history.versions
- profiles.version_preferences_by_corpus

Frontend:
- Add "New Version Title" input in Version Identification section
- Confirmation dialog listing side effects before rename
- Auto-refresh search with new title after successful rename
- Partial success messaging for rename operations
- Changes preview shows rename operation

Tests:
- Rename succeeds across multiple indices
- Duplicate detection rejects conflicting renames
- Combined rename + field updates
- Empty/same title validation
- Cascade to marked_up_text_chunks and links.charLevelData

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add explicit CSRF token check before sending the upload request, and
handle 403 responses with a user-friendly message suggesting a page
refresh. Complements the server-side @ensure_csrf_cookie fix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dcschreiber dcschreiber changed the base branch from fix/modtools-rewrite-csv-upload-fix to feature/sc-36475/modtools-pr1-backend March 30, 2026 09:58
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