Skip to content

Commit 2af3042

Browse files
cdeustclaude
andcommitted
test(marketplace): assert the viz pin invariant, not a frozen triple
test_claude_marketplace_publishes_pinned_canonical_viz_identity froze version/ref/sha as literals, so moving the pin to v3.1.1 turned the guard red by construction — the test had to be hand-edited on every legitimate release. That makes it a change detector, not a guard: the literal adds no detection the manifest diff does not already give, while adding a second place to get wrong. It now asserts the invariant the #179 defect actually broke — a release pin names its tag (`ref == v{version}`) and pins a full 40-hex sha — and keeps the incident's rationale in a comment so the why survives. Tag existence upstream stays a network question, answered by scripts/check_marketplace_pins.py on every manifest PR and weekly cron. Discrimination shown, not asserted: the #179 shape (sha, no `ref`) is rejected on the missing key; a version/ref disagreement is rejected; the current pin passes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01263uv1QqR8TVzw2jXYUrXn
1 parent 7d29f4b commit 2af3042

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

tests_py/scripts/test_codex_plugin_contract.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import json
6+
import re
67
from pathlib import Path
78

89

@@ -109,15 +110,27 @@ def test_claude_marketplace_publishes_pinned_canonical_viz_identity() -> None:
109110

110111
# "3.0.0"/1c1940e... was the dangling pin from the #179-style incident:
111112
# cortex-viz never tagged a v3.0.0 (the rename landed straight on main
112-
# without a release); the first real tagged release carrying it was
113-
# v3.1.0 (cdeust/cortex-viz#130), which is what this pin now targets.
114-
assert canonical["version"] == "3.1.0"
115-
assert canonical["source"] == {
116-
"source": "github",
117-
"repo": "cdeust/cortex-viz",
118-
"ref": "v3.1.0",
119-
"sha": "052e4a40d3e6bddaeb1cec6662e23b451575c481",
120-
}
113+
# without a release), so the entry carried a sha and NO `ref` — a commit
114+
# nobody had released, advertised as a version.
115+
#
116+
# This asserts the invariant that defect broke, not the literal triple it
117+
# was fixed to. A frozen version/ref/sha has to be hand-edited on every
118+
# legitimate pin move, which makes it a change detector rather than a
119+
# guard: it adds no detection the manifest's own diff does not already
120+
# give, and adds a second place to get wrong. Whether the tag actually
121+
# exists upstream is a network question, answered by
122+
# scripts/check_marketplace_pins.py on every manifest PR and weekly cron.
123+
source = canonical["source"]
124+
assert source["source"] == "github"
125+
assert source["repo"] == "cdeust/cortex-viz"
126+
assert source["ref"] == f"v{canonical['version']}", (
127+
"a release pin names its tag; a sha with no ref, or a ref that "
128+
"disagrees with the advertised version, is the #179 defect"
129+
)
130+
assert re.fullmatch(r"[0-9a-f]{40}", source["sha"]), (
131+
"pin the full commit sha — an abbreviated or symbolic value silently "
132+
"re-resolves when the branch moves"
133+
)
121134
assert "standalone Hypermnesia MCP Viz server" in canonical["description"]
122135

123136

0 commit comments

Comments
 (0)