Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions lib/fish/deployer.fish
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,10 @@ function deployer-deploy-module
fedpunk-config-init
end

# Normalize git URLs to module names for consistent config storage
# git@gitlab.com:org/thinkpad-fans.git -> thinkpad-fans
set -l module_name "$module_ref"
if module-ref-is-url "$module_ref"
# Extract repo name from URL (same logic as external-module-get-storage-path)
set module_name (string replace -r '\.git$' '' "$module_ref")
set module_name (string replace -r '^.*[/:]' '' "$module_name")
end

# Add normalized module name to config
fedpunk-config-add-module "$module_name"
# Add module reference to config (URL for external modules, name for local)
# This ensures param-save-to-config can find the module later
# Previously normalized URLs to names, causing duplicate entries when params were added
fedpunk-config-add-module "$module_ref"

# Use existing fedpunk-module deploy (already handles local + git)
if fedpunk-module deploy "$module_ref"
Expand Down
12 changes: 5 additions & 7 deletions test/ci/test-external-module-params-no-duplicate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,14 @@ echo ""
#
# Test 2: Simulate the bug scenario - deployer-deploy-module with params
#
echo "=== Test 2: Simulate deployer-deploy-module bug scenario ==="
echo "=== Test 2: Deploy module with parameters (testing fix) ==="

# Initialize config
run_fish "fedpunk-config-init" 2>&1 || true

# Simulate the buggy behavior:
# Step 1: deployer-deploy-module adds NORMALIZED NAME (line 58)
NORMALIZED_NAME="test-params-ext-module"
run_fish "fedpunk-config-add-module '$NORMALIZED_NAME'" 2>&1 || true
echo " Step 1: Added normalized name to config: $NORMALIZED_NAME"
# Step 1: deployer-deploy-module adds module URL (FIXED behavior)
run_fish "fedpunk-config-add-module '$TEST_MODULE_URL'" 2>&1 || true
echo " Step 1: Added module URL to config: $TEST_MODULE_URL"

# Step 2: param-save-to-config tries to find using URL (not name)
# This is what happens when fedpunk-module deploy calls param-prompt-required
Expand All @@ -131,7 +129,7 @@ param-save-to-config '$TEST_MODULE_URL' 'auth_mode' 'enabled'
" 2>&1 || true

echo " Step 2: Saved params using URL: $TEST_MODULE_URL"
echo " (This is where the duplicate gets created if bug exists)"
echo " (Should update existing entry, not create duplicate)"
echo ""

#
Expand Down
Loading