Skip to content

The agent that grows with you

test: pin admission outputs and the holder-scan stat seam

ethernet55ec2f5aa213
diff --git a/tests/ci/test_desktop_release_commit_admission.py b/tests/ci/test_desktop_release_commit_admission.py
index feef73e3d10..fb46f77a53c 100644
--- a/tests/ci/test_desktop_release_commit_admission.py
+++ b/tests/ci/test_desktop_release_commit_admission.py
@@ -49,7 +49,10 @@ def test_mixed_dispatch_is_refused_before_loading_repository_code(tmp_path):
result = run_admission(clone, {**env, **extra})
assert result.returncode != 0, result.stdout + result.stderr
assert not witness.exists(), 'rejected input executed the checkout admission module'
- assert (clone / 'outputs').read_text(encoding='utf-8') == 'prior=value\n'
+ # The R2 public-url echo precedes admission; a refused dispatch writes no sha/channel/version.
+ outputs = dict(line.split('=', 1) for line in (clone / 'outputs').read_text(encoding='utf-8').splitlines())
+ assert outputs['prior'] == 'value'
+ assert not {'sha', 'channel', 'payload-version'} & outputs.keys()
def test_trusted_dispatch_admits_a_pushed_feature_without_switching_checkout(tmp_path):
@@ -83,7 +86,10 @@ def test_trusted_dispatch_admits_a_pushed_feature_without_switching_checkout(tmp
result = run_admission(clone, environment(clone, commit))
assert result.returncode == 0, result.stdout + result.stderr
outputs = dict(line.split('=', 1) for line in (clone / 'outputs').read_text(encoding='utf-8').splitlines())
- assert outputs == {'sha': commit, 'channel': 'commit', 'payload-version': '3.2.1'}
+ # public-root/public-base mirror the R2 public URL (empty outside CI); the admission
+ # contract is the pinned sha, the commit channel and the payload version.
+ assert {key: outputs[key] for key in ('sha', 'channel', 'payload-version')} == {
+ 'sha': commit, 'channel': 'commit', 'payload-version': '3.2.1'}
assert _git('rev-parse', 'HEAD', cwd=clone) == main
requests = [json.loads(line) for line in permission_log.read_text(encoding='utf-8').splitlines()]
assert requests and all(row[1] == 'repos/fixture/repo/collaborators/maintainer/permission' for row in requests)
diff --git a/tests/hermes_state/test_state_db_repair_live_writer_guard.py b/tests/hermes_state/test_state_db_repair_live_writer_guard.py
index 3e0aeae73ea..ef2846b88df 100644
--- a/tests/hermes_state/test_state_db_repair_live_writer_guard.py
+++ b/tests/hermes_state/test_state_db_repair_live_writer_guard.py
@@ -270,7 +270,12 @@ def test_uninspectable_watched_identity_blocks_alias_before_sqlite(
real_stat = hermes_state_holders.os.stat
def _stat(path, *args, **kwargs):
- if str(path) == str(db) and not args and not kwargs:
+ # ``os`` is shared: deny only the holder scan's own probe of the watched file, not
+ # the ``Path.exists`` precheck in repair_state_db_schema (which would otherwise
+ # swallow the error and report the database missing).
+ frame = sys._getframe(1)
+ if (str(path) == str(db) and not args and not kwargs
+ and frame.f_globals.get("__name__") == "hermes_state_holders"):
raise PermissionError(errno.EACCES, "watched identity denied", path)
if path == "/proc/4242/fd/7":
return real_stat(db)