Skip to content

Cascade version title changes to linker chunks - #3674

Open
yonadavGit wants to merge 1 commit into
masterfrom
chore/sc-46884/look-into-missing-dependencies-on
Open

Cascade version title changes to linker chunks#3674
yonadavGit wants to merge 1 commit into
masterfrom
chore/sc-46884/look-into-missing-dependencies-on

Conversation

@yonadavGit

Copy link
Copy Markdown
Contributor

Description

A brief description of the PR

Code Changes

The following changes were made to the files below

Notes

Any additional notes go here

@yonadavGit
yonadavGit requested a review from nsantacruz August 30, 2026 13:14
@gitvelocity-reviewer

Copy link
Copy Markdown

📊 Code Quality Score: 15/100

Base Score 37 × ESF 0.4 = 14.8, rounded to 15

Category Score Factors
🔭 Scope 7/20 Three files modified: dependencies.py gains one subscribe call, marked_up_text_chunk.py gains a 16-line function and a docstring update, and the test file gains one standalone test function and a test isolation fix. All changes are within the marked_up_text_chunk subsystem.
🏗️ Architecture 5/20 The new handler follows the existing pattern established by process_index_delete and process_category_path_change in the same module. No new module boundary, no new dependency, and no new abstraction is introduced.
⚙️ Implementation 7/20 process_version_title_change builds a MongoDB $and/$or query using Ref(ver.title).regex(as_list=True) to scope updates to the correct book's refs, then calls update_many on both db.marked_up_text_chunks and db.linker_output with a $set on versionTitle. The language filter is applied via the shared query dict.
⚠️ Risk 6/20 update_many runs against two production collections without a feature flag or dry-run mode. A malformed ver.title passed to Ref() could raise at cascade time. The regex pattern list from Ref.regex(as_list=True) determines the blast radius; an overly broad pattern could update unintended documents. No rollback mechanism is documented.
✅ Quality 10/15 The test in sefaria/model/tests/marked_up_text_chunk.py uses SimpleNamespace to drive process_version_title_change and asserts three cases across both collections: matching ref+language updated, matching ref but wrong language not updated, out-of-scope ref not updated. Cleanup runs in finally blocks. The test isolation fix for test_incorrect_text_span uses deepcopy and finally to restore original_spans. No test covers the subscription wiring in dependencies.py or the multi-pattern regex path.
🔒 Perf / Security 2/5 update_many is used for bulk efficiency rather than per-document updates. No index analysis is provided for the versionTitle, language, and ref fields used in the query.

Was this score accurate? 👍 Yes · 👎 No

How this was scored →

Scored by GitVelocity · How are scores calculated?

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