fix: job --dry-run would_slice matches real-run slicing decision - #88
Merged
Conversation
`plate job/send <url> --dry-run` predicted `would_slice` from the raw URL-path extension, which is absent for Printables model pages and extension-less direct links. In those cases the predictor returned `would_slice: false`, but the real run downloads a model file (the downloader falls back to `.stl` when it cannot infer an extension) and slices it — so the dry-run pre-check disagreed with what actually happened. Fix: share one slicing predicate between the predictor and the doer. - `_ext_would_slice(ext)` in bambu_cli/job/predict.py is now the single rule (`ext in SLICEABLE_EXTENSIONS`, applied to the single-suffix `_file_extension` so `foo.gcode.3mf` stays print-ready). The real-run local, ZIP-member, and post-download branches in orchestrate.py all route through it. - `_predicted_download_slice_extension(url, args)` resolves the URL's predicted extension by reusing the downloader's own `_download_source_extension`, which falls back to `.stl` for sources whose extension is unknowable offline. `--name` is intentionally ignored because the real download overrides the `--name` extension with the URL/resolved-name extension. `would_slice` remains a boolean; no JSON shape or schema change. Tests: extended the direct-URL dry-run matrix (.stl/.step/.obj/.zip/.3mf and .gcode.3mf), added Printables-model-URL and extension-less-URL predictions, a predictor/doer shared-predicate equivalence test, local .gcode.3mf print-ready, and a ZIP-member matrix (.stl slices, .3mf/.gcode.3mf do not). Strengthened the Printables dry-run agent smoke to assert would_slice=True.
DLANSAMA
force-pushed
the
fix/job-dry-run-would-slice
branch
from
July 29, 2026 18:44
61f089c to
08a4733
Compare
DLANSAMA
added a commit
that referenced
this pull request
Jul 29, 2026
DLANSAMA
added a commit
that referenced
this pull request
Jul 30, 2026
DLANSAMA
added a commit
that referenced
this pull request
Jul 30, 2026
DLANSAMA
added a commit
that referenced
this pull request
Jul 30, 2026
* fix: download/slice/job pipeline correctness from deep audit * fix: kill slicer tree on Ctrl-C; restore #88 changelog; review minors * docs: refresh test-count snapshots after audit-fix merges (1123 collected) --------- Co-authored-by: DLANSAMA <258674612+DLANSAMA@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
plate job/send <url> --dry-run --jsonpredictedwould_slicefrom the rawURL-path extension via
_predicted_url_download_extension, which returnsNonewhen the URL path carries no file extension — the case for Printables model
pages (
/model/12345-foo) and extension-less direct links(
/download?id=1). With no extension, the dry-run branch inbambu_cli/job/orchestrate.pyleftwould_sliceat itsFalsedefault.The real run decides slicing from the downloaded file's extension
(
orchestrate.py:if ext in SLICEABLE_EXTENSIONS). The downloader falls backto
.stlwhen it cannot infer an extension (_download_source_extension), andthe Printables resolver prefers STL/STEP — both sliceable. So the real run
sliced while the dry-run reported
would_slice: false. The predictor and doercomputed "does this need slicing?" differently.
The fix
One shared slicing predicate, used by both paths:
_ext_would_slice(ext)(bambu_cli/job/predict.py) — the single rule:ext in SLICEABLE_EXTENSIONS, applied to the single-suffix_file_extensionso
foo.gcode.3mfis print-ready.3mfon both sides. The real-run local,ZIP-member, and post-download branches in
orchestrate.pyall route throughit.
_predicted_download_slice_extension(url, args)— resolves the URL'spredicted extension by reusing the downloader's own
_download_source_extension, which lands the same.stlfallback the realdownload uses for extension-unknowable sources.
--nameis intentionallyignored because the real download overrides the
--nameextension with theURL/resolved-name extension (
_download_filename_with_extension), so honoringit in the predictor would reintroduce a divergence.
would_slicestays a boolean; no JSON shape /docs/schemaschange. For aPrintables page,
remote_nameremainsnull(unpredictable offline) — the fixdoes not fabricate one.
Test coverage
.stl/.step/.obj→ slice,.zip→ extract,.3mfand.gcode.3mf→ print-ready.test_dry_run_printables_model_url_predicts_slice— the regression: Printablesmodel page now reports
would_slice: true,remote_name: null.test_dry_run_extensionless_url_predicts_slice—?id=1predicts slicing.test_predictor_and_doer_share_slice_predicate— asserts the predictor'sdecision equals the doer's for the same resolved extension (drift guard).
test_dry_run_local_gcode_3mf_is_print_ready_not_sliced— local.gcode.3mf.test_dry_run_local_zip_member_slice_matches_predicate— ZIP members.stl(slice) vs.3mf/.gcode.3mf(print-ready).would_slice: true.Sabotage-verified: reverting
_predicted_download_slice_extensionto the oldURL-path inference makes the three URL-prediction tests fail with the exact
would_slice False vs Truedivergence; restoring the fix makes them pass.Gates (local)
-m "not live"with coverage: 1018 passed, 84.57% (floor 83)-p bambu_cli: no issues (56 files)-ll: exit 0