feat: throw error on duplicate module names in workspace#886
Open
pyramation wants to merge 1 commit intomainfrom
Open
feat: throw error on duplicate module names in workspace#886pyramation wants to merge 1 commit intomainfrom
pyramation wants to merge 1 commit intomainfrom
Conversation
Similar to how pnpm/yarn workspaces error when multiple packages share the same name, pgpm now throws a DUPLICATE_MODULE error when getModules() or listModules() encounters multiple modules with the same .control file name. Previously getModules() returned all matches (causing duplicate entries in pgpm deploy's interactive prompt) and listModules() silently picked the shortest path. Both now throw a descriptive error listing the conflicting paths.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
DUPLICATE_MODULEerror that is thrown when multiple modules in a pgpm workspace share the same.controlfile name, similar to how pnpm/yarn workspaces reject duplicate package names.Before:
getModules()silently returned all duplicates (causing duplicate entries inpgpm deploy's interactive prompt), andlistModules()silently picked the shortest path.After: Both methods throw a
DUPLICATE_MODULEerror listing the conflicting paths.Two files changed:
pgpm/types/src/error-factory.ts— newDUPLICATE_MODULEerror definitionpgpm/core/src/core/class/pgpm.ts— duplicate detection ingetModules()andlistModules()Review & Testing Checklist for Human
listModules()behavior change: The old code intentionally handled naming collisions by picking the shortest path (lines 334-343 before). This PR replaces that with a hard error. Verify this is the desired behavior — any workspace with legitimately duplicated.controlfile names (e.g. nested node_modules, symlinks) will now fail instead of deduplicating gracefully.getModules()orlistModules(). Confirm no existing workspaces besides agentic-db are affected, or that this is acceptable.getModuleName()reliability ingetModules(): The new code callsproj.getModuleName()on eachPgpmPackageinstance. Verify this works correctly for all module types (the original code didn't need the module name, justisInModule())..controlfiles that share the same base name, runpgpm deploy, and confirm the error message is clear and actionable.Notes
forloop throws immediately). Users with multiple duplicate groups will need to fix them one at a time.Link to Devin session: https://app.devin.ai/sessions/c26111a26a9a44f891534104a809dcdb
Requested by: @pyramation