Skip to content

Enable compile-time checks for injects - #10618

Merged
kryksyh merged 6 commits into
audacity:masterfrom
kryksyh:compile_time_checks
Mar 31, 2026
Merged

kryksyh merged 6 commits into
audacity:masterfrom
kryksyh:compile_time_checks

Conversation

@kryksyh

@kryksyh kryksyh commented Mar 30, 2026 •

Copy link
Copy Markdown
Member

Resolves: #10609,

  • I signed CLA
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

QA:

  • Effect → Nyquist Prompt opens without crash

  • Valid expression runs and produces output on selected track

  • Invalid code shows an error, doesn't crash

  • Prompt can be opened multiple times without errors

  • Effect menu contains no internal/prompt entries

  • Nyquist effects repopulate correctly after restart, no duplicate

  • Built-in effect (e.g. Amplify) executes correctly

  • Generator (e.g. Tone) inserts audio correctly

  • Playback and record level meters display correctly

  • Record starts, stops, and commits to track as expected

  • Autobot test cases have been run

@kryksyh
kryksyh requested a review from luapmartin March 30, 2026 07:56
@kryksyh kryksyh self-assigned this Mar 30, 2026
@kryksyh
kryksyh force-pushed the compile_time_checks branch from 831ca4e to 1f78382 Compare March 30, 2026 09:29
@coderabbitai

coderabbitai Bot commented Mar 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 243 files, which is 93 over the limit of 150.

⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: a50010b2-32ec-4b0d-9196-0c88df1d40b2

📥 Commits

Reviewing files that changed from the base of the PR and between 410238ee51ae95c344dec1d07af566b771ad66f0 and 907abff.

📒 Files selected for processing (243)
  • au3/libraries/au3-nyquist-effects/NyquistBase.cpp
  • muse_framework
  • src/app/app.h
  • src/app/guiapp.cpp
  • src/app/pluginregistrationapp.cpp
  • src/appshell/iappshellconfiguration.h
  • src/appshell/internal/applicationactioncontroller.h
  • src/appshell/internal/iappmenumodelhook.h
  • src/appshell/internal/platform/win/winframelesswindowcontroller.h
  • src/appshell/internal/sessionsmanager.h
  • src/appshell/internal/startupscenario.h
  • src/appshell/qml/Audacity/AppShell/FirstLaunchSetup/appupdateusageinfopagemodel.h
  • src/appshell/qml/Audacity/AppShell/FirstLaunchSetup/firstlaunchsetupmodel.h
  • src/appshell/qml/Audacity/AppShell/FirstLaunchSetup/signinaudiocompagemodel.h
  • src/appshell/qml/Audacity/AppShell/FirstLaunchSetup/workspacelayoutpagemodel.h
  • src/appshell/qml/Audacity/AppShell/appmenumodel.h
  • src/appshell/qml/Audacity/AppShell/maintoolbarmodel.h
  • src/appshell/qml/Audacity/AppShell/mainwindowtitleprovider.h
  • src/appshell/qml/Audacity/AppShell/projectpagemodel.h
  • src/appshell/qml/Audacity/AppShell/welcomedialogmodel.h
  • src/appshell/qml/Audacity/AppShell/windowdroparea.h
  • src/au3audio/internal/au3audiodevicesprovider.h
  • src/au3cloud/dev/cloudtestsmodel.h
  • src/au3cloud/internal/au3audiocomservice.h
  • src/au3cloud/internal/au3cloudactionscontroller.h
  • src/au3cloud/internal/au3cloudservice.h
  • src/au3cloud/view/accountinfomodel.h
  • src/au3wrap/iau3project.h
  • src/au3wrap/internal/au3project.cpp
  • src/au3wrap/internal/au3project.h
  • src/au3wrap/internal/progressdialog.h
  • src/au3wrap/tests/mocks/au3projectmock.h
  • src/audio/iaudioengine.h
  • src/automation/internal/au3/au3clipgaininteraction.h
  • src/automation/view/clipgainmodel.h
  • src/context/internal/globalcontext.h
  • src/context/internal/uicontextresolver.h
  • src/effects/audio_unit/iaudiouniteffectsrepository.h
  • src/effects/audio_unit/view/audiounitview.h
  • src/effects/audio_unit/view/audiounitviewmodel.h
  • src/effects/builtin/ibuiltineffectsrepository.h
  • src/effects/builtin/view/builtineffectmodel.h
  • src/effects/builtin/view/builtineffectviewloader.h
  • src/effects/builtin_collection/common/generatoreffectmodel.h
  • src/effects/builtin_collection/dynamics/timeline/abstractdynamicseffectinstancemodel.h
  • src/effects/builtin_collection/dynamics/timeline/dynamicsplaystatemodel.h
  • src/effects/builtin_collection/noisereduction/noisereductionviewmodel.h
  • src/effects/effects_base/ieffectsconfiguration.h
  • src/effects/effects_base/internal/abstractviewlauncher.h
  • src/effects/effects_base/internal/effectexecutionscenario.h
  • src/effects/effects_base/internal/effectinstancesregister.h
  • src/effects/effects_base/internal/effectparametersprovider.h
  • src/effects/effects_base/internal/effectpresetsprovider.h
  • src/effects/effects_base/internal/effectpresetsscenario.h
  • src/effects/effects_base/internal/effectsactionscontroller.h
  • src/effects/effects_base/internal/effectsmenuprovider.h
  • src/effects/effects_base/internal/effectsprovider.h
  • src/effects/effects_base/internal/effectsuiactions.h
  • src/effects/effects_base/internal/realtimeeffectservice.h
  • src/effects/effects_base/iparameterextractorregistry.h
  • src/effects/effects_base/view/abstracteffectviewmodel.h
  • src/effects/effects_base/view/destructiveeffectviewerdialogmodel.h
  • src/effects/effects_base/view/effectparameterslistmodel.h
  • src/effects/effects_base/view/effectpresetsbarmodel.h
  • src/effects/effects_base/view/effectsavecontextmenu.h
  • src/effects/effects_base/view/effectsuiengine.h
  • src/effects/effects_base/view/generatedeffectviewermodel.h
  • src/effects/effects_base/view/presetscontextmenumodel.h
  • src/effects/effects_base/view/realtimeeffectviewerdialogmodel.h
  • src/effects/lv2/ilv2effectsrepository.h
  • src/effects/lv2/view/lv2viewmodel.h
  • src/effects/nyquist/internal/nyquistpluginsscanner.cpp
  • src/effects/nyquist/inyquisteffectsrepository.h
  • src/effects/nyquist/nyquisteffectsmodule.cpp
  • src/effects/nyquist/nyquisteffectsmodule.h
  • src/effects/nyquist/nyquistprompt/NyquistPromptView.qml
  • src/effects/nyquist/nyquistprompt/nyquistpromptviewmodel.h
  • src/effects/vst/ivsteffectsrepository.h
  • src/effects/vst/view/vstviewmodel.h
  • src/importexport/export/iexportconfiguration.h
  • src/importexport/export/iffmpegoptionsaccessor.h
  • src/importexport/export/internal/au3/au3exporter.h
  • src/importexport/export/view/channelmappingtableviewmodel.h
  • src/importexport/export/view/customffmpegpreferencesmodel.h
  • src/importexport/export/view/dynamicexportoptionsmodel.h
  • src/importexport/export/view/exportpreferencesmodel.h
  • src/importexport/export/view/metadatamodel.h
  • src/importexport/import/internal/au3/au3importer.h
  • src/importexport/labels/ilabelsconfiguration.h
  • src/importexport/labels/internal/au3/au3labelsexporter.h
  • src/importexport/labels/internal/au3/au3labelsimporter.h
  • src/importexport/labels/view/exportlabelsmodel.h
  • src/playback/internal/au3/au3audiooutput.h
  • src/playback/internal/au3/au3player.h
  • src/playback/internal/au3/au3trackplaybackcontrol.h
  • src/playback/internal/playbackcontroller.h
  • src/playback/internal/playbackuiactions.h
  • src/playback/iplaybackconfiguration.h
  • src/playback/iplaybackmetercontroller.h
  • src/playback/view/common/metermodel.h
  • src/playback/view/common/playbackmetermodel.h
  • src/playback/view/common/playbackstatemodel.h
  • src/playback/view/panels/playbackmeterpanelmodel.h
  • src/playback/view/toolbars/playbacktoolbarbpmitem.h
  • src/playback/view/toolbars/playbacktoolbarcontrolitem.h
  • src/playback/view/toolbars/playbacktoolbarlevelitem.h
  • src/playback/view/toolbars/playbacktoolbartimeitem.h
  • src/playback/view/toolbars/playbacktoolbartimesignatureitem.h
  • src/preferences/qml/Audacity/Preferences/commonaudioapiconfigurationmodel.h
  • src/preferences/qml/Audacity/Preferences/editpreferencesmodel.h
  • src/preferences/qml/Audacity/Preferences/generalpreferencesmodel.h
  • src/preferences/qml/Audacity/Preferences/playbackpreferencesmodel.h
  • src/preferences/qml/Audacity/Preferences/preferencesmodel.h
  • src/project/internal/au3/au3metadata.h
  • src/project/internal/audacityproject.cpp
  • src/project/internal/audacityproject.h
  • src/project/internal/opensaveprojectscenario.h
  • src/project/internal/projectactionscontroller.h
  • src/project/internal/projectautosaver.h
  • src/project/internal/projectprovider.h
  • src/project/internal/projectuiactions.h
  • src/project/iprojectconfiguration.h
  • src/project/irecentfilescontroller.h
  • src/project/tests/audacityproject_tests.cpp
  • src/project/tests/environment.cpp
  • src/project/view/cloudaudiofilesmodel.h
  • src/project/view/cloudprojectsmodel.h
  • src/project/view/cloudprojectstatuswatcher.h
  • src/project/view/projectpropertiesmodel.h
  • src/project/view/projectspagemodel.h
  • src/projectscene/internal/projectsceneactionscontroller.h
  • src/projectscene/internal/projectsceneuiactions.h
  • src/projectscene/internal/projectviewstate.h
  • src/projectscene/internal/projectviewstatecreator.cpp
  • src/projectscene/internal/projectviewstatecreator.h
  • src/projectscene/internal/realtimeeffectpaneltrackselection.h
  • src/projectscene/internal/tapholdshortcut.h
  • src/projectscene/iprojectsceneconfiguration.h
  • src/projectscene/iprojectviewstatecreator.h
  • src/projectscene/projectscenemodule.cpp
  • src/projectscene/tests/projectviewstate_tests.cpp
  • src/projectscene/tests/tracklabelslayoutmanager_tests.cpp
  • src/projectscene/view/common/tracksviewstatemodel.h
  • src/projectscene/view/common/trackviewstatemodel.h
  • src/projectscene/view/historypanel/historypanelmodel.h
  • src/projectscene/view/playcursor/playcursorcontroller.h
  • src/projectscene/view/playcursor/playpositionactioncontroller.h
  • src/projectscene/view/statusbar/selectionstatusmodel.h
  • src/projectscene/view/timeline/playregioncontroller.h
  • src/projectscene/view/timeline/playregionmodel.h
  • src/projectscene/view/timeline/snaptimeformatter.h
  • src/projectscene/view/timeline/timelinecontext.h
  • src/projectscene/view/timeline/timelinecontextmenumodel.h
  • src/projectscene/view/toolbars/audiosetupcontextmenumodel.h
  • src/projectscene/view/toolbars/playbacktoolbarcustomisemodel.h
  • src/projectscene/view/toolbars/playbacktoolbarmodel.h
  • src/projectscene/view/toolbars/projecttoolbarmodel.h
  • src/projectscene/view/toolbars/snaptoolbaritem.h
  • src/projectscene/view/toolbars/undoredotoolbarmodel.h
  • src/projectscene/view/toolbars/workspacestoolbarmodel.h
  • src/projectscene/view/trackruler/trackrulermodel.h
  • src/projectscene/view/tracksitemsview/au3/connectingdotspainter.h
  • src/projectscene/view/tracksitemsview/au3/minmaxrmspainter.h
  • src/projectscene/view/tracksitemsview/au3/samplespainter.h
  • src/projectscene/view/tracksitemsview/clipcontextmenumodel.h
  • src/projectscene/view/tracksitemsview/dropcontroller.h
  • src/projectscene/view/tracksitemsview/labelcontextmenumodel.h
  • src/projectscene/view/tracksitemsview/labeleditor/addnewlabeltrackmodel.h
  • src/projectscene/view/tracksitemsview/labeleditor/labelstableviewmodel.h
  • src/projectscene/view/tracksitemsview/labeleditor/labelstableviewtimecodecell.h
  • src/projectscene/view/tracksitemsview/pitchandspeedchangemodel.h
  • src/projectscene/view/tracksitemsview/selectionviewcontroller.h
  • src/projectscene/view/tracksitemsview/splittoolcontroller.h
  • src/projectscene/view/tracksitemsview/trackclipslistmodel.h
  • src/projectscene/view/tracksitemsview/trackitemslistmodel.h
  • src/projectscene/view/tracksitemsview/viewtrackslistmodel.h
  • src/projectscene/view/tracksitemsview/wavepainterproxy.h
  • src/projectscene/view/tracksitemsview/waveview.h
  • src/projectscene/view/trackspanel/paneltrackslistmodel.h
  • src/projectscene/view/trackspanel/realtimeeffectlistitemmodel.h
  • src/projectscene/view/trackspanel/realtimeeffectlistmodel.h
  • src/projectscene/view/trackspanel/realtimeeffectmenumodelbase.h
  • src/projectscene/view/trackspanel/realtimeeffectrowactionscontroller.h
  • src/projectscene/view/trackspanel/realtimeeffectsectionmodel.h
  • src/projectscene/view/trackspanel/trackcontextmenumodel.h
  • src/projectscene/view/trackspanel/trackitem.h
  • src/projectscene/view/trackspanel/wavetrackitem.h
  • src/record/internal/au3/au3audioinput.h
  • src/record/internal/au3/au3record.h
  • src/record/internal/recordcontroller.h
  • src/record/internal/recorduiactions.h
  • src/record/irecordconfiguration.h
  • src/record/irecordmetercontroller.h
  • src/record/view/common/recordmetermodel.h
  • src/record/view/toolbars/playbacktoolbarrecordlevelitem.h
  • src/spectrogram/iglobalspectrogramconfiguration.h
  • src/spectrogram/internal/au3/au3frequencyselectionrestorer.h
  • src/spectrogram/internal/au3/au3peakfinderfactory.h
  • src/spectrogram/internal/au3/au3spectrogrampainter.h
  • src/spectrogram/internal/frequencyselectioncontroller.h
  • src/spectrogram/internal/spectrogramactionscontroller.h
  • src/spectrogram/internal/spectrogramservice.h
  • src/spectrogram/ispectraleffectsregister.h
  • src/spectrogram/view/channelspectralselectionmodel.h
  • src/spectrogram/view/clipchannelspectrogramview.h
  • src/spectrogram/view/scalesectionparameterlistmodel.h
  • src/spectrogram/view/spectrogramchannelrulermodel.h
  • src/spectrogram/view/spectrogramviewservice.h
  • src/spectrogram/view/trackspectrogramcontextmenumodel.h
  • src/spectrogram/view/trackspectrogramsettingsmodel.h
  • src/testing/testcontext.h
  • src/toast/dev/toasttestsmodel.h
  • src/toast/internal/toastservice.cpp
  • src/toast/internal/toastservice.h
  • src/toast/itoastprovider.h
  • src/toast/itoastservice.h
  • src/toast/toastmodule.cpp
  • src/toast/toastmodule.h
  • src/toast/view/toastlistmodel.h
  • src/trackedit/iclipboarddata.h
  • src/trackedit/internal/au3/au3clipsinteraction.h
  • src/trackedit/internal/au3/au3labelsinteraction.h
  • src/trackedit/internal/au3/au3projecthistory.h
  • src/trackedit/internal/au3/au3selectioncontroller.h
  • src/trackedit/internal/au3/au3trackeditclipboard.h
  • src/trackedit/internal/au3/au3trackeditproject.cpp
  • src/trackedit/internal/au3/au3trackeditproject.h
  • src/trackedit/internal/au3/au3tracksinteraction.h
  • src/trackedit/internal/deletebehavioronboardingscenario.h
  • src/trackedit/internal/trackeditactionscontroller.h
  • src/trackedit/internal/trackeditinteraction.h
  • src/trackedit/internal/trackeditoperationcontroller.h
  • src/trackedit/internal/trackedituiactions.h
  • src/trackedit/internal/tracknavigationcontroller.h
  • src/trackedit/internal/trackspectrogramsettingsupdater.h
  • src/trackedit/internal/undomanager.h
  • src/trackedit/itrackeditconfiguration.h
  • src/trackedit/itrackeditproject.h
  • src/trackedit/tests/au3interactiontestbase.h
  • src/trackedit/tests/au3trackeditclipboard_tests.cpp
  • src/trackedit/trackeditmodule.cpp
  • src/trackedit/view/tracknavigationmodel.h
  • src/uicomponents/components/polyline.h

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Updated the muse_framework submodule reference. Large-scale IoC rewire: many members changed from instance/context-scoped muse::Inject<T>{ this } to muse::GlobalInject<T>, and numerous interface export macros were changed from export variants to global variants. Several creators/services were moved from context-local IOC registration to global IOC (ProjectScene, Trackedit, Toast) with related constructor/signature updates to accept ContextPtr. Nyquist: scanner filters prompt entries, prompt-loader initialization deferred to onAllInited, and Nyquist prompt QML gained keyboard-navigation properties. Tests use a dedicated test Context.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application
    participant NyquistModule as NyquistEffectsModule
    participant GlobalIOC as globalIoc()
    participant Loader as NyquistPromptLoader

    App->>NyquistModule: onPreInit(runMode)
    NyquistModule->>Loader: create/store prompt loader (deferred)
    App->>NyquistModule: onInit(runMode)
    NyquistModule->>GlobalIOC: resolve IParameterExtractorRegistry
    GlobalIOC-->>NyquistModule: registry instance
    NyquistModule->>GlobalIOC: register parameter extractors
    App->>NyquistModule: onAllInited(runMode)
    NyquistModule->>Loader: initialize deferred prompt loader
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Suggested reviewers

  • luapmartin
🚥 Pre-merge checks | ✅ 2 | ❌ 2

❌ Failed checks (2 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive PR title 'Enable compile-time checks for injects' describes the stated objective but does not reflect the primary actual changes (migration to global injects and Nyquist prompt fixes). Consider a more descriptive title that captures the scope: 'Migrate to global injects for better modularity and fix Nyquist prompt' or similar.
Out of Scope Changes check ❓ Inconclusive Most changes consistently migrate from instance-scoped (Inject) to global-scoped (GlobalInject) injection across many modules, which aligns with the 'compile-time checks' objective. However, interface macro changes from MODULE_EXPORT_INTERFACE to MODULE_GLOBAL_INTERFACE and numerous unrelated member reorderings appear tangential to the core issue. Clarify whether all interface macro changes and member reorderings are necessary for the compile-time checks feature or if they should be separated into distinct commits/PRs for better reviewability.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed PR changes address #10609 (Nyquist prompt issues) through context-based wiring updates and NyquistBase fix, enabling the prompt to function with proper command handling, though QA verification remains incomplete.
Description check ✅ Passed The PR description includes all required sections from the template: CLA signature, title describing the issue, commit organization, behavior change assurance, and QA verification items.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/project/tests/environment.cpp (1)

18-18: Consider replacing the hardcoded context id with a named constant.

999 works, but a named constant (or helper) would make intent clearer and reduce accidental id reuse across suites.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/project/tests/environment.cpp` at line 18, Replace the magic number 999
used when constructing s_testCtx with a named constant to clarify intent and
avoid id collisions; define a constant (e.g. constexpr int kTestContextId = 999
or a helper like GetTestContextId()) near the test file scope and use that
symbol in the call to muse::modularity::Context in the s_testCtx initialization
so the identifier is explicit and easy to reuse or change.
src/effects/nyquist/nyquistprompt/NyquistPromptView.qml (1)

68-78: Consider adding navigation support to TextInputArea.

The three FlatButton controls now have proper keyboard navigation (orders 0, 1, 2), which improves accessibility. However, the TextInputArea at line 82 is not wired into the navigation panel—users may not be able to tab into it seamlessly.

If TextInputArea supports the navigation property, consider adding it with an appropriate order value to complete the keyboard navigation flow.

Also applies to: 102-123

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/effects/nyquist/nyquistprompt/NyquistPromptView.qml` around lines 68 -
78, The TextInputArea instances are not wired into the navigation panel,
breaking keyboard tabbability; update each TextInputArea (the component named
TextInputArea in this QML) to include navigation.panel: root.navPanel and set
navigation.order to follow the FlatButton sequence (use navigation.order: 3 for
the first TextInputArea after the buttons, and increment accordingly for the
other occurrence(s) so the orders remain sequential), ensuring the
TextInputArea(s) participate in the same navigation flow as the FlatButton
controls.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@muse_framework`:
- Line 1: The submodule pointer in the superproject references a non-existent
commit (4694067f15fdaf28272c31594a9f7c20f47d3fc4), preventing init/checkout; fix
by ensuring the referenced commit exists on the submodule remote (either push
the missing commit from the submodule repo or retarget the submodule gitlink to
an existing remote commit or branch), then update the superproject: in the
submodule repo fetch/push the missing commit to origin (or check out a reachable
commit), commit the updated gitlink in the superproject, and run git submodule
sync && git submodule update --init --recursive so the submodule can be
initialized and the PR can merge.

In `@src/projectscene/projectscenemodule.cpp`:
- Line 234: The registration of ProjectViewStateCreator is being added to
globalIoc() using IProjectViewStateCreator which holds context-specific state
but onDeinit() is empty, so either unregister that global export in onDeinit()
or move the registration to the context-scoped ioc() to avoid stale references;
specifically, locate the line registering IProjectViewStateCreator with
globalIoc() and change it to register with ioc() (to match
IProjectSceneActionsController) or add an explicit
globalIoc()->unregisterExport<IProjectViewStateCreator>(mname) call in
onDeinit() to clean up the export when ProjectSceneContext is destroyed.

---

Nitpick comments:
In `@src/effects/nyquist/nyquistprompt/NyquistPromptView.qml`:
- Around line 68-78: The TextInputArea instances are not wired into the
navigation panel, breaking keyboard tabbability; update each TextInputArea (the
component named TextInputArea in this QML) to include navigation.panel:
root.navPanel and set navigation.order to follow the FlatButton sequence (use
navigation.order: 3 for the first TextInputArea after the buttons, and increment
accordingly for the other occurrence(s) so the orders remain sequential),
ensuring the TextInputArea(s) participate in the same navigation flow as the
FlatButton controls.

In `@src/project/tests/environment.cpp`:
- Line 18: Replace the magic number 999 used when constructing s_testCtx with a
named constant to clarify intent and avoid id collisions; define a constant
(e.g. constexpr int kTestContextId = 999 or a helper like GetTestContextId())
near the test file scope and use that symbol in the call to
muse::modularity::Context in the s_testCtx initialization so the identifier is
explicit and easy to reuse or change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 6f1b1d84-1118-4c42-a499-7de76204c6f3

📥 Commits

Reviewing files that changed from the base of the PR and between 617b304 and 1f78382.

📒 Files selected for processing (46)
  • muse_framework
  • src/app/pluginregistrationapp.cpp
  • src/appshell/internal/applicationactioncontroller.h
  • src/appshell/internal/iappmenumodelhook.h
  • src/appshell/internal/sessionsmanager.h
  • src/appshell/qml/Audacity/AppShell/appmenumodel.h
  • src/au3audio/internal/au3audiodevicesprovider.h
  • src/au3wrap/iau3project.h
  • src/audio/iaudioengine.h
  • src/effects/effects_base/internal/effectexecutionscenario.h
  • src/effects/effects_base/internal/effectinstancesregister.h
  • src/effects/effects_base/internal/effectparametersprovider.h
  • src/effects/effects_base/iparameterextractorregistry.h
  • src/effects/effects_base/view/generatedeffectviewermodel.h
  • src/effects/nyquist/internal/nyquistpluginsscanner.cpp
  • src/effects/nyquist/nyquisteffectsmodule.cpp
  • src/effects/nyquist/nyquisteffectsmodule.h
  • src/effects/nyquist/nyquistprompt/NyquistPromptView.qml
  • src/effects/nyquist/nyquistprompt/nyquistpromptviewmodel.h
  • src/importexport/export/iffmpegoptionsaccessor.h
  • src/importexport/export/view/channelmappingtableviewmodel.h
  • src/importexport/export/view/customffmpegpreferencesmodel.h
  • src/importexport/export/view/exportpreferencesmodel.h
  • src/playback/internal/au3/au3audiooutput.h
  • src/playback/internal/au3/au3player.h
  • src/playback/internal/playbackcontroller.h
  • src/playback/iplaybackmetercontroller.h
  • src/playback/view/common/metermodel.h
  • src/project/internal/audacityproject.h
  • src/project/internal/projectautosaver.h
  • src/project/tests/environment.cpp
  • src/projectscene/internal/projectsceneactionscontroller.h
  • src/projectscene/iprojectviewstatecreator.h
  • src/projectscene/projectscenemodule.cpp
  • src/record/internal/au3/au3audioinput.h
  • src/record/internal/au3/au3record.h
  • src/record/irecordmetercontroller.h
  • src/record/view/toolbars/playbacktoolbarrecordlevelitem.h
  • src/spectrogram/view/spectrogramchannelrulermodel.h
  • src/toast/internal/toastservice.h
  • src/toast/itoastprovider.h
  • src/toast/view/toastlistmodel.h
  • src/trackedit/internal/au3/au3trackeditclipboard.h
  • src/trackedit/itrackeditproject.h
  • src/trackedit/trackeditmodule.cpp
  • src/uicomponents/components/polyline.h

Comment thread muse_framework Resolved
Comment thread src/projectscene/projectscenemodule.cpp Resolved
@kryksyh
kryksyh force-pushed the compile_time_checks branch 2 times, most recently from 387b0bb to aa05413 Compare March 30, 2026 10:36

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/projectscene/projectscenemodule.cpp (1)

234-234: ⚠️ Potential issue | 🟠 Major

Context-bound creator is being exported globally without lifecycle safety.

Line 234 registers ProjectViewStateCreator(iocContext()) in globalIoc() under a static key, while onDeinit() (Line 259) does not unregister it. This can leave stale context references and can also cause cross-project context mixups when multiple contexts are created.

Suggested fix
 void ProjectSceneContext::onDeinit()
 {
+    globalIoc()->unregisterExport<IProjectViewStateCreator>(mname);
 }

If this service is inherently context-specific, prefer context IoC registration instead of global export.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/projectscene/projectscenemodule.cpp` at line 234, The
ProjectViewStateCreator instance created with iocContext() is being exported to
globalIoc() via registerExport which leaks a context-bound object into a global
registry; change the registration to the context IoC (use
iocContext()->registerExport or equivalent) so the creator lives and is torn
down with its context, or if global registration is required, ensure symmetry by
unregistering the same key in onDeinit() (remove the
globalIoc()->registerExport(...) call and instead call
iocContext()->registerExport<IProjectViewStateCreator>(mname,
std::make_shared<ProjectViewStateCreator>(iocContext())), or add a matching
globalIoc()->unregisterExport(mname) in onDeinit()).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/projectscene/projectscenemodule.cpp`:
- Line 234: The ProjectViewStateCreator instance created with iocContext() is
being exported to globalIoc() via registerExport which leaks a context-bound
object into a global registry; change the registration to the context IoC (use
iocContext()->registerExport or equivalent) so the creator lives and is torn
down with its context, or if global registration is required, ensure symmetry by
unregistering the same key in onDeinit() (remove the
globalIoc()->registerExport(...) call and instead call
iocContext()->registerExport<IProjectViewStateCreator>(mname,
std::make_shared<ProjectViewStateCreator>(iocContext())), or add a matching
globalIoc()->unregisterExport(mname) in onDeinit()).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 58c2dcd1-5262-4bbc-937f-7990d3154e9c

📥 Commits

Reviewing files that changed from the base of the PR and between 1f78382 and aa0541313c4a27622a9911904dbc7a461c6acc9a.

📒 Files selected for processing (53)
  • muse_framework
  • src/app/pluginregistrationapp.cpp
  • src/appshell/internal/applicationactioncontroller.h
  • src/appshell/internal/iappmenumodelhook.h
  • src/appshell/internal/sessionsmanager.h
  • src/appshell/qml/Audacity/AppShell/appmenumodel.h
  • src/au3audio/internal/au3audiodevicesprovider.h
  • src/au3wrap/iau3project.h
  • src/audio/iaudioengine.h
  • src/effects/effects_base/internal/effectexecutionscenario.h
  • src/effects/effects_base/internal/effectinstancesregister.h
  • src/effects/effects_base/internal/effectparametersprovider.h
  • src/effects/effects_base/iparameterextractorregistry.h
  • src/effects/effects_base/view/generatedeffectviewermodel.h
  • src/effects/nyquist/internal/nyquistpluginsscanner.cpp
  • src/effects/nyquist/nyquisteffectsmodule.cpp
  • src/effects/nyquist/nyquisteffectsmodule.h
  • src/effects/nyquist/nyquistprompt/NyquistPromptView.qml
  • src/effects/nyquist/nyquistprompt/nyquistpromptviewmodel.h
  • src/importexport/export/iffmpegoptionsaccessor.h
  • src/importexport/export/view/channelmappingtableviewmodel.h
  • src/importexport/export/view/customffmpegpreferencesmodel.h
  • src/importexport/export/view/exportpreferencesmodel.h
  • src/playback/internal/au3/au3audiooutput.h
  • src/playback/internal/au3/au3player.h
  • src/playback/internal/playbackcontroller.h
  • src/playback/iplaybackmetercontroller.h
  • src/playback/view/common/metermodel.h
  • src/project/internal/audacityproject.h
  • src/project/internal/projectactionscontroller.h
  • src/project/internal/projectautosaver.h
  • src/project/tests/environment.cpp
  • src/projectscene/internal/projectsceneactionscontroller.h
  • src/projectscene/iprojectviewstatecreator.h
  • src/projectscene/projectscenemodule.cpp
  • src/record/internal/au3/au3audioinput.h
  • src/record/internal/au3/au3record.h
  • src/record/irecordmetercontroller.h
  • src/record/view/toolbars/playbacktoolbarrecordlevelitem.h
  • src/spectrogram/view/spectrogramchannelrulermodel.h
  • src/toast/dev/toasttestsmodel.h
  • src/toast/internal/toastservice.cpp
  • src/toast/internal/toastservice.h
  • src/toast/itoastprovider.h
  • src/toast/itoastservice.h
  • src/toast/toastmodule.cpp
  • src/toast/toastmodule.h
  • src/toast/view/toastlistmodel.h
  • src/trackedit/internal/au3/au3trackeditclipboard.h
  • src/trackedit/internal/au3/au3trackeditproject.h
  • src/trackedit/itrackeditproject.h
  • src/trackedit/trackeditmodule.cpp
  • src/uicomponents/components/polyline.h
💤 Files with no reviewable changes (1)
  • src/toast/internal/toastservice.cpp
✅ Files skipped from review due to trivial changes (15)
  • src/effects/effects_base/internal/effectexecutionscenario.h
  • src/effects/nyquist/internal/nyquistpluginsscanner.cpp
  • muse_framework
  • src/importexport/export/iffmpegoptionsaccessor.h
  • src/effects/effects_base/iparameterextractorregistry.h
  • src/appshell/internal/iappmenumodelhook.h
  • src/projectscene/internal/projectsceneactionscontroller.h
  • src/record/irecordmetercontroller.h
  • src/importexport/export/view/exportpreferencesmodel.h
  • src/spectrogram/view/spectrogramchannelrulermodel.h
  • src/playback/internal/playbackcontroller.h
  • src/trackedit/internal/au3/au3trackeditclipboard.h
  • src/uicomponents/components/polyline.h
  • src/trackedit/itrackeditproject.h
  • src/importexport/export/view/channelmappingtableviewmodel.h
🚧 Files skipped from review as they are similar to previous changes (23)
  • src/audio/iaudioengine.h
  • src/app/pluginregistrationapp.cpp
  • src/appshell/internal/applicationactioncontroller.h
  • src/au3wrap/iau3project.h
  • src/playback/iplaybackmetercontroller.h
  • src/effects/effects_base/internal/effectinstancesregister.h
  • src/effects/nyquist/nyquisteffectsmodule.h
  • src/projectscene/iprojectviewstatecreator.h
  • src/toast/itoastprovider.h
  • src/playback/internal/au3/au3player.h
  • src/record/internal/au3/au3record.h
  • src/effects/effects_base/internal/effectparametersprovider.h
  • src/au3audio/internal/au3audiodevicesprovider.h
  • src/record/internal/au3/au3audioinput.h
  • src/toast/view/toastlistmodel.h
  • src/effects/effects_base/view/generatedeffectviewermodel.h
  • src/playback/internal/au3/au3audiooutput.h
  • src/appshell/qml/Audacity/AppShell/appmenumodel.h
  • src/record/view/toolbars/playbacktoolbarrecordlevelitem.h
  • src/effects/nyquist/nyquistprompt/NyquistPromptView.qml
  • src/trackedit/trackeditmodule.cpp
  • src/toast/internal/toastservice.h
  • src/effects/nyquist/nyquisteffectsmodule.cpp

@kryksyh
kryksyh force-pushed the compile_time_checks branch from aa05413 to c7ae3f2 Compare March 30, 2026 10:54

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/toast/toastmodule.cpp (1)

51-62: Consider removing the now-empty ToastContext in a follow-up.

ToastContext is now a hollow shell with an empty onDeinit() and no registerExports(). While this works, it adds minimal value. Consider removing it entirely if the IContextSetup interface allows returning nullptr from newContext(), or document why it's retained.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/toast/toastmodule.cpp` around lines 51 - 62, The ToastContext class is
now empty (empty ToastContext::onDeinit and no registerExports) so either remove
it or explicitly document why it remains; update ToastModule::newContext to
return nullptr if IContextSetup allows it, or delete the ToastContext type and
adjust ToastModule::newContext to not construct it and remove any related
declarations/headers; alternatively add a comment in ToastContext explaining its
purpose if you must keep it.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/project/tests/audacityproject_tests.cpp`:
- Around line 88-96: Uncrustify flagged spacing around the template
instantiation of
std::make_shared<::testing::NiceMock<au::trackedit::ClipboardMock>>() in the
test setup; fix the spacing so the template and angle brackets follow the
project's style (no extra spaces between ::testing::NiceMock and its template
args or between make_shared and the following <...), then run
tools/codestyle/uncrustify_run_file.sh on this file to apply/verify the
formatting changes; check the block that assigns m_clipboard
(std::make_shared<::testing::NiceMock<au::trackedit::ClipboardMock>>()) and
ensure surrounding lines with m_testCtx, m_currentProject,
trackeditProjectCreator/viewStateCreator/clipboard follow the same uncrustify
style.

---

Nitpick comments:
In `@src/toast/toastmodule.cpp`:
- Around line 51-62: The ToastContext class is now empty (empty
ToastContext::onDeinit and no registerExports) so either remove it or explicitly
document why it remains; update ToastModule::newContext to return nullptr if
IContextSetup allows it, or delete the ToastContext type and adjust
ToastModule::newContext to not construct it and remove any related
declarations/headers; alternatively add a comment in ToastContext explaining its
purpose if you must keep it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 191c9da2-211a-4571-91bc-903a6259d886

📥 Commits

Reviewing files that changed from the base of the PR and between aa0541313c4a27622a9911904dbc7a461c6acc9a and c7ae3f25ff1858b03155a2587119fbc14667ae82.

📒 Files selected for processing (54)
  • muse_framework
  • src/app/pluginregistrationapp.cpp
  • src/appshell/internal/applicationactioncontroller.h
  • src/appshell/internal/iappmenumodelhook.h
  • src/appshell/internal/sessionsmanager.h
  • src/appshell/qml/Audacity/AppShell/appmenumodel.h
  • src/au3audio/internal/au3audiodevicesprovider.h
  • src/au3wrap/iau3project.h
  • src/audio/iaudioengine.h
  • src/effects/effects_base/internal/effectexecutionscenario.h
  • src/effects/effects_base/internal/effectinstancesregister.h
  • src/effects/effects_base/internal/effectparametersprovider.h
  • src/effects/effects_base/iparameterextractorregistry.h
  • src/effects/effects_base/view/generatedeffectviewermodel.h
  • src/effects/nyquist/internal/nyquistpluginsscanner.cpp
  • src/effects/nyquist/nyquisteffectsmodule.cpp
  • src/effects/nyquist/nyquisteffectsmodule.h
  • src/effects/nyquist/nyquistprompt/NyquistPromptView.qml
  • src/effects/nyquist/nyquistprompt/nyquistpromptviewmodel.h
  • src/importexport/export/iffmpegoptionsaccessor.h
  • src/importexport/export/view/channelmappingtableviewmodel.h
  • src/importexport/export/view/customffmpegpreferencesmodel.h
  • src/importexport/export/view/exportpreferencesmodel.h
  • src/playback/internal/au3/au3audiooutput.h
  • src/playback/internal/au3/au3player.h
  • src/playback/internal/playbackcontroller.h
  • src/playback/iplaybackmetercontroller.h
  • src/playback/view/common/metermodel.h
  • src/project/internal/audacityproject.h
  • src/project/internal/projectactionscontroller.h
  • src/project/internal/projectautosaver.h
  • src/project/tests/audacityproject_tests.cpp
  • src/project/tests/environment.cpp
  • src/projectscene/internal/projectsceneactionscontroller.h
  • src/projectscene/iprojectviewstatecreator.h
  • src/projectscene/projectscenemodule.cpp
  • src/projectscene/tests/tracklabelslayoutmanager_tests.cpp
  • src/record/internal/au3/au3audioinput.h
  • src/record/internal/au3/au3record.h
  • src/record/irecordmetercontroller.h
  • src/record/view/toolbars/playbacktoolbarrecordlevelitem.h
  • src/spectrogram/view/spectrogramchannelrulermodel.h
  • src/toast/dev/toasttestsmodel.h
  • src/toast/internal/toastservice.cpp
  • src/toast/internal/toastservice.h
  • src/toast/itoastprovider.h
  • src/toast/itoastservice.h
  • src/toast/toastmodule.cpp
  • src/toast/toastmodule.h
  • src/toast/view/toastlistmodel.h
  • src/trackedit/internal/au3/au3trackeditclipboard.h
  • src/trackedit/itrackeditproject.h
  • src/trackedit/trackeditmodule.cpp
  • src/uicomponents/components/polyline.h
💤 Files with no reviewable changes (1)
  • src/toast/internal/toastservice.cpp
✅ Files skipped from review due to trivial changes (18)
  • src/audio/iaudioengine.h
  • src/playback/internal/playbackcontroller.h
  • src/trackedit/internal/au3/au3trackeditclipboard.h
  • src/effects/effects_base/internal/effectexecutionscenario.h
  • muse_framework
  • src/effects/effects_base/iparameterextractorregistry.h
  • src/playback/iplaybackmetercontroller.h
  • src/effects/nyquist/internal/nyquistpluginsscanner.cpp
  • src/toast/itoastprovider.h
  • src/projectscene/tests/tracklabelslayoutmanager_tests.cpp
  • src/importexport/export/iffmpegoptionsaccessor.h
  • src/projectscene/internal/projectsceneactionscontroller.h
  • src/uicomponents/components/polyline.h
  • src/appshell/internal/applicationactioncontroller.h
  • src/spectrogram/view/spectrogramchannelrulermodel.h
  • src/projectscene/projectscenemodule.cpp
  • src/importexport/export/view/exportpreferencesmodel.h
  • src/importexport/export/view/customffmpegpreferencesmodel.h
🚧 Files skipped from review as they are similar to previous changes (28)
  • src/importexport/export/view/channelmappingtableviewmodel.h
  • src/au3wrap/iau3project.h
  • src/effects/effects_base/view/generatedeffectviewermodel.h
  • src/effects/effects_base/internal/effectinstancesregister.h
  • src/projectscene/iprojectviewstatecreator.h
  • src/record/irecordmetercontroller.h
  • src/app/pluginregistrationapp.cpp
  • src/toast/toastmodule.h
  • src/effects/nyquist/nyquistprompt/nyquistpromptviewmodel.h
  • src/playback/internal/au3/au3audiooutput.h
  • src/project/internal/projectautosaver.h
  • src/toast/itoastservice.h
  • src/record/internal/au3/au3record.h
  • src/toast/view/toastlistmodel.h
  • src/appshell/qml/Audacity/AppShell/appmenumodel.h
  • src/effects/nyquist/nyquisteffectsmodule.cpp
  • src/effects/nyquist/nyquisteffectsmodule.h
  • src/playback/internal/au3/au3player.h
  • src/record/view/toolbars/playbacktoolbarrecordlevelitem.h
  • src/record/internal/au3/au3audioinput.h
  • src/project/tests/environment.cpp
  • src/trackedit/trackeditmodule.cpp
  • src/trackedit/itrackeditproject.h
  • src/appshell/internal/sessionsmanager.h
  • src/effects/nyquist/nyquistprompt/NyquistPromptView.qml
  • src/playback/view/common/metermodel.h
  • src/appshell/internal/iappmenumodelhook.h
  • src/effects/effects_base/internal/effectparametersprovider.h

@kryksyh
kryksyh force-pushed the compile_time_checks branch 3 times, most recently from 19040fa to a0224f9 Compare March 30, 2026 12:36
muse::Inject<IEffectsProvider> effectsProvider{ this };
muse::Inject<IParameterExtractorRegistry> parameterExtractorRegistry{ this };
muse::Inject<au::context::IGlobalContext> globalContext{ this };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be just naming but I find this confusing, wdyt?

muse::Inject<au::context::IGlobalContext> globalContext{ this };

per instance inject of a global context
I find terms of context and inject and global collapsing a bit here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's true. It is a per-project global context and is confusing indeed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would imagine something like this be easier on the eyes and brain:

  • muse::Inject<au::context::IProjectContext> projectContext{ this };
    or
  • muse::Inject<au::context::IInstanceContext> instanceContext{ this };
    or
  • muse::Inject<au::context::ILocalContext> context{ this };
    or even simply
  • muse::Inject<au::context::IContext> context{ this };

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's worth looking into, not in this PR though

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this issue until we found a good term.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • IProjectContext - Yes, to a large extent this is the context of the project, but it exists without an opened project
  • IInstanceContext - By instance we mean a process, so this doesn't apply here.
  • ILocalContext - It's not clear in relation to what it is local, we don't have a non-local context
  • IContext - Very abstract :)

We've decided to leave this issue for later. But if you do, we'd be interested to see your solution.

Comment thread src/playback/iplaybackmetercontroller.h Resolved
Comment thread src/project/tests/environment.cpp Resolved
Comment thread src/record/internal/au3/au3audioinput.h Resolved
Comment thread src/record/irecordmetercontroller.h Resolved

@luapmartin luapmartin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice ! it's great that modules are getting properly discerned between global and "local" or "project" or "contextable" (I feel we still need a proper naming there)

it would be great if we would list somewhere on a meta-issue the sub-task of the remaining modules to be "globalized"

Approved already since I trust the discussion on the added comment will be speedy, thanks

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/projectscene/tests/tracklabelslayoutmanager_tests.cpp (1)

28-34: 🧹 Nitpick | 🔵 Trivial

Consider mocking additional injected services.

TimelineContext (per src/projectscene/view/timeline/timelinecontext.h:64-67) has additional Inject<> services beyond globalContext: dispatcher, selectionController, and playback. These aren't mocked in the test fixture. If any test exercises code paths that use these services, resolution will fail since they're not registered in m_testCtx.

The current tests appear to focus on layout logic that may not need these services, but this could become an issue as test coverage expands.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 60940a3e-64bc-4529-84ad-a89febf0a0d5

📥 Commits

Reviewing files that changed from the base of the PR and between 3429cb794433aaa3b6a6d8c0f1cb4c5bf3f8c2d3 and 3cd088ee0ca6f7c413aaf1f1c25ce1336a14f827.

📒 Files selected for processing (5)
  • src/au3wrap/tests/mocks/au3projectmock.h
  • src/project/tests/audacityproject_tests.cpp
  • src/project/tests/environment.cpp
  • src/projectscene/tests/tracklabelslayoutmanager_tests.cpp
  • src/testing/testcontext.h

Comment on lines +80 to 95
muse::modularity::ContextPtr m_testCtx;
std::unique_ptr<Audacity4Project> m_currentProject = nullptr;
std::shared_ptr<au::project::TrackeditProjectCreatorMock> m_trackeditProjectCreator;
std::shared_ptr<au::projectscene::ProjectViewStateCreatorMock> m_projectViewStateCreator;
std::shared_ptr<au::trackedit::ClipboardMock> m_clipboard;

void SetUp() override
{
m_currentProject = std::make_unique<Audacity4Project>(muse::modularity::globalCtx());
m_testCtx = au::testutils::makeTestContext();

m_clipboard = std::make_shared<::testing::NiceMock<au::trackedit::ClipboardMock> >();

m_currentProject = std::make_unique<Audacity4Project>(m_testCtx);
m_currentProject->trackeditProjectCreator.set(m_trackeditProjectCreator);
m_currentProject->viewStateCreator.set(m_projectViewStateCreator);
m_currentProject->clipboard.set(m_clipboard);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if trackeditProjectCreator or viewStateCreator are called during load/close operations
echo "=== Usage of trackeditProjectCreator in Audacity4Project ==="
rg -n 'trackeditProjectCreator' src/project/internal/audacityproject.cpp

echo ""
echo "=== Usage of viewStateCreator in Audacity4Project ==="
rg -n 'viewStateCreator' src/project/internal/audacityproject.cpp

Repository: audacity/audacity

Length of output: 476


Initialize uninitialized mocks before injection.

m_trackeditProjectCreator and m_projectViewStateCreator are declared as shared_ptr members but never instantiated in SetUp(). They are then injected via .set() with null/empty values. Since both services are actively called in Audacity4Project (lines 27, 29, 149, 151 in audacityproject.cpp), this will cause null pointer dereferences at runtime.

Initialize both mocks in SetUp():

Proposed fix
 void SetUp() override
 {
     m_testCtx = au::testutils::makeTestContext();

     m_clipboard = std::make_shared<::testing::NiceMock<au::trackedit::ClipboardMock> >();
+    m_trackeditProjectCreator = std::make_shared<::testing::NiceMock<au::project::TrackeditProjectCreatorMock> >();
+    m_projectViewStateCreator = std::make_shared<::testing::NiceMock<au::projectscene::ProjectViewStateCreatorMock> >();

     m_currentProject = std::make_unique<Audacity4Project>(m_testCtx);
     m_currentProject->trackeditProjectCreator.set(m_trackeditProjectCreator);
     m_currentProject->viewStateCreator.set(m_projectViewStateCreator);
     m_currentProject->clipboard.set(m_clipboard);
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
muse::modularity::ContextPtr m_testCtx;
std::unique_ptr<Audacity4Project> m_currentProject = nullptr;
std::shared_ptr<au::project::TrackeditProjectCreatorMock> m_trackeditProjectCreator;
std::shared_ptr<au::projectscene::ProjectViewStateCreatorMock> m_projectViewStateCreator;
std::shared_ptr<au::trackedit::ClipboardMock> m_clipboard;
void SetUp() override
{
m_currentProject = std::make_unique<Audacity4Project>(muse::modularity::globalCtx());
m_testCtx = au::testutils::makeTestContext();
m_clipboard = std::make_shared<::testing::NiceMock<au::trackedit::ClipboardMock> >();
m_currentProject = std::make_unique<Audacity4Project>(m_testCtx);
m_currentProject->trackeditProjectCreator.set(m_trackeditProjectCreator);
m_currentProject->viewStateCreator.set(m_projectViewStateCreator);
m_currentProject->clipboard.set(m_clipboard);
muse::modularity::ContextPtr m_testCtx;
std::unique_ptr<Audacity4Project> m_currentProject = nullptr;
std::shared_ptr<au::project::TrackeditProjectCreatorMock> m_trackeditProjectCreator;
std::shared_ptr<au::projectscene::ProjectViewStateCreatorMock> m_projectViewStateCreator;
std::shared_ptr<au::trackedit::ClipboardMock> m_clipboard;
void SetUp() override
{
m_testCtx = au::testutils::makeTestContext();
m_clipboard = std::make_shared<::testing::NiceMock<au::trackedit::ClipboardMock> >();
m_trackeditProjectCreator = std::make_shared<::testing::NiceMock<au::project::TrackeditProjectCreatorMock> >();
m_projectViewStateCreator = std::make_shared<::testing::NiceMock<au::projectscene::ProjectViewStateCreatorMock> >();
m_currentProject = std::make_unique<Audacity4Project>(m_testCtx);
m_currentProject->trackeditProjectCreator.set(m_trackeditProjectCreator);
m_currentProject->viewStateCreator.set(m_projectViewStateCreator);
m_currentProject->clipboard.set(m_clipboard);

Comment thread src/project/tests/environment.cpp Resolved
@@ -26,8 +26,9 @@ class GeneratedEffectViewerModel : public AbstractEffectViewModel
Q_PROPERTY(int lowerTimeSignature READ lowerTimeSignature NOTIFY timeSignatureChanged FINAL)
Q_PROPERTY(bool isPreviewAllowed READ isPreviewAllowed CONSTANT FINAL)

muse::GlobalInject<IParameterExtractorRegistry> parameterExtractorRegistry;

muse::Inject<IEffectsProvider> effectsProvider{ this };

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use muse::ContextInject (replace all)

namespace muse {
using kors::modularity::GlobalInject;
using kors::modularity::GlobalThreadSafeInject;
using kors::modularity::ContextInject;
using kors::modularity::ContextThreadSafeInject;
using kors::modularity::Contextable;

//! NOTE Temporary for compatibility
using kors::modularity::Inject;
using kors::modularity::ThreadSafeInject;
using kors::modularity::Injectable;
//! ----

...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, I think we could make good use of deprecated macros at definition level, modern IDE would be yelling at user and at least would help discover these things and avoid writing new code with deprecated patterns...

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 38319496-c1e3-4802-94d3-52b6d1ffb717

📥 Commits

Reviewing files that changed from the base of the PR and between 3cd088ee0ca6f7c413aaf1f1c25ce1336a14f827 and 410238ee51ae95c344dec1d07af566b771ad66f0.

📒 Files selected for processing (1)
  • au3/libraries/au3-nyquist-effects/NyquistBase.cpp

@kryksyh
kryksyh force-pushed the compile_time_checks branch from 410238e to 6eba596 Compare March 31, 2026 14:15
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.

Nyquist prompt is broken

4 participants