Repository navigation
refactor(docx): move the DOCX export entry point and edit conflicts into lib/services/docx - #896
Conversation
…nto lib/services/docx docx_workflow_service.py and edit_conflicts.py sat beside lib/services/docx/ but change with it: since March, 10 of docx_workflow_service's 13 commits and all 6 of edit_conflicts' commits also touched docx/, and only docx/ imports edit_conflicts. Move them in, naming the entry point service.py as admin_dashboard/, annotations/ and preflight/ do, and update every import and patch target. No behaviour change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T9eqHq49ncKxbGg8kneoQm
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
The behavior-preserving relocation consistently updates callers and test patch targets, with no unresolved findings.
No open issues 🎉
What changed in this PR
Consolidates DOCX export code under lib/services/docx/ without changing behavior.
Changes:
- Moves the export entry point and edit-conflict resolver into the DOCX package.
- Updates runtime imports, test imports, and mock patch targets.
| File | Description |
|---|---|
tests/unit/services/tracked_changes_support.py |
Updates conflict-resolver import. |
tests/unit/services/test_edit_conflicts.py |
Updates imports for the moved module. |
tests/unit/services/test_docx_generation.py |
Updates imports and mock patch targets. |
lib/services/docx/tracked_changes_planning.py |
Uses the relocated conflict resolver. |
lib/services/docx/service.py |
Relocates the unchanged export entry point. |
lib/services/docx/edit_export.py |
Uses the relocated conflict resolver. |
lib/services/docx/edit_conflicts.py |
Relocates unchanged conflict-resolution logic. |
lib/api/routers/projects.py |
Updates the export-service import. |
lib/api/mcp/tools/files.py |
Updates the export-service import. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #896 +/- ##
=======================================
Coverage 88.82% 88.82%
=======================================
Files 542 542
Lines 34702 34702
Branches 2069 2069
=======================================
Hits 30825 30825
Misses 3618 3618
Partials 259 259 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
This moves two DOCX-export modules from the flat
lib/services/folder intolib/services/docx/, where the rest of the export code lives. It is a pure move: both files are 100% renames, and only import lines change. Behaviour is unchanged.Motivation
This is a code-health structure pass on
lib/services/, which holds about 40 flat modules next to a handful of domain subpackages. Both files belong todocx/but sat outside it:docx_workflow_service.pychanged together withdocx/in 10 of its 13 commits since March.edit_conflicts.pychanged together withdocx/in all 6 of its commits. Outside the tests, onlydocx/edit_export.pyanddocx/tracked_changes_planning.pyimport it.The entry point is now
service.py, the nameadmin_dashboard/,annotations/andpreflight/already use.Target layout. Each domain becomes a subpackage of
lib/services/with its entry point inservice.py. Flat modules stay only for small helpers that several domains share (text_location,markdown_text, …). The move is one cluster per change. Candidates for later:workflow_*modules could becomelib/services/workflow_runs/. They are about 2,000 lines with about 56 reference sites, and show weaker co-change evidence.file.py(theFileDocumentmodel) sits next tofiles.py(the file service). It belongs withfile_finalization,file_imagesandfile_artifacts_service/in afiles/package.lib/api/services/workflow_runner.pyis a lone file in a third "services" location.Layering issues noticed and left alone:
lib.workflows, for exampledocx/edit_conflicts.py→simple_deep_agent/edit_anchoring.normalize_whitespace.docx/service.pyimports the privateprojects._get_project_by_id.What's Changed
Backend
lib/services/docx_workflow_service.py→lib/services/docx/service.py: moved, contents unchanged.lib/services/edit_conflicts.py→lib/services/docx/edit_conflicts.py: moved, contents unchanged.lib/api/routers/projects.pyandlib/api/mcp/tools/files.py: importgenerate_docxandDocxManipulatorTypefrom the new path.lib/services/docx/edit_export.pyandlib/services/docx/tracked_changes_planning.py: import fromlib.services.docx.edit_conflicts. Ruff re-sorted the import blocks.tests/unit/services/test_docx_generation.py: new import path, and the_SERVICEpatch-target string updated.tests/unit/services/test_edit_conflicts.pyandtests/unit/services/tracked_changes_support.py: new import path.The tests stay flat in
tests/unit/services/, alongside the other DOCX tests.Frontend
None.
Risks and Mitigations
import lib.api.main) succeeds, which covers both runtime callers.lib.services.docx.service. Nothing filters on the old name.ruff format,ruff check,mypy .(0 errors) andpytest tests/unit(2383 passed). No integration test imports either module.🤖 Generated with Claude Code
https://claude.ai/code/session_01T9eqHq49ncKxbGg8kneoQm