Skip to content

refactor: unify component type dispatch + decompose RfSimulatorApp (#51) - #52

Merged
striderZA merged 15 commits into
masterfrom
refactor/component-registry-unification
Aug 6, 2026
Merged

refactor: unify component type dispatch + decompose RfSimulatorApp (#51)#52
striderZA merged 15 commits into
masterfrom
refactor/component-registry-unification

Conversation

@striderZA

Copy link
Copy Markdown
Owner

Summary

Fixes the RfSimulatorApp god-object + six parallel hardcoded type-dispatch tables: adding a component used to touch ~10 files. All dispatch now flows through one extended ComponentTypeRegistry, and the app is decomposed by extracting PFBViewManager and ProjectSerializer.

Related issue

Closes #51

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Documentation

What changed

Phase 1 — unified registry + type_name()

  • IComponentEngine::type_name() pure virtual (canonical lowercase key) on all 11 engines + 2 test engines
  • ComponentTypeRegistry extended to 11 descriptors: project_type, display_name, menu_label, label_prefix, kind, authorable, fields, create() factory, draw_inspector callback; new findByProjectType() (accepts legacy + canonical names)
  • saveProject/loadProject/duplicateComponent dispatch through the registry (.rfsim type strings byte-identical, legacy files still load)
  • ComponentLibrary::instantiate switched to create() + deserialize() — library JSON behavior preserved with 5 key-parity fixes (ADC fs_Hz, mixer conversion_gain_dB, attenuator attenuation_dB, filter string-enum, amplifier enable_nonlinear derivation)
  • Canvas menu data-driven via NodeGraphWidget::setAddableComponents + unified RfSimulatorApp::addComponent with unconditional markDirty() — fixes the Equalizer not-marking-dirty bug
  • Inspector dispatch via draw_inspector callbacks — also fixes the latent CoaxCable/Equalizer empty-panel-title bug
  • nodeKindFromLabel deleted; NodeGraphWidget::registerNodeKind/kindForLabel data-driven from registry
  • New Component form combo from registry authorable rows

Phase 2 — PFBViewManager (new app/include/pfb_view_manager.h): owns the four lockstep PFB widget/visibility vectors; six hand-rolled rebuild sites collapse to method calls (issue #37 class of bug)

Phase 3 — ProjectSerializer (new app/include/project_serializer.h): .rfsim save/load/new JSON logic extracted; RfSimulatorApp methods become thin wrappers

Tests — new standalone exe tests/test_component_dispatch.cpp (MinGW TEST_CASE ceiling): Equalizer dirty-flag regression (red→green), all-11-types save/load round-trip, legacy .rfsim backward-compat load, registry label_prefix→kind mapping, draw_inspector/create completeness

Docs — DOX pass: app/AGENTS.md, common/AGENTS.md, openwiki/testing/guidance.md

Test plan

  • cmake --build build — clean
  • build/bin/tests.exe — 217 cases / 65522 assertions pass (incl. [project_file] round-trips)
  • build/bin/test_component_dispatch.exe — 5 cases pass
  • build/bin/test_ui.exe — 22/22 pass
  • build/bin/test_issue37_pfb_input_removal.exe, test_component_authoring.exe, test_extensions.exe — pass
  • bash scripts/format.sh --check — clean

Notes

  • Backward compatible: .rfsim type strings and canvas menu labels byte-identical; library JSON schema untouched; legacy capitalized type names still load
  • Known deferred minors (non-blocking, documented in branch): attenuator/amplifier deserialize clamp parity gaps (no current library file triggers them); PFBViewManager::draw() size-guard nit; dead includes in app.h; two openwiki/testing/guidance.md doc nits

@striderZA
striderZA merged commit a4ccbf4 into master Aug 6, 2026
0 of 2 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.

RfSimulatorApp god-object + six parallel hardcoded type-dispatch tables make adding a component touch ~10 files

1 participant