Skip to content

feat(items): persistent slice-file download button#873

Open
blb3d-automation wants to merge 2 commits into
mainfrom
feat/slice-file-download-button
Open

feat(items): persistent slice-file download button#873
blb3d-automation wants to merge 2 commits into
mainfrom
feat/slice-file-download-button

Conversation

@blb3d-automation

@blb3d-automation blb3d-automation commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Problem

Single-plate intake saves the sliced .gcode.3mf to 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

  • Backend (additive): expose Product.gcode_file_path on ItemResponse (detail) + ItemListResponse (list) — threaded through build_item_response_data, list_items, _build_item_response, and the list endpoint constructor.
  • Frontend: a conditional "Slice file" download button in the items-table actions cell, shown when item.gcode_file_path is set, pointing at the existing GET /api/v1/pro/intake/products/{id}/slice-file.
  • No new endpoint — the PRO download route already exists.

Tests

TestSliceFileExposure in test_item_service.py: detail + list both surface gcode_file_path when 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

  • New Features
    • Item list and item detail responses now include an optional gcode_file_path.
    • The items table now shows a “Slice file” download link when a slice file path is available.
  • Bug Fixes
    • When no slice file path is set, APIs return null and the UI link is hidden.
  • Tests
    • Added API and service tests to confirm gcode_file_path is correctly returned for both list and detail endpoints.

…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
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b3f50707-e6d8-471b-a941-a9529632ce78

📥 Commits

Reviewing files that changed from the base of the PR and between 2970681 and 57f8b33.

📒 Files selected for processing (2)
  • backend/tests/api/v1/test_items.py
  • backend/tests/endpoints/test_items_endpoint.py

📝 Walkthrough

Walkthrough

Adds an optional gcode_file_path field to item schemas, propagates it through item service and API responses, adds backend coverage, and renders a conditional “Slice file” download link in the items table.

Changes

Slice file path exposure

Layer / File(s) Summary
Schema, service, and API propagation
backend/app/schemas/item.py, backend/app/services/item_service.py, backend/app/api/v1/endpoints/items.py
Adds gcode_file_path to item response schemas and includes it in service payloads and item API responses.
Backend test coverage
backend/tests/services/test_item_service.py, backend/tests/api/v1/test_items.py, backend/tests/endpoints/test_items_endpoint.py
Adds backend tests that verify gcode_file_path appears in item detail and list responses and is null when unset.
Frontend download link
frontend/src/components/items/ItemsTable.jsx
Imports API_URL and conditionally renders a Slice file download link from item.gcode_file_path in the items table.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • BLB3DPrinting/filaops#790: Adds the intake flow that stores and exposes the sliced .gcode.3mf file path used here.
  • BLB3DPrinting/filaops#797: Adds backend persistence for the same slice-file path that this PR surfaces through item responses and UI.

Suggested reviewers: Blb3D

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change, but it does not follow the required template and omits Summary, Related Issues, Changes, and checklist items. Rewrite the PR description using the repository template and add the missing Summary, Related Issues, Changes, Testing, and Checklist sections.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding a persistent slice-file download button for items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/slice-file-download-button

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
backend/tests/services/test_item_service.py (1)

1429-1460: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor test gap: no list-response “unset” case.

TestSliceFileExposure covers detail-populated, detail-unset, and list-populated, but not list-unset. Given list_items and build_item_response_data populate gcode_file_path via the same item.gcode_file_path passthrough, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 1cbf636 and 2970681.

📒 Files selected for processing (5)
  • backend/app/api/v1/endpoints/items.py
  • backend/app/schemas/item.py
  • backend/app/services/item_service.py
  • backend/tests/services/test_item_service.py
  • frontend/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
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