Skip to content

refactor(image): #314 dedup robustness — scroll fallback + shared attach helper - #335

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

ffroliva merged 1 commit into
developfrom
feature/314-dedup-robustness

Conversation

@ffroliva

Copy link
Copy Markdown
Owner

Summary

Follow-up hardening for #314 (dedup i2i refs), from running the real /code-review (high) and /ponytail:ponytail-review (ultra) on the merged PR #334. Addresses every finding those reviews surfaced:

  • Scroll fallback (correctness — the main finding): _try_select_existing_by_filename now scrolls the virtualised picker grid (_scroll_picker_grid_until_rendered, video i2v: accept an in-project asset (media UUID) as --initial-frame instead of forcing a local-file upload #287) when the match isn't in the initial DOM — so an existing duplicate that's off-screen after a broad search is selected, not silently re-uploaded. The sibling _select_existing_asset already did this; the dedup helper now matches it. Also mitigates a _sync_picker_project switch-then-race.
  • DRY (reuse finding): extracted _attach_selected_tile — the tile-click → wait-hidden → else-include → verify block that was duplicated between _select_existing_asset and the filename path. Both call it now (surface/detail/screenshot/timeout as params, so the media-UUID path's telemetry is byte-identical — its tests pass unchanged).
  • Contract clarity: the docstring now states a found-but-unattachable match RAISES (a real UI failure is surfaced, not a silent re-upload), and notes the exact-filename key misses names Flow sanitizes.

Review to consensus

/code-review (high): [] (clean). /ponytail:ponytail-review (ultra): "Lean. Ship." — the duplication it flagged pre-refactor is resolved. One iteration (the change was built to close the prior findings).

Test plan

  • New unit test for the scroll-fallback path (off-screen match → selected, not uploaded).
  • _select_existing_asset's existing tests pass unchanged → the extraction is behavior-preserving.
  • /gflow:check: ruff clean, pyright src 0/0/0, hygiene (594 files) + doc-links clean, 306 transport tests pass.
  • Live e2e re-verify on ffroliva (project 9d5b9a86, forced classic, credit-free): reference_deduped_by_filename, 0 image_uploaded, status: ok, real 45 KB image — dedup still fires end-to-end after the refactor.

🤖 Generated with Claude Code

…ach helper

Follow-up from the /code-review + /ponytail-review (ultra) pass on #314:

- **Scroll fallback (correctness):** `_try_select_existing_by_filename` now scrolls
  the virtualised picker grid (`_scroll_picker_grid_until_rendered`, #287) when the
  match isn't in the initial DOM — an existing dup that's off-screen after a broad
  search is selected, not silently re-uploaded. (Matches `_select_existing_asset`;
  also mitigates a project-switch race where the grid re-renders.)
- **DRY (reuse):** extracted `_attach_selected_tile` — the tile-click → wait-hidden
  → else-include → verify block that was duplicated in `_select_existing_asset` and
  the filename path. Both now call it (surface/detail/screenshot/timeout as params,
  so the media-UUID path's telemetry is byte-identical; its tests confirm).
- **Contract clarity:** docstring now states a found-but-unattachable match RAISES
  (real UI failure surfaced, not a silent re-upload) and notes the exact-filename
  key misses names Flow sanitises.

New unit test for the scroll-fallback path; `_select_existing_asset`'s existing
tests pass unchanged (extraction behaviour-preserving). pyright 0/0/0, 306 transport
tests green. Live e2e re-verify pending.
@ffroliva
ffroliva merged commit b97a8ea into develop Jul 17, 2026
8 checks passed
@ffroliva
ffroliva deleted the feature/314-dedup-robustness branch July 17, 2026 16:13
@ffroliva ffroliva mentioned this pull request Jul 17, 2026
4 of 5 tasks
15990166686ll-crypto pushed a commit to 15990166686ll-crypto/gflow-cli that referenced this pull request Aug 24, 2026
…ared attach helper (ffroliva#335)

Follow-up from the /code-review + /ponytail-review (ultra) pass on ffroliva#314:

- **Scroll fallback (correctness):** `_try_select_existing_by_filename` now scrolls
  the virtualised picker grid (`_scroll_picker_grid_until_rendered`, ffroliva#287) when the
  match isn't in the initial DOM — an existing dup that's off-screen after a broad
  search is selected, not silently re-uploaded. (Matches `_select_existing_asset`;
  also mitigates a project-switch race where the grid re-renders.)
- **DRY (reuse):** extracted `_attach_selected_tile` — the tile-click → wait-hidden
  → else-include → verify block that was duplicated in `_select_existing_asset` and
  the filename path. Both now call it (surface/detail/screenshot/timeout as params,
  so the media-UUID path's telemetry is byte-identical; its tests confirm).
- **Contract clarity:** docstring now states a found-but-unattachable match RAISES
  (real UI failure surfaced, not a silent re-upload) and notes the exact-filename
  key misses names Flow sanitises.

New unit test for the scroll-fallback path; `_select_existing_asset`'s existing
tests pass unchanged (extraction behaviour-preserving). pyright 0/0/0, 306 transport
tests green. Live e2e re-verify pending.
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