Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): safer metadata extraction during image upload #7747

Merged
merged 8 commits into from
Mar 7, 2025

Conversation

psychedelicious
Copy link
Collaborator

@psychedelicious psychedelicious commented Mar 6, 2025

Summary

  • Add a utility to extract metadata/workflow/graph from an image.
  • Fix typing for the metadata parameter int he upload route (was previously too wide, accepting any JsonValue when only stringified JSON dict is valid).
  • Use the new util in the route.
  • Add tests for the util.

Related Issues / Discussions

offline discussion

QA Instructions

We need to test that metadata is retained as expected after images are downloaded and then uploaded. There are 3 places to test:

Send to gallery metadata
  • Generate an image in using send-to-gallery
  • Download the image
  • Upload it into Invoke
  • Confirm that the metadata shows up
  • Confirm that the graph tab of metadata still shows the graph
  • Load workflow from image (which will build a workflow from this graph, it should use the auto-layout)
  • Confirm the workflow looks correct - no errors
Send to canvas metadata
  • Generate an image using send-to-canvas, accept it as a raster layer
  • Click Save Canvas to Gallery
  • Download the saved canvas
  • Upload it back into Invoke
  • Check the metadata - it should show the raster layer as json
Workflow Editor metadata
  • Generate an image in Workflow Editor
  • Download it
  • Upload it
  • Confirm you can still load the workflow from the uploaded image (it will load from the workflow directly and should look the same as it did when you generated the image)

Merge Plan

n/a

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added api python PRs that change python files frontend PRs that change frontend files python-tests PRs that change python tests labels Mar 6, 2025
There's a pydantic thing that causes the graphs to fail validation erroneously. Details in the comments - not a high priority to fix but we should figure it out someday.
@psychedelicious psychedelicious merged commit b9c7bc8 into main Mar 7, 2025
15 checks passed
@psychedelicious psychedelicious deleted the psyche/feat/api-metadata-extractoin branch March 7, 2025 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api frontend PRs that change frontend files python PRs that change python files python-tests PRs that change python tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants