|
1 | | -"""DocumentPath disambiguation internals for the corpus service layer. |
| 1 | +"""DocumentPath path-manipulation + signal-replay internals for the corpus service layer. |
2 | 2 |
|
3 | | -``CorpusPathService`` holds the low-level :class:`DocumentPath` path |
4 | | -manipulation helpers used by the folder write operations when documents are |
5 | | -moved between folders or displaced by a folder deletion. Every method here is |
6 | | -an internal helper (underscore-prefixed): the path layer performs NO |
7 | | -permission checks — callers gate corpus permissions *before* reaching these |
8 | | -helpers. |
| 3 | +``CorpusPathService`` holds the low-level :class:`DocumentPath` helpers used |
| 4 | +across the corpus/document layers when documents are moved between folders, |
| 5 | +displaced by a folder deletion, soft-deleted, or restored. The naming |
| 6 | +convention is mixed (a couple of methods are public, the rest are |
| 7 | +underscore-prefixed package-internal helpers) — see the class docstring for |
| 8 | +the distinction. No method here performs permission checks — callers gate |
| 9 | +corpus permissions *before* reaching these helpers. |
9 | 10 |
|
10 | 11 | Split out of the former ``corpus_objs_service.py`` monolith — see |
11 | 12 | ``docs/refactor_plans/2026-05-21-service-layer-phase2-corpus-services-plan.md`` |
|
37 | 38 |
|
38 | 39 |
|
39 | 40 | class CorpusPathService(BaseService): |
40 | | - """Low-level :class:`DocumentPath` disambiguation helpers. |
41 | | -
|
42 | | - All methods are internal helpers (underscore-prefixed) shared by the |
43 | | - folder write operations in |
44 | | - :class:`~opencontractserver.corpuses.services.folders.FolderCRUDService` |
| 41 | + """Low-level :class:`DocumentPath` path-manipulation + signal-replay helpers. |
| 42 | +
|
| 43 | + Shared across the corpus/document layers; they perform NO permission |
| 44 | + checks — the calling code gates corpus permissions first. |
| 45 | +
|
| 46 | + The naming convention is mixed. ``disambiguate_path`` and |
| 47 | + ``reconcile_paths_after_folder_change`` are **public**: ``disambiguate_path`` |
| 48 | + is called throughout the corpus service layer and beyond it — e.g. |
| 49 | + ``Corpus.add_document`` in the model layer and |
| 50 | + ``documents.versioning.restore_document``. The remaining methods are |
| 51 | + underscore-prefixed **package-internal** helpers — NOT class-private. |
| 52 | + ``_dispatch_document_path_created_signals`` in particular is deliberately |
| 53 | + invoked from the bulk write paths in sibling services |
| 54 | + (:class:`~opencontractserver.corpuses.services.folders.FolderCRUDService`, |
| 55 | + :class:`~opencontractserver.corpuses.services.folder_documents.FolderDocumentService`, |
45 | 56 | and |
46 | | - :class:`~opencontractserver.corpuses.services.folder_documents.FolderDocumentService`. |
47 | | - They perform NO permission checks — the calling service is responsible |
48 | | - for gating corpus permissions first. |
| 57 | + :class:`~opencontractserver.corpuses.services.lifecycle.DocumentLifecycleService`) |
| 58 | + after each ``bulk_create`` of path rows, so a cross-service caller reaching |
| 59 | + it is expected, not a leak. |
49 | 60 | """ |
50 | 61 |
|
51 | 62 | @staticmethod |
|
0 commit comments