Skip to content

feat(image): dedup i2i refs via picker filename search (#314) - #334

Merged
ffroliva merged 1 commit into
developfrom
feature/314-picker-filename-dedup
Jul 17, 2026
Merged

ffroliva merged 1 commit into
developfrom
feature/314-picker-filename-dedup

Conversation

@ffroliva

Copy link
Copy Markdown
Owner

Summary

Fixes #314: image i2i re-uploaded every local reference, piling up duplicate library entries (the reporter's 8× son.jpg). Flow names an uploaded file by its exact filename and the picker search filters on that name — so a repeated ref is now attached by selecting the existing tile instead of re-uploading, without persisting or trusting any media UUID across runs.

New soft helper _try_select_existing_by_filename: syncs the picker to the editor's project (the library is project-scoped, #287), searches the filename, and matches the tile by its image alt (= the exact filename, locale-invariant — the option's accessible name also carries a localized "Image"/"Imagem" suffix, so an exact name match misses). Match → select + include; miss → clear the filter, return False → caller uploads. Wired via an opt-in prefer_existing flag: image i2i opts in; R2V video keeps upload-only (zero video-side change).

Live verification (the deciding evidence)

On ffroliva, project 9d5b9a86 (credit-free), a 2nd i2i of the same ref:

run mode dedup fired re-uploaded result
pre-fix classic ❌ (accessible-name+suffix miss) ✅ led to the alt-match fix
post-fix agentic ✅ reference_deduped_by_filename 0 dedup works cross-cohort (gen then hit the known agentic scrape-timeout — orthogonal)
post-fix classic (forced) ✅ 0 status: ok, real 54 KB JPEG — clean end-to-end

So the dedup fires in both cohorts and does not break generation (classic clean success). The agentic run's TransportTimeoutError is the cohort's pre-existing DOM-scrape flake (#281/#299), not caused by this change.

Test plan

  • 6 unit tests (TestAttachReferencesDedup): match→select-no-upload, miss→clear+upload, no-search-box→upload, prefer_existing routing both ways, default→video-path-unchanged.
  • /gflow:check: ruff clean, pyright src 0/0/0, hygiene + doc-links clean, 305 transport tests pass.
  • Independent code-review: clean (no correctness issues). Ponytail-review: reuses existing machinery, prefer_existing is justified branching — ship.
  • Recon/validation spike: scripts/dev/spike_issue314_picker_filename_search.py.

🤖 Generated with Claude Code

…upload (#314)

`_attach_references` uploaded every local ref, so a repeated ref piled up
duplicate library entries (the reporter's 8× son.jpg). Flow names an uploaded
file by its EXACT filename and the picker search filters on that name, so a
repeat ref can be attached by selecting the existing tile — no duplicate
upload, and without persisting or trusting any media UUID across runs.

New soft helper `_try_select_existing_by_filename`: syncs the picker to the
editor's project (the library is project-scoped, #287), searches the filename,
and matches the tile by its image ALT (= the exact filename, locale-invariant —
the option's accessible name also carries a localised "Image"/"Imagem" suffix,
so an exact name match misses). On a match it selects + includes; on a miss it
clears the filter and returns False so the caller uploads. Wired via a new
opt-in `prefer_existing` flag — image i2i opts in; R2V video keeps upload-only.

Live-verified on ffroliva (project 9d5b9a86, credit-free): a 2nd i2i of
`zzdedupprobe.png` logged `reference_deduped_by_filename`, ZERO `image_uploaded`,
and produced a real image (forced classic via --ui-mode). Dedup also fired in
the agentic cohort. 6 unit tests + spike_issue314_picker_filename_search.py.
@ffroliva
ffroliva merged commit 8f4a1f5 into develop Jul 17, 2026
8 checks passed
@ffroliva
ffroliva deleted the feature/314-picker-filename-dedup branch July 17, 2026 15:15
15990166686ll-crypto pushed a commit to 15990166686ll-crypto/gflow-cli that referenced this pull request Aug 24, 2026
…upload (ffroliva#314) (ffroliva#334)

`_attach_references` uploaded every local ref, so a repeated ref piled up
duplicate library entries (the reporter's 8× son.jpg). Flow names an uploaded
file by its EXACT filename and the picker search filters on that name, so a
repeat ref can be attached by selecting the existing tile — no duplicate
upload, and without persisting or trusting any media UUID across runs.

New soft helper `_try_select_existing_by_filename`: syncs the picker to the
editor's project (the library is project-scoped, ffroliva#287), searches the filename,
and matches the tile by its image ALT (= the exact filename, locale-invariant —
the option's accessible name also carries a localised "Image"/"Imagem" suffix,
so an exact name match misses). On a match it selects + includes; on a miss it
clears the filter and returns False so the caller uploads. Wired via a new
opt-in `prefer_existing` flag — image i2i opts in; R2V video keeps upload-only.

Live-verified on ffroliva (project 9d5b9a86, credit-free): a 2nd i2i of
`zzdedupprobe.png` logged `reference_deduped_by_filename`, ZERO `image_uploaded`,
and produced a real image (forced classic via --ui-mode). Dedup also fired in
the agentic cohort. 6 unit tests + spike_issue314_picker_filename_search.py.
ffroliva added a commit that referenced this pull request Oct 25, 2026
Council review:
- the retry fires only when the ReferenceNotFoundError names a media id this
  run reused; a missing character or an out-of-order chip re-raises at once,
  with no duplicate upload
- a file the upload check refuses keeps its pre-#772 route
- the file size is checked before it is hashed
- a live e2e scenario for a recorded image the project no longer holds
- docs/USAGE.md describes the flow.google.com reuse; #334 -> issue #314
Intorain pushed a commit to Intorain/gflow-cli that referenced this pull request Oct 26, 2026
…ffroliva#772)

On flow.google.com every image i2i uploaded its --ref file again, so a loop
over one character image filled the project's library with copies. The
upload is now recorded in the catalog; a later run in the same project with
the same file (same path, same bytes) mentions the recorded image in place.
A recorded image deleted from the project since is uploaded again, recorded,
and the generation retried once (nothing is submitted before the miss).

Shared by the CLI and the MCP worker. Labs keeps its editor-dialog filename
dedup (ffroliva#334): the transport answers None there and the path is left alone.
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.

Use filename search in media picker to prevent duplicate media uploads

1 participant