diff options
| author | Drew Ritter <drew@primeradiant.com> | 2026-11-03 15:20:42 -0800 |
|---|---|---|
| committer | Drew Ritter <drew@primeradiant.com> | 2026-11-03 15:20:42 -0800 |
| commit | 58e107b4824f4cd084ecdc7f3e01c6dd20f9e391 (patch) | |
| tree | b9ea88a675416d3407f7ac6096f227da8d4ec035 /tests/codex | |
| parent | 22f0b463e7a5e579904dd6211a520321035526f7 (diff) | |
Fix Codex portal release metadata and hook packagingcodex/wip-codex-marketplace-upload-7.0.2
Drew reported that the v7.0.2 ZIP was rejected for a hooks declaration,
a subtitle longer than 30 characters, and a missing support URL. The
published main release lacked the fixes carried on the previous
marketplace upload branch.
Carry forward d19b503b, 6e11b443, and 705a8504: use the approved short
subtitle and support URL, and omit only the staged manifest hooks field.
Keep hooks: {} in the repository manifest so local installs do not
auto-discover the Claude Code SessionStart hook. Preserve the extracted
manifest permissions when writing its portal representation.
Retain behavioral archive coverage for ZIP and tar.gz, unchanged source
metadata, and restrictive umask. Add source-manifest checks for the
portal subtitle length/single-line contract and required HTTPS support
URL. The archive and source-manifest regressions failed before the fix;
all pass after it, as do shellcheck, bash syntax, and diff checks.
Build lineage is main/v7.0.2 at 22f0b463, with only these packaging and
listing corrections. Drew explicitly required building the replacement
ZIP from main before carrying the fixes onto dev. No dev content is part
of the release build. Portal validation remains separate from local
verification.
Tracked in PRI-3439.
Diffstat (limited to 'tests/codex')
| -rwxr-xr-x | tests/codex/test-marketplace-manifest.sh | 12 | ||||
| -rwxr-xr-x | tests/codex/test-package-codex-plugin.sh | 48 |
2 files changed, 57 insertions, 3 deletions
diff --git a/tests/codex/test-marketplace-manifest.sh b/tests/codex/test-marketplace-manifest.sh index 4301a06..db647c4 100755 --- a/tests/codex/test-marketplace-manifest.sh +++ b/tests/codex/test-marketplace-manifest.sh @@ -9,6 +9,7 @@ python3 - "$MARKETPLACE" "$REPO_ROOT" <<'PY' import json import sys from pathlib import Path +from urllib.parse import urlsplit marketplace_path = Path(sys.argv[1]) repo_root = Path(sys.argv[2]) @@ -52,6 +53,17 @@ if not plugin_manifest.exists(): manifest = json.loads(plugin_manifest.read_text(encoding="utf-8")) assert_equal(manifest.get("name"), plugin.get("name"), "plugin manifest name") +interface = manifest.get("interface", {}) +subtitle = interface.get("shortDescription") +if not isinstance(subtitle, str) or not 1 <= len(subtitle) <= 30: + raise AssertionError("marketplace subtitle must contain 1 to 30 characters") +if "\n" in subtitle or "\r" in subtitle: + raise AssertionError("marketplace subtitle must fit on one line") + +support_url = urlsplit(interface.get("supportURL", "")) +if support_url.scheme != "https" or not support_url.hostname: + raise AssertionError("marketplace support URL must be an HTTPS URL") + # Codex auto-discovers a plugin's hooks/hooks.json whenever the Codex manifest # has no `hooks` field: load_plugin_hooks falls back to a hardcoded # DEFAULT_HOOKS_CONFIG_FILE = "hooks/hooks.json" and registers it. That file is diff --git a/tests/codex/test-package-codex-plugin.sh b/tests/codex/test-package-codex-plugin.sh index 05e150a..bb13758 100755 --- a/tests/codex/test-package-codex-plugin.sh +++ b/tests/codex/test-package-codex-plugin.sh @@ -118,6 +118,28 @@ read_archive_file() { esac } +assert_packaged_manifest() { + local archive_path="$1" + + if read_archive_file "$archive_path" .codex-plugin/plugin.json | python3 -c ' +import json +import subprocess +import sys + +source = json.loads(subprocess.check_output( + ["git", "show", "HEAD:.codex-plugin/plugin.json"], cwd=sys.argv[1] +)) +manifest = json.load(sys.stdin) +assert "hooks" not in manifest, "packaged manifest must omit hook declarations" +source.pop("hooks", None) +assert manifest == source, "packaging must preserve all other manifest fields" +' "$REPO_ROOT"; then + pass "archive omits hook declarations and preserves all other manifest fields" + else + fail "archive omits hook declarations and preserves all other manifest fields" + fi +} + write_metadata_fixture() { local destination="$1" local skill @@ -145,6 +167,7 @@ write_metadata_fixture "$metadata_source" source_hooks="$(python3 -c 'import json; print(json.load(open("'"$REPO_ROOT"'/.codex-plugin/plugin.json")).get("hooks"))')" assert_equals "$source_hooks" "{}" "source Codex manifest suppresses local hook auto-discovery" +source_manifest_checksum="$(shasum -a 256 "$REPO_ROOT/.codex-plugin/plugin.json" | awk '{print $1}')" if output="$("$SCRIPT_UNDER_TEST" --allow-dirty --metadata-source "$metadata_source" --output "$archive" 2>&1)"; then pass "package script exits successfully" @@ -193,9 +216,7 @@ assert_contains "$archive_paths" "skills/brainstorming/agents/openai.yaml" "arch assert_contains "$archive_paths" "assets/app-icon.png" "archive includes app icon" assert_contains "$archive_paths" "assets/superpowers-small.svg" "archive includes composer icon" -manifest_summary="$(read_archive_file "$archive" .codex-plugin/plugin.json | python3 -c 'import json,sys; data=json.load(sys.stdin); print("\t".join([data["name"], data["version"], data["skills"], str(data.get("hooks"))]))')" -expected_version="$(python3 -c 'import json; print(json.load(open("'"$REPO_ROOT"'/.codex-plugin/plugin.json"))["version"])')" -assert_equals "$manifest_summary" "superpowers $expected_version ./skills/ $source_hooks" "archive manifest preserves source hooks" +assert_packaged_manifest "$archive" skill_count="$(find "$extracted/skills" -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ')" metadata_count="$(find "$extracted/skills" -path '*/agents/openai.yaml' -type f | wc -l | tr -d ' ')" @@ -217,6 +238,23 @@ PY )" assert_equals "$zip_times" "(1980, 1, 1, 0, 0, 0)" "zip archive normalizes entry timestamps" +restrictive_archive="$TEST_ROOT/superpowers-restrictive.zip" +( + umask 077 + "$SCRIPT_UNDER_TEST" --allow-dirty --metadata-source "$metadata_source" --output "$restrictive_archive" >/dev/null +) +restrictive_manifest_mode="$(python3 - "$restrictive_archive" <<'PY' +import stat +import sys +import zipfile + +with zipfile.ZipFile(sys.argv[1]) as archive: + manifest = archive.getinfo(".codex-plugin/plugin.json") + print(oct(stat.S_IMODE(manifest.external_attr >> 16))) +PY +)" +assert_equals "$restrictive_manifest_mode" "0o644" "manifest preserves its mode under a restrictive umask" + if tar_output="$("$SCRIPT_UNDER_TEST" --allow-dirty --metadata-source "$metadata_source" --format tar.gz --output "$tar_archive" 2>&1)"; then pass "package script writes explicit tar.gz archive" else @@ -228,6 +266,7 @@ assert_contains "$tar_output" "Format: tar.gz" "reports explicit tar.gz format" extract_archive "$tar_archive" "$tar_extracted" tar_archive_paths="$(list_archive "$tar_archive" | normalize_archive_paths)" assert_equals "$tar_archive_paths" "$archive_paths" "zip and tar.gz archives contain the same paths" +assert_packaged_manifest "$tar_archive" tar_task_brief_mode="$(tar -tzvf "$tar_archive" skills/subagent-driven-development/scripts/task-brief | awk '{print $1}')" assert_equals "$tar_task_brief_mode" "-rwxr-xr-x" "tar.gz archive preserves executable script mode" @@ -311,6 +350,9 @@ else fi assert_contains "$dirty_output" "Working tree has uncommitted changes:" "dirty worktree reports changed files" +assert_equals "$(shasum -a 256 "$REPO_ROOT/.codex-plugin/plugin.json" | awk '{print $1}')" \ + "$source_manifest_checksum" "packaging leaves the repository manifest unchanged" + if [[ "$FAILURES" -eq 0 ]]; then echo "All Codex package archive tests passed" else |
