feat(items): persistent slice-file download button#873
feat(items): persistent slice-file download button#873blb3d-automation wants to merge 2 commits into
Conversation
…e_path on item API
The intake wizard saves a product's .gcode.3mf but only links it on the
post-create success screen, unreachable after navigating away. Expose the
existing Product.gcode_file_path (set by the PRO intake attach flow, pointing at
GET /api/v1/pro/intake/products/{id}/slice-file) on the item detail + list API,
and add a Slice file download button to the items table so any product with a
saved slice is reprint-ready from a persistent page. Additive only; no new
endpoint (the PRO download route already exists).
Co-authored-by: Claude <claude@anthropic.com>
Agent-Session: blissful-black-900068
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds an optional ChangesSlice file path exposure
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
backend/tests/services/test_item_service.py (1)
1429-1460: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMinor test gap: no list-response “unset” case.
TestSliceFileExposurecovers detail-populated, detail-unset, and list-populated, but not list-unset. Givenlist_itemsandbuild_item_response_datapopulategcode_file_pathvia the sameitem.gcode_file_pathpassthrough, this is low risk, but adding it would fully close the null-safety matrix.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@backend/tests/services/test_item_service.py` around lines 1429 - 1460, The TestSliceFileExposure coverage is missing the list-response unset case for gcode_file_path. Add a test in TestSliceFileExposure that exercises item_service.list_items with a product whose gcode_file_path is not set, then assert the returned row for that SKU has gcode_file_path as None, mirroring the existing detail-unset check and using list_items as the primary symbol to locate the fix.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@backend/tests/services/test_item_service.py`:
- Around line 1429-1460: The TestSliceFileExposure coverage is missing the
list-response unset case for gcode_file_path. Add a test in
TestSliceFileExposure that exercises item_service.list_items with a product
whose gcode_file_path is not set, then assert the returned row for that SKU has
gcode_file_path as None, mirroring the existing detail-unset check and using
list_items as the primary symbol to locate the fix.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7f0c9b2f-3b07-4fd3-8625-9b0e13135d63
📒 Files selected for processing (5)
backend/app/api/v1/endpoints/items.pybackend/app/schemas/item.pybackend/app/services/item_service.pybackend/tests/services/test_item_service.pyfrontend/src/components/items/ItemsTable.jsx
…list Complements the service-layer tests already in this branch with HTTP-level assertions that gcode_file_path is present in the item detail and list API responses when set (and null-safe when unset), matching the delivered persistent slice-file download button. Co-authored-by: Claude <claude@anthropic.com> Agent-Session: blissful-black-900068
Problem
Single-plate intake saves the sliced
.gcode.3mfto the product (ProProductSliceFile+Product.gcode_file_path) with a working download endpoint, but the only UI link is on the intake wizard's success screen — once you navigate away there's no way back to it, so an operator can't fetch the file to send to a printer.Fix
Product.gcode_file_pathonItemResponse(detail) +ItemListResponse(list) — threaded throughbuild_item_response_data,list_items,_build_item_response, and the list endpoint constructor.item.gcode_file_pathis set, pointing at the existingGET /api/v1/pro/intake/products/{id}/slice-file.Tests
TestSliceFileExposureintest_item_service.py: detail + list both surfacegcode_file_pathwhen set, null-safe when unset.Note
Assembly components don't have slice files attached yet (separate worker/wheel work); this button lights up for them automatically once they do.
🤖 Generated with Claude Code
Summary by CodeRabbit
gcode_file_path.nulland the UI link is hidden.gcode_file_pathis correctly returned for both list and detail endpoints.