Skip to content

refactor: move the insert and paragraph-split methods into a RevisionManager mixin (ROADMAP.md #73) - #92

Merged
pablospe merged 2 commits into
mainfrom
task/7bf50fe5-Decompose-track_changes-py--st
Aug 30, 2026
Merged

pablospe merged 2 commits into
mainfrom
task/7bf50fe5-Decompose-track_changes-py--st

Conversation

@pablospe

Copy link
Copy Markdown
Owner

What

insert_text_after, insert_text_before and the fifteen private insert and paragraph-split helpers move out of manager.py into docx_editor/track_changes/insert.py as _InsertMixin; RevisionManager gains it as its sixth base. Behaviour is unchanged.

Why

ROADMAP.md #73: one concern per module. manager.py drops from 1570 to 1144 lines and now holds only the location context, the listing/query methods and the resolution cluster.

How

Method bodies are byte-identical (scripts/check_pure_move.py --base main: 3/3 ok), including the @staticmethod on _plain_run_xml and the _apply_paragraph_splits body that ROADMAP.md #79 will fix separately. manager.py loses only the ten imports the cluster used exclusively (RevisionError, TextMapMatch, _escape_xml, _reject_control_chars, get_rPr_xml, rebuild_run_fragments, render_plain_wt, _first_content_child, _set_xml_space_preserve, _RUN_TRACK_CHANGE_TAGS). base.py gains two verbatim stubs for the cross-cluster callees the mixin reaches through self: _rewrite_insert_at (batch) and _split_foreign_ins_at (delete). _rejoin_paragraph stays in manager.py: it is only called from the resolution path.

Start with insert.py (the moved block) and the RevisionManager bases line in manager.py.

Testing

  • 2 new tests in tests/test_track_changes_coverage.py (TestInsertNearMatchEmptyPositions) for the two _insert_near_match guards nothing exercised before: a match with no positions and an edge <w:t> with no run. insert.py reports 100% lines and branches on the insert-related test set (876 passed).
  • Full suite: 1846 passed, 8 skipped, 2 xfailed in 5:20 under the 16 GB cap.
  • ruff check, ruff format --check, and ty check (the 7 pre-existing diagnostics) unchanged.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 48 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3ceb12c3-9f21-4118-a6f1-d40bb5607275

📥 Commits

Reviewing files that changed from the base of the PR and between a213884 and b82e6e3.

📒 Files selected for processing (4)
  • docx_editor/track_changes/base.py
  • docx_editor/track_changes/insert.py
  • docx_editor/track_changes/manager.py
  • tests/test_track_changes_coverage.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.0%. Comparing base (a213884) to head (b82e6e3).

Additional details and impacted files
@@          Coverage Diff          @@
##            main     #92   +/-   ##
=====================================
  Coverage   97.9%   98.0%           
=====================================
  Files         20      21    +1     
  Lines       5058    5067    +9     
  Branches     984     984           
=====================================
+ Hits        4956    4969   +13     
+ Misses        48      46    -2     
+ Partials      54      52    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pablospe
pablospe merged commit 4166c3c into main Aug 30, 2026
15 checks passed
@pablospe
pablospe deleted the task/7bf50fe5-Decompose-track_changes-py--st branch August 30, 2026 19:28
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