Consolidate duplicated path/PDF helpers into shared leaf modules (#654) - #670
Merged
marcvergees merged 1 commit intoAug 15, 2026
Conversation
marcvergees
approved these changes
Aug 15, 2026
marcvergees
merged commit Aug 15, 2026
491aa49
into
fireform-core:development-approach-b
2 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #654.
Consolidates the helpers that got duplicated across files during the #640/#642 refactors
into two shared leaf modules:
_FIELD_TYPE_BY_FT.
Both are dependency-free leaves (import only pathlib/pdfrw/fastapi, nothing from
app.services/app.api), which is what dissolves the circular import (template → controller →
file_manipulator → filler → template) that forced the duplication in the first place.
forms.py, form.py, template.py, filler.py, and purge.py now import from these instead of
holding their own copies.
Three things worth flagging (beyond a pure move):
AppError, template.py raised HTTPException. The exception is swallowed at every observable
call site, so I standardized on HTTPException (the only choice provably behavior-identical
everywhere, including the one path where the type could theoretically surface).
came along too (pdf_utils reaches PROJECT_ROOT via app.core.paths, an app.core→app.core
ref, not reopening the cycle).
_safe_delete_file (different logic) left untouched.
Behavior-preserving — 155 tests pass with only monkeypatch-location changes (the 6
PROJECT_ROOT patches now target app.core.paths.PROJECT_ROOT via module-attribute access, so
one patch covers all callers). ruff check app/ clean. Each helper is now defined in exactly
one place.