Repository navigation
refactor(worker): Capture date in one place, proxy rows added one way (#283) - #288
Merged
Merged
Conversation
…#283) Month, Day and Year are now set only by MediaAsset.DateCaptured's setter and have private setters, so the flashback index columns cannot drift from the capture date. NewContentWriter and PairedMovResolver share one CaptureDate.FromExifOrLastWrite fallback instead of copying it. Both writers add proxy rows through IMediaAssetRepository.AddProxyFile, selected with the new IngestionContext.ProxyFilesOf(ownerId), instead of the primary's going through the MediaAsset.ProxyFiles navigation. An explicit Add keeps a row with a preset Guid key in the Added state. No schema or model change (docs/schema.sql current, no pending model changes). Closes #283. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IMediaAssetRepository.AddProxyFile becomes AddProxyFiles(IEnumerable), backed by AddRange, so NewContentWriter and PairedMovProxyWriter each hand over their rows in one call instead of repeating the same loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #283.
Summary
Capture date in one place.
Month,DayandYearare set only byMediaAsset.DateCaptured's setter and have private setters. The flashback index columns can no longer drift from the capture date, and #250's in-place update gets them right by assigning the date.The last-write-time fallback for a file without an EXIF date is one helper,
CaptureDate.FromExifOrLastWrite, used by both builders.Proxy rows added one way. Both writers hand their rows to
IMediaAssetRepository.AddProxyFiles(context.ProxyFilesOf(ownerId)), which wrapsAddRange:An explicit Add keeps a row whose
Guidkey is already set in theAddedstate. A row discovered through a navigation can be tracked asModifiedinstead.The schema and the EF model are unchanged:
docs/schema.sqlis current and EF reports no pending model changes. Loading a row writes the backing fields directly, so the setter never runs on read.Evidence
NewContentWriterTests.TryWriteAsync_Always_AddsTheContextsProxyFilesToTheRepositoryAsyncand..._AddsOnlyTheAssetsOwnProxyFilesAsyncfailed, because rows went through the navigation.MediaAssetTests.DateCaptured_Set_SetsTheFlashbackDatePartsfailed, because the parts stayed 0.After: all pass. Also new:
TryWriteAsync_LivePhotoPairWithoutExifDate_DatesEachHalfByItsOwnFileAsync, which dates the HEIC from 2021-03-04 and the MOV from 2021-03-05. It pinned the fallback before the extraction.dotnet format --verify-no-changesis clean.scripts/mutation-changed.sh: 100.00% (77 killed, 0 survived) acrossMediaAsset,CaptureDate, both builders,IngestionContext,PairedMovProxyWriter,MediaAssetRepositoryand the pipeline middlewares the end-to-end blurhash test covers.Merge Danger
Door: two-way
Blast Radius: Worker ingestion writes
No schema change. The risk is EF's insert behaviour on real PostgreSQL. Proxy rows are now separate
Addedentries next to their asset, not children in its navigation, and EF still orders the inserts by foreign key. CI's unit tests don't run against PostgreSQL, so the first real crawl after merge is the end-to-end check.🤖 Generated with Claude Code