The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: restore discriminating package and manifest boundary witnesses
ethernetec848afd3d0b
diff --git a/tests-js/bundle-inputs.test.mjs b/tests-js/bundle-inputs.test.mjsindex 92ddf044986..501f2253d6e 100644--- a/tests-js/bundle-inputs.test.mjs+++ b/tests-js/bundle-inputs.test.mjs@@ -43,6 +43,7 @@ test('package transitions are ordered, identity-preserving, and report through ttest.each(['windows', 'macos'])('%s rejects malformed and incompatible pairs', platform => {const cases = [['schema', 2, /schema/], ['platform', 'linux', /platform/], ['arch', 'riscv', /architecture/],+ ['arch', 'arm64', /architecture/],['new', null, /tag/], ['new.tag', 'main', /tag/], ['new.commit', 'not-a-commit', /commit/],['new.identity', 4, /identity/], ['new.identity', 'other.bundle', /identity/],['new.commit', 'a'.repeat(40), /commit/], ['new.artifact', null, /SHA-256/],@@ -61,7 +62,15 @@ test.each(['windows', 'macos'])('%s rejects malformed and incompatible pairs', p['new.teamId', ['ABCDEFGHIJ'], /teamId/], ['new.teamId', '', /teamId/], ['new.teamId', 'OTHER12345', /signing team/],]),]- for (const [field, value, diagnostic] of cases) {+ const oldCases = cases.filter(([field]) => field.startsWith('new') && field !== 'new.version')+ .map(([field, value, diagnostic]) => [field.replace(/^new/, 'old'),+ field === 'new.commit' && value === 'a'.repeat(40) ? 'b'.repeat(40) :+ field === 'new.artifact.sha256' && value === 'a'.repeat(64) ? 'b'.repeat(64) : value, diagnostic])+ oldCases.push(...(platform === 'windows' ? [+ ['old.version', '1.3.0.0', /increase/], ['old.version', '1.4.0.0', /increase/],+ ['old.version', '1.2.0', /four numeric/], ['old.version', '1.2.65536.0', /16 bits/],+ ] : [['old.version', '1.9.0', /match/]]))+ for (const [field, value, diagnostic] of [...cases, ...oldCases]) {const bad = fixture(platform), keys = field.split('.')const last = keys.pop()keys.reduce((object, key) => object[key], bad)[last] = value@@ -69,6 +78,7 @@ test.each(['windows', 'macos'])('%s rejects malformed and incompatible pairs', pexpect(() => validateDownloadedBundle(bad, platform, 'x64'), field).toThrow(diagnostic)}expect(() => validateBundleInputs(fixture(platform), platform, 'riscv')).toThrow('Unsupported')+ expect(() => validateBundleInputs(fixture(platform), platform, 'arm64')).toThrow('architecture')const pair = fixture(platform)if (platform === 'macos') {pair.new.tag = 'v1.3.0-canary.20260907000000'; pair.new.version = pair.new.tag.slice(1)@@ -113,10 +123,12 @@ test.each(['windows', 'macos'])('%s staging and resumed validation use actual fi// Native Mac resume uses require(), not an ESM-only import.const validator = fileURLToPath(new URL('../tests/install/e2e-assets/bundle-manifest.cjs', import.meta.url))execFileSync(process.execPath, ['-e', 'require(process.argv[1]).validateDownloadedBundle(require(process.argv[2]), process.argv[3], "x64")', validator, filename, platform])- for (const missing of [undefined, path.join(directory, 'missing'), directory]) {- const bad = structuredClone(result); bad.new.artifact.path = missing- expect(() => validateDownloadedBundle(bad, platform, 'x64')).toThrow('artifact.path')- if (platform === 'windows') expect(validateBundledManifest(bad, { expectedPublisher: 'CN=Test' }).ok).toBe(false)+ for (const slot of ['old', 'new']) {+ for (const missing of [undefined, path.join(directory, 'missing'), directory]) {+ const bad = structuredClone(result); bad[slot].artifact.path = missing+ expect(() => validateDownloadedBundle(bad, platform, 'x64')).toThrow('artifact.path')+ if (platform === 'windows') expect(validateBundledManifest(bad, { expectedPublisher: 'CN=Test' }).ok).toBe(false)+ }}const altered = structuredClone(result); altered.new.commit = altered.old.commitexpect(() => validateDownloadedBundle(altered, platform, 'x64')).toThrow('commit')diff --git a/tests/pm/test_workspace_build_inputs.py b/tests/pm/test_workspace_build_inputs.pyindex 459e7b7793e..dc2378dd7a7 100644--- a/tests/pm/test_workspace_build_inputs.py+++ b/tests/pm/test_workspace_build_inputs.py@@ -26,7 +26,9 @@ def _buildable_source(plugin):encoding="utf-8",)(plugin / "plugin.yaml").write_text("name: replay-plugin\n", encoding="utf-8")- (plugin / "replay_plugin.py").write_text("VALUE = 'recorded plugin bytes'\n", encoding="utf-8")+ (plugin / "replay_plugin").mkdir()+ (plugin / "replay_plugin/__init__.py").write_text("from .values import VALUE\n", encoding="utf-8")+ (plugin / "replay_plugin/values.py").write_text("VALUE = 'recorded plugin bytes'\n", encoding="utf-8")(plugin / "README.md").write_text("# fixture readme")(plugin / "LICENSE").write_text("MIT")# The backend must consume the copied metadata inputs too.@@ -40,7 +42,8 @@ def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):name = "replay_plugin-1.0-py3-none-any.whl"dist = "replay_plugin-1.0.dist-info"entries = {- "replay_plugin.py": Path("replay_plugin.py").read_bytes(),+ "replay_plugin/__init__.py": Path("replay_plugin/__init__.py").read_bytes(),+ "replay_plugin/values.py": Path("replay_plugin/values.py").read_bytes(),dist + "/METADATA": "Metadata-Version: 2.1\\nName: replay-plugin\\nVersion: 1.0\\n",dist + "/WHEEL": "Wheel-Version: 1.0\\nRoot-Is-Purelib: true\\nTag: py3-none-any\\n",}@@ -113,7 +116,7 @@ def test_repair_replays_saved_in_tree_build_backend(tmp_path):(plugin / "pyproject.toml").write_text("damaged [", encoding="utf-8")(plugin / "plugin.yaml").write_text("damaged [", encoding="utf-8")(plugin / "build/backend.py").unlink()- (plugin / "replay_plugin.py").write_text("raise RuntimeError('damaged live source')\n", encoding="utf-8")+ (plugin / "replay_plugin/values.py").write_text("raise RuntimeError('damaged live source')\n", encoding="utf-8")repair = PythonEnvironment(uv=Path(uv), python=Path(sys.executable), destination=tmp_path / "repair-env",# A fresh cache forces uv to invoke the saved backend again, not reuse a wheel.diff --git a/tests/test_old_updater_shims.py b/tests/test_old_updater_shims.pyindex 32f44bf2399..b0025b26b8c 100644--- a/tests/test_old_updater_shims.py+++ b/tests/test_old_updater_shims.py@@ -150,8 +150,11 @@ def test_retired_probes_and_refreshes_do_no_work(no_external_work, tmp_path):assert config.format_unsupported_install_warning("pip") == ""assert main._detect_venv_python_processes() == []assert main._detect_venv_python_processes(exclude_pids={123}) == []- assert browser_tool.warm_agent_browser_npx_cache() is False- assert browser_tool.warm_agent_browser_npx_cache(timeout=0.1) is False+ # Require the permanent historical definition, never the temporary lazy pointer.+ warmer = vars(browser_tool)["warm_agent_browser_npx_cache"]+ assert warmer.__module__ == browser_tool.__name__+ assert warmer() is False+ assert warmer(timeout=0.1) is False# A private, never-raised type keeps historical `except helper():` valid# without swallowing real errors or resolving the removed quarantine code.error_type = update_cmd._shim_quarantine_error_type()