Skip to content

refactor: replace OpsProducer pipeline with assembler registry#309

Merged
knipknap merged 6 commits into
mainfrom
refactor/assembler-registry-pipeline
Jul 15, 2026
Merged

refactor: replace OpsProducer pipeline with assembler registry#309
knipknap merged 6 commits into
mainfrom
refactor/assembler-registry-pipeline

Conversation

@knipknap

@knipknap knipknap commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the old OpsProducer-based pipeline with a new assembler registry architecture driven by Step subclasses.

Key changes

  • Step.get_assembler_kwargs() replaces AssemblerMeta.resolve_params — each step subclass provides typed attributes and a method to produce assembler kwargs from MachineDefaults + workpiece
  • ASSEMBLER_NAME ClassVar on each Step subclass replaces the old step.assembler_name field
  • assembler_params dict eliminated — step subclasses store real typed attributes, serialized via to_dict/from_dict
  • MachineDefaults dataclass wired through the pipeline (kerf, arc tolerance, step power, tool radius, step over, cut speed, etc.)
  • Step threaded through pipeline instead of separate assembler_name/assembler_params — all internal functions read step.ASSEMBLER_NAME and call step.get_assembler_kwargs()
  • AssemblerRegistry with _register_laser_assemblers() fallback for worker subprocesses that lack the addon manifest
  • AddonManager.task_mgr now a required constructor parameter, passed at construction time in context.py so _build_and_update_manifest() always finds shared_state — this fixes worker subprocess step deserialization for lite_context tests
  • set_task_manager method removed (redundant)
  • _ensure_assemblers_registered conftest fixture removed (assembler registry fallback handles it)
  • _STEP_TYPE_TO_ASSEMBLER hack removed from compute_workpiece_artifact — Step.from_dict() dispatches correctly via step_registry

Tests

  • Added get_assembler_kwargs and to_dict/from_dict roundtrip tests for all 6 step subclasses
  • Fixed pipeline test arg indices (args[7] to args[5]) for removed positional params
  • Removed addon imports from core pipeline tests
  • All AddonManager test constructors updated to pass MagicMock() as task_mgr

- Remove AssemblerMeta.resolve_params in favor of Step.get_assembler_kwargs()
- Replace step.assembler_name/assembler_params with ASSEMBLER_NAME ClassVar
  and real typed attributes on each Step subclass
- Add MachineDefaults dataclass wired through the pipeline
- Thread Step through pipeline instead of separate assembler_name/params
- Add AssemblerRegistry with _register_laser_assemblers fallback for workers
- Make task_mgr a required parameter on AddonManager, passed at construction
  so _build_and_update_manifest always finds shared_state
- Remove set_task_manager method (redundant with constructor parameter)
- Remove _ensure_assemblers_registered conftest fixture (assembler registry
  fallback handles it)
- Step.from_dict dispatches via step_registry; workers get addon manifest
  through shared_state automatically
- Remove _STEP_TYPE_TO_ASSEMBLER hack from compute_workpiece_artifact
- Add to_dict/from_dict roundtrip and get_assembler_kwargs tests for all
  step subclasses
- Clean up pipeline test args indices (args[7] -> args[5])
- Remove addon imports from core pipeline tests
knipknap added 2 commits July 15, 2026 02:04
- Add orchestration ClassVars to Step base (IS_VECTOR, SPLIT_CONTOURS,
  SET_POWER, NORMALIZE_WINDINGS, ALWAYS_WRAP, SECTION_TYPE) and
  override on each Step subclass - replaces AssemblerMeta fields
- Delete AssemblerMeta class entirely; AssemblerRegistry becomes a
  plain name -> Callable map with no param_keys filtering
- Add set_step_property() helper to StepComponentSettingsWidget base
  for undoable step attribute writes via ChangePropertyCommand
- Migrate contour, frame, shrinkwrap, wavefront, and raster widgets
  to read/write step attributes directly instead of opsproducer_dict
- Add override_threshold, threshold to ContourStep and dither_algorithm
  to EngraveStep (previously only on producers)
- Fix Step.from_dict to delegate to step_class.from_dict(data) so
  subclass attributes are deserialized correctly
- Remove _register_laser_assemblers() hardcoded fallback from registry
  (consistent with ProducerRegistry/StepRegistry pattern)
- Simplify all assembler registration calls (no AssemblerMeta wrapper)
- ShrinkWrapStep imports prepare_surface directly from rayforge.image
- Fix UnboundLocalError from local logger shadowing module-level logger
- Delete all producer files: OpsProducer, ProducerRegistry, PlaceholderProducer,
  and all 6 laser producer implementations (contour, frame, shrinkwrap,
  raster, wavefront, material_test_grid)
- Remove register_producers hook spec, registration table entry, and all
  implementations (laser_worker, sketcher)
- Move CutSide/CutOrder enums to rayforge/core/cut_side.py
- Migrate material test widget + command to step attributes (no more
  opsproducer_dict or producer parameters)
- Widget frontend passes 4 args (editor, title, page, step) — no more
  producer arg
- Base class makes component parameter optional with default None
- Add missing_step_types property to Doc (replaces missing_producer_types)
- Clean up all remaining OpsProducer/opsproducer_dict/producer_registry
  references across tests, scripts, and hooks
Re-implement bidirectional raster scan X-offset calibration feature
from main in the new assembler/step architecture (producers were
deleted in this branch):

- EngraveStep: add bidir_x_offset_mm attribute with serialization
- MaterialTestStep: add offset_range attribute, pass min/max_offset to
  assembler, add SPEED_VS_OFFSET grid mode support
- material_test_helpers: add SPEED_VS_OFFSET to GridMode enum, pass
  min/max_offset to draw_preview
- material_test_cmd: add offset_range to _PARAM_KEYS for preview sync
- raster_widget: read bidir_x_offset_mm from self.step (not producer)
- material_test_grid_widget: read offset_range from self.step, fix
  offset handlers to use tuple signature of _update_range_param
- workpiece_stage: read bidir_x_offset_mm from step.to_dict() via
  setdefault instead of deleted opsproducer_dict
- Add BidirScanOffsetTransformer and tests from main (unchanged)
- Update tests for new architecture (no opsproducer_dict references)
@knipknap
knipknap merged commit 729dbb7 into main Jul 15, 2026
26 checks passed
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