Split source-family ingestion-run and source-document upserts into helpers#652
Merged
ktalpay merged 1 commit intoJun 2, 2026
Conversation
ktalpay
deleted the
codex/extract-source-document-and-ingestion-run-upsert-helpers
branch
June 2, 2026 15:05
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.
Motivation
Description
src/carbonfactor_parser/persistence/postgresql_source_family_upserts.pyexposingensure_ingestion_run(connection, master: SourceFamilyMasterRecord) -> Noneandensure_source_document(connection, master: SourceFamilyMasterRecord) -> Noneand a local_executehelper; exports added via__all__.ingestion_run_uuid,source_document_uuid) and continued use ofsource_family_postgresql_valueand checksum/URI fallbacks.src/carbonfactor_parser/persistence/postgresql_source_family_repository.pyto callensure_ingestion_run(self._connection, master)andensure_source_document(self._connection, master)in place of the previously inline helper methods, leaving transaction/execute/fetch/_redact helpers in the repository module.tests/test_postgresql_source_family_repository.pythat validate the extracted helpers target the correct SQL, use deterministic UUIDs andsource_family_postgresql_value, preserve artifact/source-document fallbacks and checksum fallback ("checksum-unavailable"), and retainON CONFLICT ... DO NOTHINGsemantics.Testing
python -m pytest tests/test_postgresql_source_family_repository.pyand observed all tests in that file passed (21 passed, 1 skipped).python -m pytest tests/test_configured_cycle_runner.py tests/test_ingestion_run_history_mapping.py tests/test_ingestion_run_history_repository.py tests/test_ingestion_run_history_reader.pyand observed all tests passed (50 passed).python -m pytestand observed success (2162 passed, 8 skipped).python -m ruff check src/carbonfactor_parser/persistence/postgresql_source_family_repository.py src/carbonfactor_parser/persistence/postgresql_source_family_upserts.py tests/test_postgresql_source_family_repository.pyandgit diff --checkand observed no issues.Codex Task