Repository navigation
fix(plugins): follow ShipBob pagination in name matching and search - #14427
Conversation
get_products/get_inventory return a single Page/Limit page, but find_product_candidates, find_inventory_candidates, the WRO inventory-id fallback, and the /tools/get_products search filter all matched or filtered as if the first page were the complete catalog. Products or inventory records beyond page 1 reported 'not found', so a chat request could fail or a WRO could be created against the wrong item. Add _fetch_all_pages to drain bounded pages (with a 25-page safety cap) and use it on every completeness-sensitive path. Verification: python3 -m pytest test_main.py -x -q (66 passed, including 5 new pagination regressions covering multi-page aggregation, short-page termination, the page cap, and a page-2 name match). Failure-Class: FC-single-page-cap-mistaken-for-complete-proof
6424386 to
922b3d9
Compare
|
Verified end to end in a sandboxed container (plugin files at the PR head, network disabled, ShipBob calls mocked): the full plugin suite passes 66/66, and each claim in the description reproduces independently. plugins/omi-shipbob-app/main.py
plugins/omi-shipbob-app/test_main.py
Two non-blocking notes for a possible follow-up:
Clean fix with strong regression coverage — thanks. Leaving the formal approval and merge decision to a human maintainer; no security, privacy, or product-direction concerns found in this diff. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Thanks for the sandbox verification! Both notes make sense — happy to add a |
kodjima33
left a comment
There was a problem hiding this comment.
Confirmed page-1-only bug still on main across find_product_candidates/find_inventory_candidates/tool_get_products search/tool_create_wro fallback. _fetch_all_pages fix is scoped, capped, well-tested (5 new pagination regressions), CI green. Author hridaya423 flagged for twin-account campaign scrutiny (0/17 merged) but this diff is clean on the merits. 4/5.
Fixes #14426
Summary
get_products/get_inventoryinplugins/omi-shipbob-app/main.pyreturn a singlePage/Limitpage, but three call sites treated page 1 as the complete catalog:find_product_candidates/find_inventory_candidatesadvertised "all hits" while reading only the first 100 records; anything later reportedCould not find ..../tools/get_products?search=filtered page 1 client-side, so a matching product past the first 100 returnedNo products found.tool_create_wro's inventory-id fallback scanned page 1 only, so WRO creation could fail withCould not find inventory IDfor a valid product.The fix adds
_fetch_all_pages, which drainsPage/Limitpages until a short page (or a 25-page / 2,500-item safety cap), and wires it into every completeness-sensitive path. Bounded listing calls (limitprovided by the caller) still read one page.Same failure class as the daily-memory-sweep fix:
FC-single-page-cap-mistaken-for-complete-proof. A completeness check implemented as a single bounded page silently fails for accounts bigger than one page.Tests
python3 -m pytest plugins/omi-shipbob-app/test_main.py -x -q: 66 passed (61 existing + 5 new pagination regressions):find_product_candidatesresolves a name living on page 2/tools/get_products?search=finds a product past page 1Also ran the diff-scoped manifest checks directly:
runtime_image_contracts.py check(15 images pass) andplugins/oauth/test_client_log_safety.py(5/5). Localmake preflightfails atworkflow-apt-network-boundsonly because its script buildsbackend/.venvand thewebrtcvadwheel can't compile on this machine's toolchain; unrelated to this diff (triggers are.github/workflows/**).Hermetic tests only; no live ShipBob calls in CI.
Failure-Class: FC-single-page-cap-mistaken-for-complete-proof