Skip to content

fix(server): update ocr & faces after asset edit - #29303

Open
YarosMallorca wants to merge 10 commits into
mainfrom
fix/ocr-after-edit
Open

fix(server): update ocr & faces after asset edit#29303
YarosMallorca wants to merge 10 commits into
mainfrom
fix/ocr-after-edit

Conversation

@YarosMallorca

@YarosMallorca YarosMallorca commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixes #29217 - an issue where the OCR & people wouldn't update properly after an edit on mobile.

How Has This Been Tested?

  • Crop/rotate a photo
  • OCR & People update properly

Please describe to which degree, if any, an LLM was used in creating this pull request.

Initially analyzed and implemented using Claude Opus, manually reviewed and edited by me.

@immich-push-o-matic

Copy link
Copy Markdown

📱 Android release APK (universal)2db907239f8f1127d472263ba3860338218c95ea

Download: https://github.com/immich-app/immich/actions/runs/28094818223/artifacts/7848129884

QR code QR code

Installs as a separate app (applicationId app.alextran.immich.pr29303), so it coexists with the Play Store version and any other PR builds.

@shenlong-tanwen shenlong-tanwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YarosMallorca The OCR table does not update off of visibility so the proper way to do it is to sync and handle both the entities based off of their visibility

@YarosMallorca
YarosMallorca marked this pull request as draft August 3, 2026 15:38
@immich-app immich-app deleted a comment from immich-push-o-matic Bot Aug 8, 2026
@YarosMallorca YarosMallorca changed the title fix: update ocr & faces after asset edit fix(server): update ocr & faces after asset edit Aug 8, 2026
@YarosMallorca
YarosMallorca marked this pull request as ready for review August 9, 2026 20:50
@YarosMallorca

Copy link
Copy Markdown
Collaborator Author

Please test thoroughly before approving/merging. I wasn't able to test much due to my half-broken environment.

@kevinisaac

Copy link
Copy Markdown

was about to work on a fix. rotating an image deleted the ocr text completely without rerunning the job.

looking forward to the merge!

Comment on lines +67 to +68
@UpdateDateColumn()
updatedAt!: Generated<Timestamp>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't even need this, do you? It's simply only been missed to add the @UpdatedAtTrigger

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updatedAt column is required here.
@UpdatedAtTrigger binds to the shared updated_at() function, which sets both new."updatedAt" and new."updateId".
Without the column, every UPDATE on asset_ocr would throw record "new" has no field "updatedAt".
All 25 tables using @UpdatedAtTrigger (incl. asset_face) pair it with an updatedAt column, so should match the existing pattern.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, fair enough

@danieldietzler danieldietzler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shenlong-tanwen feel free to merge if you're happy with it now, too

@shenlong-tanwen

Copy link
Copy Markdown
Member

@YarosMallorca We might need to reset the sync checkpoint for the OCR table so the older rows that were not pushed on visibility update can be synced back to the clients

@danieldietzler

Copy link
Copy Markdown
Member

We actually have no way of knowing which we missed, so that we can only backfil those, right? We have to reset the checkpoint

@shenlong-tanwen

Copy link
Copy Markdown
Member

We actually have no way of knowing which we missed, so that we can only backfil those, right? We have to reset the checkpoint

Yep, Maaaaybe we can handle this client side by calculating the visibility off of the edit table with the same logic as to what the server does, but resetting the sync seems simpler and cleaner for what is a one time migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v3.0.0-rc2] After cropping, OCR results are still positioned as in original image

4 participants