bambuddy/backend/tests/unit/services
maziggy 15ea11e10b Recover the preview slice from custom G-code the sidecar cannot parse
Opening the slice dialog on an unsliced project runs a preview slice purely
to ask the slicer which AMS slots the chosen plate consumes. Bambu Studio 2.8
writes {if timelapse_inline_photo} into the machine's time_lapse_gcode but
exports no definition for that variable, so the template is unresolvable the
moment it leaves Studio: an older sidecar stops with a placeholder parse error
before producing any slice_info. The preview returned nothing and the caller
fell back to guessing from painted faces, silently. On the H2D project this
was found with, the guess dropped the support material -- a whole slot off a
four-filament plate.

Retry the preview once with just the named template emptied, still on the
file's own settings. Keeping the embedded settings is what keeps the answer
honest: overriding the process preset instead discards the project's support
configuration, which loses that slot and moves used_g by up to 2x. Measured
against the same file: retry reproduces all four slots gram for gram, a
printer+process override returns three.

Only templates that cannot extrude are eligible -- a start or filament-change
template lays a prime line or purges, so emptying one would move the very
grams the preview reports, and returning nothing beats a confident wrong
number. Verified on a working H2D slice that emptying time_lapse_gcode leaves
every used_g/used_m in slice_info identical.

Match on a normalised option name: the slicer reports timelapse_gcode while
the 3MF stores time_lapse_gcode, so a literal comparison finds nothing.

Decide whether a retry applies before logging, so a slice that recovers does
not announce itself at WARNING twenty seconds before it succeeds.
2026-08-10 15:44:55 +02:00
..
__init__.py
conftest.py Stop retrying a printer whose FTPS handshake fails, and name the cause (#2780) 2026-08-08 09:00:03 +02:00
mock_ftp_server.py
test_archive_copy.py
test_archive_display_stem.py
test_archive_plate_validation.py
test_archive_service.py
test_attach_timelapse_safe_path.py
test_backup_path.py fix(backup): diagnose an unwritable backup path instead of quoting errno 30 (#2544) 2026-07-12 08:44:53 +02:00
test_bambu_cloud.py Stop the Bambu Cloud TOTP tests reaching the network 2026-08-02 11:45:53 +02:00
test_bambu_ftp.py Stop retrying a printer whose FTPS handshake fails, and name the cause (#2780) 2026-08-08 09:00:03 +02:00
test_bambu_mqtt.py Stop auto-drying re-arming into a threshold it can never reach (#2770) 2026-08-08 12:40:17 +02:00
test_camera_capture_coalescing.py fix(camera): share one connection between concurrent one-shot captures (#2705) 2026-07-30 09:49:56 +02:00
test_camera_diagnose.py fix(camera): share one connection between concurrent one-shot captures (#2705) 2026-07-30 09:49:56 +02:00
test_camera_fanout.py fix(camera): stop /camera/stop from letting a second socket open (#2521) 2026-07-14 11:52:56 +02:00
test_camera_profiles.py
test_camera_rotation.py fix(camera): rotate every still exactly once, and cover the sources that let ffmpeg write the file 2026-07-31 09:30:06 +02:00
test_camera_tls_proxy.py
test_email_service.py
test_external_camera.py
test_external_camera_capture_coalescing.py fix(camera): redact credentials, contain failures, and stop the external-camera test claiming a connection it never opened 2026-07-31 08:47:57 +02:00
test_external_spool_change.py fix(inventory): reconcile external-spool assignment when its filament type changes (#2575) 2026-07-16 09:47:21 +02:00
test_filament_deficit.py Check filament deficit for Library-backed queue items (#2779) 2026-08-06 12:21:50 +02:00
test_filament_requirements.py
test_finance_service_billing.py implemented pr (worth fixing) feedback 2026-08-06 20:27:25 +02:00
test_finance_service_defaults.py implemented pr (worth fixing) feedback 2026-08-06 20:27:25 +02:00
test_ftp_profiles.py fix(ftp): cap H2C FTPS to TLS 1.2 so the sliced 3MF downloads reliably (#2582) 2026-07-18 09:33:22 +02:00
test_hms_actions.py
test_hms_errors.py
test_homeassistant_list_entities.py
test_label_renderer.py
test_layer_timelapse.py Merge branch 'dev' into fix/camera-rotation-finish-photo-timelapse 2026-07-31 09:33:35 +02:00
test_ldap_service.py Survive a directory that defines no posixGroup class (#2769) 2026-08-05 11:14:57 +02:00
test_log_health.py
test_long_lived_tokens.py fix(overlay): authenticate the OBS overlay with a token when login is enabled (#2613) 2026-07-20 13:04:35 +02:00
test_loop_watchdog.py
test_makerworld.py fix(cloud): only sign out on Bambu's real token-expiry 401, not any 401 2026-07-21 07:26:19 +02:00
test_mqtt_smart_plug_subscribe.py
test_network_utils.py
test_notification_service.py implemented pr (worth fixing) feedback 2026-08-06 20:27:25 +02:00
test_notification_write_lock.py Stop auto-drying re-arming into a threshold it can never reach (#2770) 2026-08-08 12:40:17 +02:00
test_obico_actions.py
test_orca_cloud.py feat(orca-cloud): pair via RFC 8628 device flow, replacing the paste-based sign-in 2026-07-17 08:16:35 +02:00
test_p2s_accessory_fans.py fix(printers): don't retract a fan kit on a partial airduct frame 2026-07-30 18:04:38 +02:00
test_plate_detection.py
test_plate_thumbnail.py
test_plug_energy_history.py fix(smart-plugs): read a REST plug's lifetime counter, and derive Today/Yesterday from it (issue #2539) 2026-07-11 14:22:31 +02:00
test_preset_resolver.py
test_print_cost_estimate.py implemented pr (worth fixing) feedback 2026-08-06 20:27:25 +02:00
test_print_dispatch_context.py fix(camera): take the finish photo when the print ends, not when its last layer starts (#2547) 2026-07-31 12:55:05 +02:00
test_printable_objects_plate.py fix(skip-objects): scope the object list to the plate being printed (#2522) 2026-07-11 09:18:35 +02:00
test_printer_diagnostic.py Stop retrying a printer whose FTPS handshake fails, and name the cause (#2780) 2026-08-08 09:00:03 +02:00
test_printer_manager.py Resolve the H2C rack nozzle at dispatch instead of letting firmware pick (#2800) 2026-08-10 08:54:44 +02:00
test_rest_smart_plug.py Security hardening (maziggy/bambuddy-security #8) 2026-07-31 08:18:05 +02:00
test_slice_dispatch_progress.py
test_slice_preview.py Recover the preview slice from custom G-code the sidecar cannot parse 2026-08-10 15:44:55 +02:00
test_slicer_3mf_convert.py fix(slice): report a finished slice once, not once per queued poll 2026-07-30 17:14:07 +02:00
test_slicer_api.py Add auto-orient and auto-arrange to server-side slicing (#2548) 2026-08-03 14:10:02 +02:00
test_slicer_filament_resolver.py
test_slot_preset_writer.py
test_smart_plug_manager.py fix(smart-plugs): don't blank printer state when an accessory plug switches off (#2629) 2026-07-22 09:57:27 +02:00
test_spool_assignment_notifications.py
test_spool_tag_matcher.py
test_spoolman_service.py
test_spoolman_slot_mapping_fallback.py Read the printer's own slot mapping when Spoolman has none (#2768) 2026-08-05 11:04:59 +02:00
test_spoolman_tracking.py
test_spoolman_tray_split.py
test_start_print_busy_guard_2598.py fix(dispatch): don't send start-print to a busy printer; scheduler defers (#2598) 2026-07-18 16:41:15 +02:00
test_stl_thumbnail.py
test_tailscale.py
test_tasmota.py
test_total_layers_print_start.py fix(mqtt): keep the layer total that arrives with the print-start frame (#2702) 2026-07-30 15:11:08 +02:00
test_usage_tracker.py
test_virtual_printer.py fix(vp): gate the slicer's AMS pick behind the toggle and scope its badges (#2700) 2026-07-31 16:16:39 +02:00
test_vp_diagnostic.py Add CAP_NET_BIND_SERVICE everywhere the service is defined (#2549) 2026-08-04 08:33:30 +02:00
test_vp_ftp_port_slicing.py