Fix orchestration build search preview mode and pagination#153
Fix orchestration build search preview mode and pagination#153
Conversation
Code ReviewGood targeted fix for issue #147. The PR addresses two distinct bugs — the missing What's fixed1. Response shape bug (most important) — Before this PR, return {
"data": formatted.get("builds", []),
"next_page_token": formatted.get("next_page_token"),
}This was the silent data-loss bug, and it's fixed correctly. 2. ConcernsStyle inconsistency in The dict is initialized empty and then mutated on the next line, while # Current (inconsistent)
kwargs: Dict[str, Any] = {}
kwargs["preview"] = True
# Better — matches search_builds_paginated style
kwargs: Dict[str, Any] = {"preview": True}Root cause left open Issue #147 identifies the root cause as Test gap — multi-page pagination
def test_search_builds_paginated_collects_multiple_pages(...):
# page 1 returns next_page_token, page 2 returns None
# assert len(result.data) == 2 (one build per page)
# assert mock_build_class.search.call_count == 2This would give confidence that the shape fix is exercised end-to-end. MinorThe new assertion added to the pre-existing Overall: the bug fixes are correct and the added tests are a good start. The three items above (style nit, root-cause tracking, multi-page test) are worth addressing before merge, with the multi-page test being the most valuable. |
- Standardize search_builds() kwargs to inline dict initialization, matching the style used in search_builds_paginated() - Add explanatory comment about the builds→data key remapping needed for _paginate_response compatibility - Add two-page pagination test that exercises actual multi-page collection with next_page_token handoff https://claude.ai/code/session_01Bq7MNuUjEYUEksyN3bWmCQ
PR Review: Fix orchestration build search preview mode and paginationGood set of fixes here — the core pagination bug is real and the test coverage is a nice addition. A few things worth discussing before merging: Core pagination bug fix (correct)The root cause fix in Issue:
|
| Area | Assessment |
|---|---|
| Pagination bug fix | Correct and well-tested |
preview=True at method level |
Fine — matches SDK usage |
try/except TypeError scope |
Too broad — could mask real errors |
| Client-level global preview side-effect | Worth verifying scope with SDK docs |
| Fallback completeness on older SDKs | Fallback only partial; method-level calls still fail |
| Test duplication | Minor cleanup opportunity |
The pagination fix is the most important change and it's correct. The preview-related fallback logic needs a bit more hardening before it's production-safe.
Code Review (follow-up)The previous two Claude review comments contain some inaccurate observations about this PR. Let me correct those and flag the genuine remaining concern. Corrections to prior reviewsReview 1 made three claims that do not match the actual diff:
Review 2 flagged the What this PR gets right
One genuine concern: 2x SDK calls per page when call-level preview is unsupported
This is probably acceptable for a transient SDK compatibility window, but worth documenting on Minor: no test for paginated preview fallback across multiple pages
Summary
Solid, targeted fix. The double-call concern is minor and can be addressed with a comment or follow-up. Good to merge once the double-call behaviour is at least documented. |
Summary
Testing
Closes #147