Skip to content

Fix: Prevent duplicate module entries when deploying external modules with params#55

Closed
hinriksnaer wants to merge 1 commit into
mainfrom
fix/duplicate-module-entries
Closed

Fix: Prevent duplicate module entries when deploying external modules with params#55
hinriksnaer wants to merge 1 commit into
mainfrom
fix/duplicate-module-entries

Conversation

@hinriksnaer

Copy link
Copy Markdown
Owner

Problem

When deploying external modules with parameters using:

fedpunk module deploy https://github.com/user/module.git

Two entries were created in ~/.config/fedpunk/fedpunk.yaml:

modules:
  enabled:
    - module-name                                    # ❌ Duplicate (normalized)
    - module: https://github.com/user/module.git     # ✅ Correct entry
      params:
        param_key: value

Root Cause

In lib/fish/deployer.fish (line 48-58):

  1. deployer-deploy-module normalized URL to module name
  2. Added normalized name to config
  3. Later, param-save-to-config searched for the URL
  4. Didn't find it (because normalized name was stored)
  5. Created a new entry with URL and params → duplicate

Solution

Store the original module reference (URL) instead of normalizing it:

Before (buggy):

set module_name (extract name from URL)
fedpunk-config-add-module "$module_name"  # Added "module-name"

After (fixed):

fedpunk-config-add-module "$module_ref"   # Add original URL

This allows param-save-to-config to find and update the existing entry instead of creating a duplicate.

Changes

  • lib/fish/deployer.fish: Store original URL instead of normalized name
  • test/ci/test-external-module-params-no-duplicate.sh: Updated to test fix

Testing

bash test/ci/test-external-module-params-no-duplicate.sh

Result:

✅ SUCCESS: Exactly 1 entry in modules.enabled
✅ SUCCESS: Entry is an object (not a string)  
✅ SUCCESS: Module field contains the URL
✅ SUCCESS: Parameter value stored correctly
✅ SUCCESS: No duplicate normalized name entry found

User Impact

Fixes issue reported in container where duplicate entries appeared after running:

fedpunk module deploy https://github.com/hinriksnaer/fedpunk-claude-gauth-example.git

Users will now have clean, single-entry module configs with params.

🤖 Generated with Claude Code

… with params

Bug: When deploying external modules with parameters via
fedpunk module deploy <url>, two entries were created:
  1. Normalized name string (e.g., "module-name")
  2. URL with params object (e.g., {module: "url", params: {...}})

Root cause: deployer-deploy-module normalized URL to name before
adding to config, then param-save-to-config searched for URL and
didn't find it, creating a duplicate entry.

Fix: Store original module reference (URL) instead of normalized name.
This allows param-save-to-config to find and update the existing entry.

Before:
  modules:
    enabled:
      - fedpunk-claude-gauth-example
      - module: https://github.com/.../fedpunk-claude-gauth-example.git
        params:
          gcloud_auth: yes

After:
  modules:
    enabled:
      - module: https://github.com/.../fedpunk-claude-gauth-example.git
        params:
          gcloud_auth: yes

Test: bash test/ci/test-external-module-params-no-duplicate.sh

Fixes user-reported issue in container deployment.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@hinriksnaer

Copy link
Copy Markdown
Owner Author

Closing in favor of full unstable → main PR

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