feat(logging): persistent state/audit log, configurable OCR scale, and temporal baseline fix - #24
Merged
Merged
Conversation
Logging:
- Replace per-run rename-log-{timestamp}.json with rename-state.json
(small file, overwritten each run) and rename-log.json (append-only
audit log, deduplicated on OriginalFile)
- Prior state loading uses a 3-level fallback: state file → audit log →
output directory scan
- Add -StartOdometer parameter to seed odometer on first-ever run
- Remove $reportsDir, $logFile, and timestamped log approach
OCR:
- Add -ScalePct parameter to Get-OdometerReading; decode image at
configurable percentage before OCR (default 25%)
- Thread OcrScalePercent setting through Add-OcrToPhotoContext and
main body; reads from settings.json key OcrScalePercent
closes #22
… batch All three file-based fallback levels (rename-state.json, rename-log.json, directory scan) now ignore entries whose datetime is >= the earliest EXIF datetime in the source batch. A batch ExifTool pre-pass collects that lower bound before the fallback chain runs. Level 3 also now populates lastGoodDateTime from the selected filename so time-bound validation works after a directory-scan fallback. Without this fix, processing a batch of older photos when newer photos are already in the output folder would cause all readings to fail with "Odometer decreased" because the baseline was pulled from a more recent run.
The -Source parameter was unconditionally overwritten by settings.json Paths.Source, unlike every other parameter which checks $PSBoundParameters.ContainsKey() first. Added the same guard so a command-line -Source takes precedence over settings. This caused the -WhatIf Pester test to silently run against the settings-defined source folder instead of the empty temp folder passed by the test.
When the source folder is empty the pipeline produces no output and the variable is $null rather than an empty array. Accessing .Count on $null throws PropertyNotFoundException. @() ensures an empty array in all cases.
This was referenced Apr 30, 2026
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.
Summary
rename-state.json(last-good state) andrename-log.json(full audit log); prior state survives across runs without needing to scan filenamesOcrScalePercentsetting so OCR decode resolution can be tuned per deploymentTest plan
.\scripts\Rename-Photos.ps1 -WhatIfon a folder of unprocessed photos — confirm no files are renamed and no state is writtenlogs/rename-state.jsonandlogs/rename-log.jsonare written with correct entriesOcrScalePercentinsettings.jsonand confirm OCR behaviour changes accordinglyInvoke-Pester tests/