Skip to content

refactor: move the resolution methods into a RevisionManager mixin, completing the package split (ROADMAP.md #73) - #94

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

pablospe merged 2 commits into
mainfrom
task/87f0c6db-Decompose-track_changes-py--st

Conversation

@pablospe

@pablospe pablospe commented Aug 30, 2026 •

Copy link
Copy Markdown
Owner

What

The last cluster of RevisionManager moves out of manager.py: the 21
accept/reject methods become _ResolutionMixin in a new
track_changes/resolution.py. manager.py goes from 721 to 74 lines — a module
docstring, ten imports, the class header and __init__ — and the package split
started in #83 is complete: eight cluster modules behind an unchanged façade.

Why

track_changes.py was 5,215 lines and every review round found real bugs in it.
Resolution was the last cluster still sharing a file with the class it belongs
to, so a fix there could not be reviewed without the whole manager in view. Two
filed bugs (#75 author-filtered bulk resolution, #79 split formatting) were
explicitly waiting on their cluster to move.

How

A pure move: resolution.py is the old manager.py:87-721 byte for byte under
a mixin header, so git diff shows no logic change. base.py gains six stubs
for the cross-cluster callees the moved code reaches (_find_revision_element,
list_revisions, _unhandled_elements, group_revisions, changeset_groups,
_paragraph_mark_rPr), each a verbatim copy of its real signature; no existing
stub became unreferenced. Start at manager.py for the assembled base list.

Testing

scripts/check_pure_move.py --base main:

check 1: line multiset: ok
check 2: AST identity: ok
check 3: base.py is copies only: ok

Full suite: 1857 passed, 8 skipped, 2 xfailed. resolution.py is at 100% —
219 statements, 104 branches, none missed — after a new test covers rejecting a
w:pPrChange placed outside w:pPr; without the guard it pins, that path
strips the paragraph's own properties and runs. ruff clean, ty at its
7-diagnostic baseline.

Summary by CodeRabbit

  • New Features

    • Added support for accepting or rejecting tracked changes individually, by group, by changeset, or in bulk.
    • Supports tracked insertions, deletions, moved content, and paragraph formatting changes.
    • Added revision listing and filtering by author or paragraph.
  • Bug Fixes

    • Corrected handling of misplaced paragraph-format revision records so valid formatting is preserved and obsolete revision data is removed.

…OADMAP.md #73)

Completes the track_changes package split: manager.py keeps only the
RevisionManager class header and __init__, and the 21 accept/reject
methods move verbatim into _ResolutionMixin. base.py gains six stubs for
the cross-cluster callees the cluster reaches (_find_revision_element,
list_revisions, _unhandled_elements, group_revisions, changeset_groups,
_paragraph_mark_rPr).

scripts/check_pure_move.py --base main: 3/3 ok.
)

The schema-invalid-placement guard in _restore_paragraph_properties had
no test: a record whose parent is not w:pPr is dropped rather than
restored into whatever parent it has. Takes resolution.py to 100%
statement and branch coverage.
@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 636eea37-471e-49c6-97f2-1b8cef10035f

📥 Commits

Reviewing files that changed from the base of the PR and between c53ce37 and a058635.

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

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change extracts revision accept/reject behavior from RevisionManager into _ResolutionMixin. It adds base method contracts for resolution and listing operations, and adds coverage for misplaced paragraph-property change records.

Changes

Revision resolution

Layer / File(s) Summary
Resolution contracts and manager wiring
docx_editor/track_changes/base.py, docx_editor/track_changes/manager.py
The base class declares resolution-related methods. RevisionManager inherits _ResolutionMixin and removes its inlined resolution implementation.
Individual revision resolution
docx_editor/track_changes/resolution.py, tests/test_move_and_ppr_change_resolution.py
_ResolutionMixin resolves insertions, deletions, moves, paragraph properties, and paragraph-mark changes. It restores deletions and paragraph properties, sweeps move range marks, and tests misplaced w:pPrChange records.
Grouped and bulk resolution
docx_editor/track_changes/resolution.py
Group, changeset, and all-revision operations resolve revision IDs through shared indexes, deferred sweeps, repeated passes, and unhandled-revision reporting.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to a0586

This PR reorganizes existing revision-resolution methods behind the same RevisionManager façade without identified behavior, access, or dependency changes; no actionable merge-blocking risk remains after normal checks and review.

Poem

A rabbit hops through tracked change trails
New mixin paths replace old rails
Inserts unwrap, deletions restore
Move marks sweep across the document floor
Paragraphs rejoin in a tidy array
“Review complete!” the rabbit says.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 69.70% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: moving resolution methods into a RevisionManager mixin and completing the package split.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/87f0c6db-Decompose-track_changes-py--st

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 97.9%. Comparing base (c53ce37) to head (a058635).

Additional details and impacted files
@@           Coverage Diff            @@
##            main     #94      +/-   ##
========================================
+ Coverage   80.6%   97.9%   +17.3%     
========================================
  Files         22      23       +1     
  Lines       5132    5136       +4     
  Branches     991     991              
========================================
+ Hits        4137    5033     +896     
+ Misses       809      49     -760     
+ Partials     186      54     -132     

☔ 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 a7719ff into main Aug 30, 2026
15 checks passed
pablospe added a commit that referenced this pull request Aug 30, 2026
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