FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix xImage task object key and failure status handling by xiaolu-ai26 · Pull Request #9 · onenodehq/onenode · GitHub

Fix xImage task object key and failure status handling - #9

Open
xiaolu-ai26 wants to merge 1 commit into
onenodehq:mainfrom
xiaolu-ai26:fix-ximage-task-object-key-and-failure-status
Open

Fix xImage task object key and failure status handling#9
xiaolu-ai26 wants to merge 1 commit into
onenodehq:mainfrom
xiaolu-ai26:fix-ximage-task-object-key-and-failure-status

Conversation

Copy link
Copy Markdown

Summary

Fixes two xImage background-task reliability issues found during public-beta QA:

  1. Nested xImage paths break image embedding. Object keys encode nested paths with extra slash segments, for example project/db/items/doc1/meta/image/image.png, but embed_image_task() unpacked exactly six slash-separated values.
  2. If retrieve_from_minio() fails, the exception handler writes public_url before it has been assigned, so the task raises UnboundLocalError instead of marking the field as failed.

Changes

  • Add parse_image_object_key() to preserve nested object paths as dot-notated EmbJSON paths.
  • Generate public_url before the MinIO retrieval try block so failure handling can still write a useful failed status payload.

Validation

Nested object-key parser check:

proj/db/items/doc1/image/image.png => ('proj', 'db', 'items', 'doc1', 'image')
proj/db/items/doc1/meta/image/image.png => ('proj', 'db', 'items', 'doc1', 'meta.image')
proj/db/items/doc1/items/0/image/image.png => ('proj', 'db', 'items', 'doc1', 'items.0.image')
PASS

Failure-handler check with MinIO retrieval stubbed to fail:

[(({'_id': 'doc1'}, {'$set': {'image.xImage.status': 'failed', 'image.xImage.data': 'http://minio/proj/db/items/doc1/image/image.png'}}), {})]
PASS

Also ran:

python3 -m compileall -q celery_tasks/image_tasks.py

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL