Repository navigation
Add Project.move_images_to_batch and 'annotation batch move' - #565
Conversation
Moves existing images, by IDs or tag, into an annotation batch named or
identified, via POST /{ws}/{proj}/batches/move.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matches the final SLM-156 contract: path, integer skipped, and the per-call cap for image IDs and tags, surfaced with a hint in the CLI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
Co-Authored-By: Claude Opus <noreply@anthropic.com>
…ve (REQ-238) The API answers an unknown --batch-id with a 400 and a 404 only for a key without batch:update or from another workspace, so the hint names the key. The docstring and the adapter test now say the same. Co-Authored-By: Claude Opus <noreply@anthropic.com>
…e limits (REQ-238) The hint matched any error text containing 1000, so an unknown tag such as lot-1000 got it. The SDK docstring and CLI help now name the 20000-image workspace tag cap and the 200-character batch name limit. Co-Authored-By: Claude Opus <noreply@anthropic.com>
PR Review: Add Project.move_images_to_batch and 'annotation batch move' (REQ-238)
Generated by Codex via roboflow-review-pr. Review is advisory; verify before merging. 📋 SummaryAdds SDK and CLI access to regroup existing images without uploading them again. Callers select images by IDs or tag and choose a target by batch ID or name. Named batches are reused or created by the API; the client preserves the server's moved/skipped counts. No correctness, security, or architectural issue requiring changes was identified. The wire contract matches companion API PR #18290, inspected at head 🏗️ Architectural ReviewThe public Project method validates selection and target arguments before delegating to the shared HTTP adapter. The CLI handler follows the existing annotation commands' direct-adapter pattern. Its placement under flowchart LR
P[Project method] --> A[Shared adapter]
C[Annotation CLI] --> R[Project resolver]
R --> A
A --> E[Move API]
E --> O[Batch operation]
O --> S[Source and batch state]
Dependency direction stays consistent. Batch lookup, creation, authorization, tag resolution, and state mutation remain server responsibilities; the SDK introduces no second source of state. The four-field response is minimal and matches the server transport response. The 1000-image cap matches the companion API's constant; broad-tag rejection remains server-side so the client cannot silently move a partial selection. No repository-specific 🐛 Code Quality IssuesNo Critical, Warning, or Minor findings supported by a concrete failure path in the reviewed change. The adapter omits absent fields, retains API error messages and HTTP status, and uses the existing HTTP wrapper. The CLI distinguishes selection errors from API failures, preserves JSON output, and gives a scope-aware 404 hint. Blank strings and malformed IDs that the CLI does not reject locally are still rejected by the API schema; this does not bypass server validation. 💡 Recommendations
These are release/documentation follow-ups, not demonstrated defects in the implementation. 🧪 TestsThe added coverage proves that the SDK delegates both selection/target forms and refuses ambiguous, empty, and over-limit input before calling the adapter. Adapter tests prove the endpoint, authentication parameter, camelCase payload, and preservation of API error status/message. CLI tests prove readable and JSON success output, invalid argument rejection, the image cap, 401/404/400 exit behavior, the permission-oriented 404 hint, and that a tag merely containing Validation: all 54 tests across the three changed test modules pass under Python 3.12 with inherited Initial environment attempts failed independently of the PR: Python 3.15 tried to build the AVIF dependency without native headers; a subsequent Python 3.12 run inherited Python 3.14 Pillow packages and failed SDK fixture imports. Removing ⚖️ Verdict — ✅ ApproveThe change is bounded, follows the existing SDK/CLI architecture, and matches the companion API contract. No actionable merge-blocking regression was found; retain the API deployment check before release. Review timestamp: 2026-11-24 UTC. |
Description
A customer's upload script names each annotation batch after a serial number. Upload dedup leaves images already in the project in their old batch, so the serial's batch holds only the new ones (REQ-238). The API regroups them with an API key since 2026-11-24 (roboflow/roboflow#18290, live in production), but the SDK and CLI on PyPI have no call for it.
What changes:
roboflow annotation batch movemoves unassigned images into a batch, picked by id or by tag;--jsonprints the API's answer.Project.move_images_to_batch(...)does the same from Python.ValueError).batch:update.Tested
--json, exit codes 1/2/3 ·tests/cli/test_annotation_handler.py,TestBatchMovetests/test_project_annotation_administration.pytests/adapters/test_annotation_administration.pylot-1000gets no cap hint ·TestBatchMove; both failed before their fixmain's source; suite 1,294 OK; CI 15 of 15 on9efe3118Evidence
All runs on
9efe3118c6840674369836e98fd2d6e2ccc20bdd, Python 3.12, 2026-11-24.Suite
The 12 tests this PR adds
The same 12 with
roboflow/taken frommain(b0f4aec), tests from this branch. Output cut to the summary and the distinct causes:The two hint tests with
roboflow/taken fromb28014d, the commit before both hint fixes:CLI against a local stand-in for the API. The stand-in's answers are written by hand from the API's contract, so this shows what the CLI sends and prints, not what the API does. Run with
API_URL=http://127.0.0.1:8765 ROBOFLOW_API_KEY=keyand an emptyHOME; the 404 case usesROBOFLOW_API_KEY=other. "loading Roboflow …" lines removed.Requests the stand-in received (the last two commands sent none):
stub.py:Deploy
Ships with the next PyPI release. Docs: roboflow/docs#406, to merge with or after that release.
Your calls
Tony decides: the command lives under
annotation batch, notbatch, because that group is Batch Processing jobs. On a no: moved before the release.Reviewer guide
https://stormy-moment-h7np.here.now/
🤖 Generated with Claude Code