Skip to content

Fix: Resolve ModuleNotFoundError in effects service (#349)#384

Open
Khalodddd wants to merge 1 commit intojamiepine:mainfrom
Khalodddd:fix-effects-import
Open

Fix: Resolve ModuleNotFoundError in effects service (#349)#384
Khalodddd wants to merge 1 commit intojamiepine:mainfrom
Khalodddd:fix-effects-import

Conversation

@Khalodddd
Copy link
Copy Markdown

@Khalodddd Khalodddd commented Apr 4, 2026

Technical Analysis

The backend/services/effects.py module was experiencing a ModuleNotFoundError during runtime when attempting to create or update effect presets. Upon investigation of the source code and the project directory structure, a pathing inconsistency was identified.

The module utilized a combination of import styles:

  • Relative Imports: Correctly implemented for sibling modules (..database and ..models).
  • Absolute Import: Incorrectly implemented for the utility module (backend.utils.effects).

In a standard FastAPI/Uvicorn execution environment, referencing the top-level backend package from within a sub-package often fails if the parent directory is not explicitly in the PYTHONPATH. This discrepancy prevented the create_preset and update_preset functions from executing, resulting in the "Load failed" error observed in the user interface.

Proposed Changes

The import statement on Line 13 has been standardized to use a relative path. This modification ensures that the services package correctly locates the utils package within the shared backend parent directory, regardless of the deployment environment or working directory.

Source Code Modification:

  • Original: from backend.utils.effects import validate_effects_chain
  • Updated: from ..utils.effects import validate_effects_chain

Verification and Evidence

The fix was verified through the following protocol:

  1. Installation of core project dependencies (sqlalchemy, pedalboard, fastapi).
  2. Execution of a manual import test from the repository root to confirm the module resolves correctly.
  3. Confirmation that the internal logic of validate_effects_chain is reachable without triggering path-related exceptions.

Terminal Verification:
Screenshot 2026-04-04 234912

Code Before With Issue:
Screenshot 2026-04-04 235734

Code After without Issue:
Screenshot 2026-04-04 235724


Fixes #359

Summary by CodeRabbit

  • Refactor
    • Internal improvements to code organization with no impact to user-facing functionality or features.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 4, 2026

📝 Walkthrough

Walkthrough

Changed the import statement for validate_effects_chain in backend/services/effects.py from an absolute import path to a relative import path, resolving a ModuleNotFoundError that prevented preset creation and editing operations.

Changes

Cohort / File(s) Summary
Import Path Fix
backend/services/effects.py
Updated import of validate_effects_chain from backend.utils.effects (absolute) to ..utils.effects (relative) to correct module resolution error.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Poem

🐰 A path misconfigured, causing chains to break,
The imports stumbled through the wrong route to take.
Dots and dashes rearranged with care,
Now presets flow freely through the air! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR directly addresses issue #359 by changing the import from absolute to relative path, which resolves the ModuleNotFoundError that prevented creating and updating effect presets.
Out of Scope Changes check ✅ Passed The PR changes only the import statement in backend/services/effects.py, which is directly scoped to fixing the reported ModuleNotFoundError with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately summarizes the main change: fixing a ModuleNotFoundError in the effects service by correcting an import path from absolute to relative import.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Khalodddd Khalodddd changed the title Fix: Resolve ModuleNotFoundError in effects service (#359) Fix: Resolve ModuleNotFoundError in effects service (#349) Apr 4, 2026
@ArfianID
Copy link
Copy Markdown
Contributor

ArfianID commented Apr 7, 2026

Screenshot 2026-04-07 093056 image

Both work perfectly. But relative is the standard. We will stick with this

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.

Effect error

2 participants