chore: refactor store_files#42
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #42 +/- ##
=======================================
Coverage 99.97% 99.97%
=======================================
Files 103 105 +2
Lines 6952 6973 +21
Branches 220 221 +1
=======================================
+ Hits 6950 6971 +21
Misses 1 1
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the fintl store workflow’s result accounting by introducing centralized outcome/count types and updating the file-processing loop to use those types consistently.
Changes:
- Added
FileCounts(TypedDict) andFileOutcome(StrEnum) to standardize file operation outcome keys. - Refactored
store_filesby extracting_process_single_file()and accumulating counts from returned outcomes. - Added a test to keep
FileCountsandFileOutcomein sync.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
tests/common/test_counts.py |
Adds a sync test ensuring outcomes and count keys stay aligned. |
src/fintl/etl/io/store.py |
Refactors store loop into _process_single_file and switches to typed outcome/count tracking. |
src/fintl/common/counts.py |
Introduces the new FileCounts and FileOutcome types. |
src/fintl/common/__init__.py |
Re-exports FileCounts/FileOutcome from fintl.common. |
src/fintl/cli/commands/store/helper.py |
Updates console display helper signature to accept FileCounts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces a new, type-safe system for tracking file operation outcomes in the
fintl storeworkflow. It adds theFileCountsTypedDict andFileOutcomeenum to standardize and centralize the way file operation results are counted and referenced across the codebase. The logic for processing individual files and accumulating results has been refactored to use these new types, improving maintainability and reducing the risk of mismatches between outcome names and count keys.File outcome tracking improvements:
FileCounts(a TypedDict) andFileOutcome(a StrEnum) in the new modulefintl.common.counts, and re-exported them fromfintl.common.__init__. These types provide a single source of truth for file operation outcomes and their counts. [1] [2] [3]FileCountsandFileOutcomeinstead of genericdict[str, int]and string keys. [1] [2] [3] [4]Refactoring and logic changes:
store_filesby extracting_process_single_file, which returns a tuple ofFileOutcomevalues for each file. The main loop now increments counts using these outcomes, ensuring consistency and reducing duplicated logic. [1] [2]dst_dirinstead ofraw_dirin_route_file.Testing:
test_counts_and_outcomes_sync) to ensure that the keys inFileCountsand the members ofFileOutcomealways match, preventing future inconsistencies.