Skip to content

Add YOLO (Recommended) / YOLO (Perfectionist) flow-ratio calibration methods - #2053

Merged
jpapiez merged 5 commits into
developmentfrom
dev/jpapiez/yolo-calibration-methods
Aug 26, 2026
Merged

Add YOLO (Recommended) / YOLO (Perfectionist) flow-ratio calibration methods#2053
jpapiez merged 5 commits into
developmentfrom
dev/jpapiez/yolo-calibration-methods

Conversation

@jpapiez

@jpapiez jpapiez commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Closes #2051

Summary

OrcaSlicer's flow-ratio calibration dialog offers 4 methods (Pass 1 (Coarse), Pass 2 (Fine), YOLO (Recommended), YOLO (Perfectionist)), but CalibrationMethod.cs only catalogued 3. This adds the two missing YOLO methods to the catalogue, matching the existing wire-name / enum / DefaultModelFileName / RelativeResourcePath pattern, while explicitly guarding against silently mis-slicing them until a follow-up delta-aware configurator exists.

What changed

  • CalibrationMethod.cs: added FlowRateYoloRecommended / FlowRateYoloPerfectionist enum members, wire names (flow_rate_yolo_recommended, flow_rate_yolo_perfectionist), DefaultModelFileName/RelativeResourcePath (Orca-LinearFlow.3mf / Orca-LinearFlow_fine.3mf under filament_flow/), and a new CalibrationMethods.IsSlicerSupported(method) gate (false for the two YOLO methods).
  • SliceJobController.SubmitAsync: after TryParse succeeds, rejects the two YOLO methods immediately (400, calibration_method_not_yet_supported) before the job is queued — so a request that can never succeed doesn't consume a worker slot or job-record lifecycle. Also added CalibrationMethods.ClientAcceptedWireNames (the catalogue minus not-yet-supported methods) so the "Supported methods" text in the unrelated unsupported_calibration_method error never advertises a method the API will reject.
  • OrcaSlicingPipelineService.PrepareCalibrationModel: added an explicit InvalidOperationException guard for the two YOLO methods (defense-in-depth beyond the controller-level rejection), with a message that doesn't leak internal filesystem paths.
  • Test coverage in CalibrationTests.cs and SliceJobControllerCalibrationTests.cs for catalogue entries, TryParse accept/reject, the client-accepted-list filter, the controller rejection ordering (before AddAsync/NotifyJobQueuedAsync), and the worker guard's message contract.

Why not full support yet

OrcaSlicer's YOLO 3MF resources use a delta-based per-object naming scheme (flowrate_0, flowrate_0.01, flowrate_m0.01, …) that's incompatible with the existing FlowRateCalibrationConfigurator, which is built for pass1/pass2's absolute-percentage scheme (flowrate_95, flowrate_102). Wiring YOLO into the existing configurator would silently mis-scale or skip objects rather than fail loudly. Building a correct delta-aware configurator is a separate, larger piece of work — out of scope for this issue, which only asks for the catalogue. Until that lands, submitting these methods is rejected with a clear error rather than silently producing corrupted G-code.

Investigation findings (per issue ask — not implemented)

  • Max volumetric speed / retraction: upstream OrcaSlicer already implements both (Plater::calib_max_vol_speed, Plater::calib_retraction). Nothing upstream blocks them — they're simply not yet built in this repo (no configurator/pipeline wiring here, unlike flow-rate/temperature-tower). Not a licensing or upstream blocker.
  • PA Pattern / PA Line: intentionally left out per the existing GPL-3.0 provenance/licensing note in CalibrationMethod.cs's remarks (not touched/resolved here — expanded the comment to keep this decision durable, not chasing a separate resolution).
  • Second catalogue (src/api/Services/Calibration/CalibrationMethodNames.cs, 12 methods, different wire-name convention): confirmed dead code from the removed calibration-projects saga (its own doc comment references deleted D7/D8 generator subtree dependents). Not reachable from the slice pipeline. Left untouched, as instructed.

Validation

  • dotnet build ./farm-web.sln — 0 errors.
  • Targeted tests: Farm.OrcaSlicer.Worker.Tests.CalibrationTests + Farm.Slicer.Module.Tests (SliceJobControllerCalibrationTests) — all passing.
  • dotnet format ./farm-web.sln --verify-no-changes — clean on all changed files.
  • Merged origin/development into the branch; re-ran targeted tests on the merged result.
  • No EF Core migrations needed (no schema change).

Review

Reviewed by Bishop, Hicks, and Vasquez per repo convention — all three reached unanimous APPROVE at head d0d0a26143d1ddaac75d7556b347534bfbda446e after two rounds of fixes (see verdict comments below).

Copilot AI added 5 commits August 25, 2026 19:45
…thods

Closes #2051

- Add FlowRateYoloRecommended/FlowRateYoloPerfectionist to CalibrationMethod
  enum with wire names, DefaultModelFileName, and RelativeResourcePath
  matching upstream OrcaSlicer's Orca-LinearFlow.3mf/Orca-LinearFlow_fine.3mf
  resources (filament_flow/ directory).
- Guard OrcaSlicingPipelineService.PrepareCalibrationModel to fail loudly for
  the two new methods instead of silently mis-slicing: their bundled 3MF
  resources encode per-object flow ratios as baseline-relative deltas
  (flowrate_0.01, flowrate_m0.01), incompatible with the existing
  FlowRateCalibrationConfigurator parser built for absolute percentages
  (flowrate_95). A delta-aware configurator is follow-up work.
- Document investigation findings in CalibrationMethod.cs remarks:
  max_volumetric_speed/retraction are not blocked upstream, simply not yet
  built here (contrast with PA Pattern/PA Line's real GPL-3.0 provenance
  blocker).
- Add test coverage: TryParse acceptance/rejection for the new wire names,
  DefaultModelFileName/RelativeResourcePath, and a guard test asserting
  PrepareCalibrationModel throws for both new methods.
Address review findings (Hicks, Vasquez):
- Add CalibrationMethods.IsSlicerSupported(), and reject
  FlowRateYoloRecommended/FlowRateYoloPerfectionist in SliceJobController
  before a job is ever queued, instead of only failing late in
  OrcaSlicingPipelineService.PrepareCalibrationModel after a worker has
  already claimed the job (Vasquez: fail-late robustness/DoS concern).
- Assert the worker guard's exception message content, not just its type,
  so a test failure actually catches a regression in the fail-loud
  contract (Hicks).
- Add controller-level test coverage confirming the two YOLO methods are
  rejected with calibration_method_not_yet_supported before AddAsync/
  NotifyJobQueuedAsync are ever called.
Bishop's round-2 review found that CalibrationMethods.SupportedWireNames
(used to build the 'unsupported_calibration_method' error message) still
listed the two YOLO wire names, even though submitting them is rejected
with a different error (calibration_method_not_yet_supported). A client
hitting an unrelated unsupported-method error would be told those two
methods are supported, when they are not.

Add CalibrationMethods.ClientAcceptedWireNames: the subset of
SupportedWireNames for which IsSlicerSupported is true. Use it in
SliceJobController's 'Supported methods' error text instead of
SupportedWireNames, which keeps its original meaning (every wire name
TryParse/ToWireName round-trip against) for that invariant's test.

Add regression coverage: a controller test asserting the YOLO wire names
never appear in the unsupported-method error's supported list, and a
catalogue-level test asserting ClientAcceptedWireNames excludes exactly
the two YOLO methods.
TryParse's XML doc still said an unrecognized-or-not-yet-supported name
returns false, but the two YOLO methods are intentionally catalogued and
parse successfully (true) despite not being slicer-supported yet. Update
the doc to describe the actual two-tier contract: TryParse gates the
catalogue, IsSlicerSupported/ClientAcceptedWireNames gate client
submission.
@github-actions github-actions Bot added the squad Squad triage inbox — Lead will assign to a member label Aug 26, 2026
@jpapiez

jpapiez commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

Squad-Reviewer: bishop
Squad-Verdict: APPROVE
Squad-Head-SHA: d0d0a26

@jpapiez

jpapiez commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

Squad-Reviewer: hicks
Squad-Verdict: APPROVE
Squad-Head-SHA: d0d0a26

@jpapiez

jpapiez commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

Squad-Reviewer: vasquez
Squad-Verdict: APPROVE
Squad-Head-SHA: d0d0a26

CalibrationMethod.FlowRatePass1 => Path.Combine("filament_flow", "flowrate-test-pass1.3mf"),
CalibrationMethod.FlowRatePass2 => Path.Combine("filament_flow", "flowrate-test-pass2.3mf"),
CalibrationMethod.TemperatureTower => Path.Combine("temperature_tower", "temperature_tower.drc"),
CalibrationMethod.FlowRateYoloRecommended => Path.Combine("filament_flow", "Orca-LinearFlow.3mf"),
CalibrationMethod.FlowRatePass2 => Path.Combine("filament_flow", "flowrate-test-pass2.3mf"),
CalibrationMethod.TemperatureTower => Path.Combine("temperature_tower", "temperature_tower.drc"),
CalibrationMethod.FlowRateYoloRecommended => Path.Combine("filament_flow", "Orca-LinearFlow.3mf"),
CalibrationMethod.FlowRateYoloPerfectionist => Path.Combine("filament_flow", "Orca-LinearFlow_fine.3mf"),
@jpapiez
jpapiez merged commit b2fc6b5 into development Aug 26, 2026
32 checks passed
@jpapiez
jpapiez deleted the dev/jpapiez/yolo-calibration-methods branch August 26, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

squad Squad triage inbox — Lead will assign to a member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calibration slice pipeline supports 3 methods; OrcaSlicer offers 4 flow-ratio methods alone (YOLO Recommended/Perfectionist missing)

3 participants