Files
ironclaw/scripts/test-ci-artifact-naming.sh
Illia Polosukhin 0ab1a47479 fix(registry): use canonical underscore names in manifests to fix WASM install (#2029)
* fix(registry): use canonical underscore names in manifests to fix WASM install

Manifest `name` fields used hyphens (e.g. "google-calendar") but the internal
canonical form uses underscores ("google_calendar"). The release workflow
packages .wasm files named after the manifest `name`, so archives contained
"google-calendar.wasm". The extension manager canonicalized the name to
"google_calendar" before extraction, looked for "google_calendar.wasm", and
failed with "tar.gz archive does not contain 'google_calendar.wasm'".

Two-part fix:
- Update all 9 hyphenated manifest `name` fields and `_bundles.json` refs to
  use the canonical underscore form. Future releases will package archives
  with matching filenames.
- Add hyphenated-name fallback in both tar.gz extractors so existing v0.22.0
  release artifacts (which contain hyphenated filenames) remain installable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* style: cargo fmt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address PR review — extract shared helper, rename manifest files, improve errors

- Extract `ArchiveFilenames` helper to `naming.rs` to deduplicate alias
  matching logic between `manager.rs` and `installer.rs`
- Rename all 9 manifest JSON files to match their canonical underscore
  `name` fields (e.g. `google-calendar.json` → `google_calendar.json`)
- Improve "not found" error messages to list both canonical and alias
  filenames that were tried
- Update `test_extract_correct_wasm_from_tool_bundle` to use canonical
  `slack_tool` name matching current production path
- Update artifact naming test script for renamed manifests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 13:43:57 +09:00

61 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Test that kind-prefixed artifact filenames are parsed correctly into
# manifest paths. Mirrors the parsing logic in release.yml.
set -euo pipefail
cd "$(dirname "$0")/.."
PASS=0
FAIL=0
assert_parse() {
local filename="$1" expected_kind="$2" expected_name="$3"
local kind name manifest
kind=$(echo "$filename" | cut -d'-' -f1)
name=$(echo "$filename" | sed "s/^${kind}-//" | sed 's/-[0-9].*-wasm32-wasip2\.tar\.gz$//')
manifest="registry/${kind}s/${name}.json"
if [[ "$kind" != "$expected_kind" ]]; then
echo "FAIL: $filename → kind=$kind, expected $expected_kind"
FAIL=$((FAIL + 1))
return
fi
if [[ "$name" != "$expected_name" ]]; then
echo "FAIL: $filename → name=$name, expected $expected_name"
FAIL=$((FAIL + 1))
return
fi
echo "OK: $filename$manifest"
PASS=$((PASS + 1))
}
# Tool and channel with same base name use different manifest filenames
assert_parse "tool-slack_tool-0.2.1-wasm32-wasip2.tar.gz" "tool" "slack_tool"
assert_parse "channel-slack-0.2.1-wasm32-wasip2.tar.gz" "channel" "slack"
# Same collision case for telegram
assert_parse "tool-telegram_mtproto-0.2.2-wasm32-wasip2.tar.gz" "tool" "telegram_mtproto"
assert_parse "channel-telegram-0.2.2-wasm32-wasip2.tar.gz" "channel" "telegram"
# Underscore extension names (manifest filenames use underscores)
assert_parse "tool-web_search-0.2.0-wasm32-wasip2.tar.gz" "tool" "web_search"
assert_parse "tool-google_calendar-0.1.0-wasm32-wasip2.tar.gz" "tool" "google_calendar"
assert_parse "tool-google_docs-0.1.0-wasm32-wasip2.tar.gz" "tool" "google_docs"
assert_parse "tool-google_drive-0.1.0-wasm32-wasip2.tar.gz" "tool" "google_drive"
assert_parse "tool-google_sheets-0.1.0-wasm32-wasip2.tar.gz" "tool" "google_sheets"
assert_parse "tool-google_slides-0.1.0-wasm32-wasip2.tar.gz" "tool" "google_slides"
# Simple names
assert_parse "channel-discord-0.2.0-wasm32-wasip2.tar.gz" "channel" "discord"
assert_parse "channel-whatsapp-0.1.0-wasm32-wasip2.tar.gz" "channel" "whatsapp"
assert_parse "tool-github-0.2.0-wasm32-wasip2.tar.gz" "tool" "github"
assert_parse "tool-gmail-0.1.0-wasm32-wasip2.tar.gz" "tool" "gmail"
# Pre-release versions
assert_parse "tool-slack-0.2.1-alpha.1-wasm32-wasip2.tar.gz" "tool" "slack"
echo ""
echo "Results: $PASS passed, $FAIL failed"
[[ $FAIL -eq 0 ]] || exit 1