Skip to content

feat: delete thin facade pass-throughs and break service→shim circular imports (RFC #20)#27

Merged
longieirl merged 7 commits intomainfrom
feat/rfc-20-delete-facade-passthroughs
Mar 24, 2026
Merged

feat: delete thin facade pass-throughs and break service→shim circular imports (RFC #20)#27
longieirl merged 7 commits intomainfrom
feat/rfc-20-delete-facade-passthroughs

Conversation

@longieirl
Copy link
Copy Markdown
Owner

Summary

Closes #20

  • Broke the service→shim→facade→service circular import chain by rewiring three _classify_row_type methods in PageValidationService, ContentDensityService, and RowMergerService to import directly from extraction.row_classifiers with per-object cached instances
  • Deleted three thin facade modules: content_analysis_facade.py, validation_facade.py, row_classification_facade.py
  • Rewired pdf_table_extractor.py shim to use module-level singletons instead of facade pass-throughs
  • Updated pdf_extractor.py to import directly from services (four lazy facade imports replaced)
  • Added test_facade_modules_deleted architecture guard and test_shim_singletons.py singleton identity tests

Test plan

  • test_facade_modules_deleted — confirms all three facade modules raise ModuleNotFoundError
  • test_no_production_shim_imports — confirms zero production source imports from shim
  • test_shim_singletons.py — confirms module-level singleton identity
  • Full test suite: 1307 passed, 7 skipped, 91.66% coverage

Part of Architecture RFC series

RFC Issue Status
RFC #17 Inject shared RowClassifier chain ✅ Merged PR #22
RFC #18 Decompose PDFTableExtractor god class ✅ Merged PR #23
RFC #19 Collapse redundant orchestration layers ✅ Merged PR #26
RFC #20 Delete thin facade pass-throughs (this PR) 🔀
RFC #21 Unify word-to-row/word-grouping/column-coverage ⏳ Planned

…_type

- Replace row_classification_facade import in PageValidationService with direct row_classifiers import
- Replace row_classification_facade import in ContentDensityService with direct row_classifiers import
- Replace row_classification_facade import in RowMergerService with direct row_classifiers import
- Use cached _classifier instance per object via hasattr guard
…to service singletons

- Delete content_analysis_facade.py, validation_facade.py, row_classification_facade.py
- Rewire pdf_table_extractor.py to import directly from services using module-level singletons
- Remove _looks_like_date and calculate_row_completeness_score from __all__
- Fix pdf_extractor.py to import from services (validation, header_detection) directly
- Rule 3 auto-fix: pdf_extractor.py used validation_facade which would have broken on deletion
- Add test_facade_modules_deleted to test_architecture.py asserting ModuleNotFoundError
- Add test_shim_singletons.py verifying module-level singleton identity
- Update test_no_production_shim_imports docstring/error message to reflect new import targets
@longieirl longieirl merged commit b88aed9 into main Mar 24, 2026
10 checks passed
@longieirl longieirl deleted the feat/rfc-20-delete-facade-passthroughs branch March 24, 2026 21:07
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.

RFC: Delete thin facade pass-throughs and break service→shim circular imports

2 participants