Skip to content

Commit edb30a4

Browse files
CrazyBaranclaude
andcommitted
fix(bundles): move agent-context pins to 1.1.0 and stop hardcoding them in fixtures
Copilot review round 3 on #4351: the agent-context bump left every checked-in bundle pinned to 1.0.0. BundleExtensionPrimitive enforces exact pins against the bundled manifest, so the offline installs in tests/integration/test_bundler_local_install.py and test_bundler_init_install.py failed, and all four examples/bundles/*/bundle.yml examples stopped being installable. - examples/bundles/{business-analyst,developer,product-manager, security-researcher}/bundle.yml: agent-context pin 1.0.0 -> 1.1.0 (exact pins are the point of the example format, so they stay literal). - The two integration-test fixtures now resolve the pin through a new tests/bundler_helpers.bundled_extension_version() helper, which reads the version via the same _locate_bundled_extension lookup the primitive enforces against - so the fixtures test the bundler's pin mechanics rather than a frozen version literal, and the next legitimate extension bump cannot silently break them again. The git and assess extensions are not pinned by any checked-in bundle; tests/contract/test_bundle_cli.py's 1.0.0 pin feeds `bundle validate`, which checks existence only, and keeps passing unchanged. Refs #4345 Assisted-by: Claude Code (model: claude-fable-5, autonomous) Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 002443a commit edb30a4

7 files changed

Lines changed: 43 additions & 8 deletions

File tree

‎examples/bundles/business-analyst/bundle.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ requires:
1717
provides:
1818
extensions:
1919
- id: "agent-context"
20-
version: "1.0.0"
20+
version: "1.1.0"
2121
presets:
2222
- id: "requirements-elicitation"
2323
version: "1.0.0"

‎examples/bundles/developer/bundle.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ requires:
1717
provides:
1818
extensions:
1919
- id: "agent-context"
20-
version: "1.0.0"
20+
version: "1.1.0"
2121
presets:
2222
- id: "implementation-planning"
2323
version: "1.0.0"

‎examples/bundles/product-manager/bundle.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ requires:
1919
provides:
2020
extensions:
2121
- id: "agent-context"
22-
version: "1.0.0"
22+
version: "1.1.0"
2323
presets:
2424
- id: "product-discovery"
2525
version: "1.0.0"

‎examples/bundles/security-researcher/bundle.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ requires:
1717
provides:
1818
extensions:
1919
- id: "agent-context"
20-
version: "1.0.0"
20+
version: "1.1.0"
2121
presets:
2222
- id: "security-compliance"
2323
version: "1.0.0"

‎tests/bundler_helpers.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ def valid_manifest_dict(**overrides) -> dict:
4343
return data
4444

4545

46+
def bundled_extension_version(extension_id: str) -> str:
47+
"""Version declared by the bundled extension the primitives will install.
48+
49+
Resolved through the same lookup ``BundleExtensionPrimitive`` uses, so
50+
fixtures that pin a real bundled extension stay valid across legitimate
51+
extension version bumps (#4345) instead of hardcoding a literal that
52+
drifts out of sync and trips the exact-pin enforcement.
53+
"""
54+
from specify_cli._assets import _locate_bundled_extension
55+
56+
bundled_dir = _locate_bundled_extension(extension_id)
57+
assert bundled_dir is not None, f"bundled extension '{extension_id}' not found"
58+
manifest = yaml.safe_load(
59+
(bundled_dir / "extension.yml").read_text(encoding="utf-8")
60+
)
61+
return manifest["extension"]["version"]
62+
63+
4664
def write_manifest(directory: Path, data: dict | None = None) -> Path:
4765
directory.mkdir(parents=True, exist_ok=True)
4866
manifest_path = directory / "bundle.yml"

‎tests/integration/test_bundler_init_install.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from specify_cli.bundler.models.manifest import BundleManifest
1919
from specify_cli.commands.bundle import _resolve_init_integration
2020
from specify_cli.bundler.services.packager import build_bundle
21-
from tests.bundler_helpers import valid_manifest_dict
21+
from tests.bundler_helpers import bundled_extension_version, valid_manifest_dict
2222

2323
runner = CliRunner()
2424

@@ -75,7 +75,14 @@ def _build_mini(tmp_path: Path) -> Path:
7575
"license": "MIT",
7676
},
7777
"requires": {"speckit_version": ">=0.1.0"},
78-
"provides": {"extensions": [{"id": "agent-context", "version": "1.0.0"}]},
78+
"provides": {
79+
"extensions": [
80+
{
81+
"id": "agent-context",
82+
"version": bundled_extension_version("agent-context"),
83+
}
84+
]
85+
},
7986
}
8087
),
8188
encoding="utf-8",

‎tests/integration/test_bundler_local_install.py‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
from specify_cli import app
1919
from specify_cli.bundler import BundlerError
2020
from specify_cli.commands.bundle import _local_manifest_source
21-
from tests.bundler_helpers import make_project, valid_manifest_dict, write_manifest
21+
from tests.bundler_helpers import (
22+
bundled_extension_version,
23+
make_project,
24+
valid_manifest_dict,
25+
write_manifest,
26+
)
2227

2328

2429
def test_local_source_none_for_non_path():
@@ -116,7 +121,12 @@ def test_install_bundled_extension_from_zip_offline(tmp_path: Path):
116121
},
117122
"requires": {"speckit_version": ">=0.1.0"},
118123
"provides": {
119-
"extensions": [{"id": "agent-context", "version": "1.0.0"}]
124+
"extensions": [
125+
{
126+
"id": "agent-context",
127+
"version": bundled_extension_version("agent-context"),
128+
}
129+
]
120130
},
121131
}
122132
),

0 commit comments

Comments
 (0)