Skip to content

The agent that grows with you

fix(config-remote): review round 1 — boot selector latch, stale polls, migration diffs, dashboard refusals

Ben Barclay23b346f6cb8d
diff --git a/hermes_cli/env_loader.py b/hermes_cli/env_loader.py
index 01f5eebe998..760a8999534 100644
--- a/hermes_cli/env_loader.py
+++ b/hermes_cli/env_loader.py
@@ -701,24 +701,48 @@ def _revoke_secret_source_writes(home_path: Path, *, keep) -> None:
_SECRET_SOURCE_WRITES_BY_HOME.pop(home_key, None)
-def _refuse_protected_env_from_sources(report) -> None:
+def _refuse_protected_env_from_sources(report, backend=None, environ_before=None) -> None:
"""D32: the config backend's own credential (which plane, which agent, which token) must never
come from a secret source — a source that could change it could point config at another plane.
- Exits (the backend is unusable), even when the pre-existing value won."""
- from hermes_cli.config_backend import ConfigBackendUnavailable, get_config_backend
+ Exits (the backend is unusable), even when the pre-existing value won.
- protected = get_config_backend().protected_env_names()
- if not protected:
- return
+ *backend* is the backend selected BEFORE the sources ran: judging by the backend selected after
+ them would let a source that writes ``HERMES_CONFIG_BACKEND=file`` switch remote mode off and
+ disarm this very check. The selector itself is never a source's to change, under any backend:
+ a source's write to it is reverted (to its *environ_before* value) before anything else."""
+ from hermes_cli.config_backend import BACKEND_ENV, ConfigBackendUnavailable, get_config_backend
+
+ if backend is None:
+ backend = get_config_backend()
supplied = set(report.provenance)
for src in report.sources:
supplied.update(getattr(src, "skipped_existing", ()) or ())
+ protected = backend.protected_env_names() | {BACKEND_ENV}
clash = sorted(supplied & protected)
- if clash:
- raise ConfigBackendUnavailable(
- f"A secrets: source supplies {', '.join(clash)}, which the {get_config_backend().name!r} config "
- "backend uses to reach its config plane. That credential must come from auth.json or .env, never "
- "from a secret source; remove the mapping. Hermes does not start with it.")
+ if not clash:
+ return
+ if environ_before is not None: # undo the source's writes to protected names before deciding
+ for name in clash:
+ if name in environ_before:
+ os.environ[name] = environ_before[name]
+ else:
+ os.environ.pop(name, None)
+ if not backend.protected_env_names():
+ # The file backend has no plane credential: only the selector clashed. Reverted, and dropped
+ # from the report so no provenance/snapshot re-applies it later; keep going.
+ for name in clash:
+ report.provenance.pop(name, None)
+ for src in report.sources:
+ for bucket in (getattr(src, "applied", None), getattr(src, "skipped_existing", None)):
+ if isinstance(bucket, list) and name in bucket:
+ bucket.remove(name)
+ print(f" Secret sources: ignored {BACKEND_ENV} from a secrets: source (the config backend is "
+ "chosen by .env or the process environment only).", file=sys.stderr)
+ return
+ raise ConfigBackendUnavailable(
+ f"A secrets: source supplies {', '.join(clash)}, which the {backend.name!r} config "
+ "backend uses to reach its config plane. That credential must come from auth.json or .env, never "
+ "from a secret source; remove the mapping. Hermes does not start with it.")
def _apply_external_secret_sources(home_path: Path) -> None:
@@ -766,6 +790,10 @@ def _apply_external_secret_sources(home_path: Path) -> None:
if active is not None:
_revoke_secret_source_writes(home_path, keep=lambda _name, source: source in active)
environ_before = dict(os.environ)
+ # Latched before the sources run: a source must not be able to re-select the backend (D32).
+ from hermes_cli.config_backend import get_config_backend
+
+ backend_before = get_config_backend()
try:
report = apply_all(cfg, home_path)
@@ -774,7 +802,7 @@ def _apply_external_secret_sources(home_path: Path) -> None:
if not report.sources: # no source enabled: keep retrying cheaply so flipping one on takes effect
return
- _refuse_protected_env_from_sources(report)
+ _refuse_protected_env_from_sources(report, backend_before, environ_before)
# A real fetch attempt happened (success OR error): mark the home so the 3-5 import-time calls per
# startup don't re-fetch / re-print (error retries are opt-in via reset_secret_source_cache()).
diff --git a/hermes_cli/web_routers/_common.py b/hermes_cli/web_routers/_common.py
index 8b0f0337787..46b2e19bc4b 100644
--- a/hermes_cli/web_routers/_common.py
+++ b/hermes_cli/web_routers/_common.py
@@ -14,6 +14,7 @@ from typing import Any, Callable, Dict, Optional
from fastapi import HTTPException
+from hermes_cli.config_backend import ConfigLockedError, ConfigValueError, ConfigWriteError
from hermes_cli.web_deps import LateState, late
from hermes_cli.web_server_profiles import _profile_cli_args
@@ -84,11 +85,28 @@ def destructive_profile(profile: Optional[str], route: str) -> Optional[str]:
return profile
+def config_refusal_http(exc: ConfigWriteError) -> Optional[HTTPException]:
+ """The HTTP error for an EXPECTED config-backend refusal, or None for an unexpected failure.
+
+ A lock (403), a value the backend cannot store (400) and a lost CAS race (409) are the
+ caller's to fix, and their messages are ours or the config plane's own refusal text (a path
+ and the level that locks it; never a value or a credential), so they pass through (design
+ §4.3: v1 shows the server's 403 message). Anything else stays opaque."""
+ if isinstance(exc, ConfigLockedError):
+ return HTTPException(status_code=403, detail=str(exc))
+ if isinstance(exc, ConfigValueError):
+ return HTTPException(status_code=400, detail=str(exc))
+ if exc.code == "config_version_conflict":
+ return HTTPException(status_code=409, detail=str(exc))
+ return None
+
+
@contextlib.contextmanager
def http_failure(log_msg: str, status: int, prefix: Optional[str] = None, *, detail: Optional[str] = None):
"""Map unexpected exceptions to an ``HTTPException``.
- ``HTTPException`` passes through; anything else is logged with ``log_msg`` (traceback),
+ ``HTTPException`` passes through; an expected config-backend refusal becomes its own status
+ and message (:func:`config_refusal_http`); anything else is logged with ``log_msg`` (traceback),
then re-raised as ``HTTPException(status, f"{prefix}: {exc}")`` — or ``detail`` when given
(fixed message, exception text only in the log).
"""
@@ -96,6 +114,12 @@ def http_failure(log_msg: str, status: int, prefix: Optional[str] = None, *, det
yield
except HTTPException:
raise
+ except ConfigWriteError as exc:
+ refusal = config_refusal_http(exc)
+ if refusal is None:
+ log.exception(log_msg)
+ raise HTTPException(status_code=status, detail=detail if detail is not None else f"{prefix}: {exc}")
+ raise refusal from exc
except Exception as exc:
log.exception(log_msg)
raise HTTPException(status_code=status, detail=detail if detail is not None else f"{prefix}: {exc}")
diff --git a/plugins/config_backends/remote/backend.py b/plugins/config_backends/remote/backend.py
index 9154d735acc..5955080a302 100644
--- a/plugins/config_backends/remote/backend.py
+++ b/plugins/config_backends/remote/backend.py
@@ -72,6 +72,9 @@ class _ProfileState:
provenance: Dict[str, str] = field(default_factory=dict)
changed_ns: int = 0
gen: int = 0
+ installed: int = 0 # bumped by every _install; a GET started before a newer install is stale
+ base: Optional[Dict[str, Any]] = None # the migrated doc writes diff against (None = server_config)
+ migrating: Optional[int] = None # the `installed` a running in-memory migration is for
postprocessed: bool = False
in_postprocess: bool = False
fetched_at: float = 0.0
@@ -158,7 +161,13 @@ class RemoteBackend:
"(HERMES_CONFIG_BACKEND=remote has no local fallback).") from exc
def _fetch_into(self, st: _ProfileState, *, conditional: bool) -> bool:
- """GET ``/self`` into ``st``; True when the document changed. Raises :class:`_FetchFailed`."""
+ """GET ``/self`` into ``st``; True when the document changed. Raises :class:`_FetchFailed`.
+
+ The GET runs outside ``st.lock`` (a slow plane must not stall writers), so a write can
+ install a newer document while it is in flight. Its response is then stale, even when its
+ ``profileVersion`` matches (an upper level may have changed in between): it is dropped, and
+ the next poll fetches again."""
+ started = st.installed
try:
resp = client.request("GET", st.home, st.profile, etag=st.etag if conditional else None)
except PlaneCredentialError as exc:
@@ -170,6 +179,9 @@ class RemoteBackend:
return False
if resp.status == 200 and _effective_ok(resp.body):
with st.lock:
+ if st.installed != started:
+ logger.debug("Remote Config: dropped a fetch for profile %r that a write overtook", st.profile)
+ return False
self._install(st, resp.body, resp.etag)
return True
if resp.status == 200:
@@ -201,6 +213,8 @@ class RemoteBackend:
st.provenance = dict(body.get("provenance") or {})
st.changed_ns = time.time_ns()
st.gen += 1
+ st.installed += 1
+ st.base = None
st.postprocessed = False
st.fetched_at, st.last_error = time.time(), None
st.next_poll = time.monotonic() + poll_interval() * random.uniform(0.9, 1.1)
@@ -218,7 +232,7 @@ class RemoteBackend:
if st.postprocessed or st.in_postprocess:
return
st.in_postprocess = True
- etag = st.etag
+ seen = st.installed
try:
try:
from hermes_cli.config import _known_top_level_keys
@@ -235,20 +249,31 @@ class RemoteBackend:
elif current < SUPPORT_FLOOR_VERSION:
logger.warning("Remote Config: profile %r was written by config version %d, below the "
"migration floor %d; not migrated", st.profile, current, SUPPORT_FLOOR_VERSION)
- st.postprocessed = st.etag == etag # a poll that landed meanwhile needs its own pass
+ st.postprocessed = st.installed == seen # a doc installed meanwhile needs its own pass
finally:
st.in_postprocess = False
def _migrate_in_memory(self, st: _ProfileState, current: int, run_migrations) -> None:
+ """Migrate the installed doc in memory (D12). The migrated doc also becomes the base later
+ writes diff against: a reader was handed the migrated doc, so a write that leaves the
+ migration's changes in place must not send them (D12: never write the migration back)."""
from hermes_constants import reset_hermes_home_override, set_hermes_home_override
+ started = st.migrating = st.installed
token = set_hermes_home_override(st.home)
try:
run_migrations(current, {"env_added": [], "config_added": [], "warnings": []}, True)
finally:
reset_hermes_home_override(token)
- doc = copy.deepcopy(st.doc)
- doc["_config_version"] = _latest_config_version()
- self.apply_in_memory(st.home, doc)
+ with st.lock:
+ st.migrating = None
+ if st.installed != started:
+ return # a poll or write installed a newer doc mid-migration; its own pass migrates it
+ doc = copy.deepcopy(st.doc)
+ doc["_config_version"] = _latest_config_version()
+ self._apply_in_memory_locked(st, doc)
+ base = copy.deepcopy(doc)
+ base.pop("_config_version", None)
+ st.base = base
logger.info("Remote Config: migrated profile %r in memory from config version %d", st.profile, current)
# --- ConfigBackend: reads ---------------------------------------------------------------
@@ -288,8 +313,11 @@ class RemoteBackend:
def write_changes(self, home: Path, changes: Changes) -> None:
st = self._state(home)
- with st.lock:
- for attempt in (1, 2):
+ for attempt in (1, 2):
+ # Diff against the doc readers get, i.e. migrated in memory (D12) — also after the CAS
+ # re-read below. Outside st.lock: a migration reads through hermes_cli.config.
+ self._postprocess(st)
+ with st.lock:
built = self._build_patch(st, changes)
if built is None:
return
@@ -313,7 +341,7 @@ class RemoteBackend:
def _build_patch(self, st: _ProfileState, changes: Changes) -> Optional[Tuple[Dict[str, Any], List[KeyPath]]]:
"""The PATCH body for ``changes`` against the last read (§15.2), or None for no change."""
- base = copy.deepcopy(st.server_config)
+ base = copy.deepcopy(st.base if st.base is not None else st.server_config)
if changes.document is not None:
new = to_wire(copy.deepcopy(changes.document))
if not isinstance(new, dict):
@@ -383,9 +411,15 @@ class RemoteBackend:
def apply_in_memory(self, home: Path, doc: dict) -> None:
st = self._state(home)
with st.lock:
- st.doc = copy.deepcopy(doc)
- st.changed_ns = time.time_ns()
- st.gen += 1
+ if st.migrating is not None and st.migrating != st.installed:
+ return # a migration step of a doc a poll/write has since replaced: drop it
+ self._apply_in_memory_locked(st, doc)
+
+ @staticmethod
+ def _apply_in_memory_locked(st: _ProfileState, doc: dict) -> None:
+ st.doc = copy.deepcopy(doc)
+ st.changed_ns = time.time_ns()
+ st.gen += 1
# --- ConfigBackend: capabilities and boot -----------------------------------------------
diff --git a/tests/plugins/config_backends/stub_plane.py b/tests/plugins/config_backends/stub_plane.py
index 86dfca96b58..4a42500b3da 100644
--- a/tests/plugins/config_backends/stub_plane.py
+++ b/tests/plugins/config_backends/stub_plane.py
@@ -4,6 +4,10 @@ OAuth2 client-credentials token endpoint, for driving the remote backend without
Levels are collapsed to one ``upper`` document (everything above the profile) plus per-profile
``values``; locks are ``upper_locks``. Effective = deep_merge(upper, profile) — enough for the
agent, which never resolves the chain itself (design §2.3).
+
+It is a test double, not server-conformance evidence: the write check and the secret check reuse
+the agent's own helpers, so it cannot catch a rule both sides got wrong. The vendored gg fixtures
+(test_remote_conformance.py) and the real gg E2E (card INT) are that evidence.
"""
from __future__ import annotations
@@ -27,11 +31,14 @@ INSTANCE = "inst-0001"
def deep_merge(base: Dict[str, Any], over: Dict[str, Any]) -> Dict[str, Any]:
+ """contract.md §6.2: lists replace, ``null`` over a mapping is ignored, ``null`` over anything
+ else sets ``null``."""
out = copy.deepcopy(base)
for k, v in over.items():
- if isinstance(out.get(k), dict) and isinstance(v, dict):
+ over_obj = isinstance(out.get(k), dict)
+ if over_obj and isinstance(v, dict):
out[k] = deep_merge(out[k], v)
- else:
+ elif not (over_obj and v is None):
out[k] = copy.deepcopy(v)
return out
diff --git a/tests/plugins/config_backends/test_remote_backend.py b/tests/plugins/config_backends/test_remote_backend.py
index 73587ee1655..d61cb4a9a29 100644
--- a/tests/plugins/config_backends/test_remote_backend.py
+++ b/tests/plugins/config_backends/test_remote_backend.py
@@ -461,3 +461,212 @@ def test_general_plugin_manager_never_loads_config_backends(plane, monkeypatch):
mgr = PluginManager()
mgr.discover_and_load()
assert not any("config_backends" in key or key == "remote" for key in mgr._plugins)
+
+
+# --- review round 1 regressions -----------------------------------------------------------
+
+_BACKEND_FLIP_SOURCE = {"command": {"enabled": True, "override_existing": True,
+ "command": "printf 'HERMES_CONFIG_BACKEND=file\\n'"}}
+
+
+def test_secret_source_cannot_switch_remote_mode_off_at_boot(plane, monkeypatch):
+ """D32 through the REAL startup path and a real command source: a source that writes
+ HERMES_CONFIG_BACKEND=file must not disarm remote mode (and with it the protected-name check)
+ and let the next read fall back to the local config.yaml."""
+ from hermes_cli import env_loader
+ monkeypatch.setattr(env_loader, "_APPLIED_HOMES", set())
+ (plane.home / "config.yaml").write_text(json.dumps({"display": {"personality": "local"}}))
+ plane.upper = {"display": {"personality": "remote"}, "secrets": _BACKEND_FLIP_SOURCE}
+
+ with pytest.raises(ConfigBackendUnavailable, match="HERMES_CONFIG_BACKEND"):
+ env_loader.load_hermes_dotenv(hermes_home=plane.home)
+
+ import os
+ assert os.environ["HERMES_CONFIG_BACKEND"] == "remote" # the source's write was reverted
+ assert get_config_backend().name == "remote"
+
+
+def test_file_mode_ignores_a_source_that_selects_the_backend(monkeypatch, capsys):
+ """The selector is never a source's to change under the file backend either: reverted, dropped
+ from the report (so no later snapshot re-applies it), and startup continues."""
+ import os
+ from types import SimpleNamespace
+
+ from hermes_cli.config_backend import get_config_backend as gcb
+ from hermes_cli.env_loader import _refuse_protected_env_from_sources
+ monkeypatch.delenv("HERMES_CONFIG_BACKEND", raising=False)
+ before = dict(os.environ)
+ file_backend = gcb()
+ src = SimpleNamespace(applied=["HERMES_CONFIG_BACKEND", "OPENROUTER_API_KEY"], skipped_existing=[])
+ report = SimpleNamespace(provenance={"HERMES_CONFIG_BACKEND": object(), "OPENROUTER_API_KEY": object()},
+ sources=[src])
+ monkeypatch.setenv("HERMES_CONFIG_BACKEND", "remote") # what the source wrote
+
+ _refuse_protected_env_from_sources(report, file_backend, before)
+
+ assert "HERMES_CONFIG_BACKEND" not in os.environ
+ assert set(report.provenance) == {"OPENROUTER_API_KEY"} and src.applied == ["OPENROUTER_API_KEY"]
+ assert "ignored HERMES_CONFIG_BACKEND" in capsys.readouterr().err
+
+
+def _hold_gets(monkeypatch):
+ """Pause the FIRST GET after its response arrived and before the backend installs it, until
+ ``release`` is set; every later request passes straight through."""
+ import threading
+
+ from plugins.config_backends.remote import client
+ fetched, release = threading.Event(), threading.Event()
+ original = client.request
+
+ def held(method, *args, **kwargs):
+ resp = original(method, *args, **kwargs)
+ if method == "GET" and not fetched.is_set():
+ fetched.set()
+ assert release.wait(10)
+ return resp
+
+ monkeypatch.setattr(client, "request", held)
+ return fetched, release
+
+
+def test_poll_in_flight_does_not_overwrite_an_acknowledged_write(plane, monkeypatch):
+ import threading
+ plane.upper = {"display": {"personality": "old"}}
+ backend = get_config_backend()
+ st = backend._state(plane.home)
+ plane.upper["display"]["personality"] = "upper-change"
+ fetched, release = _hold_gets(monkeypatch)
+
+ poll = threading.Thread(target=backend.poll_one, args=(st,))
+ poll.start()
+ assert fetched.wait(10) # the poll's GET (profile v0) has its response, not yet installed
+ write_config_key(plane.home / "config.yaml", "display.personality", "my-write")
+ assert (st.profile_version, st.doc["display"]["personality"]) == (1, "my-write")
+ release.set()
+ poll.join(10)
+ assert not poll.is_alive()
+
+ assert (st.profile_version, st.doc["display"]["personality"]) == (1, "my-write")
+ assert plane.profile("default")["values"] == {"display": {"personality": "my-write"}}
+
+
+def test_stale_fetch_with_same_profile_version_is_dropped(plane, monkeypatch):
+ """Only an upper level changed, so both responses carry profileVersion 0: the guard must be
+ 'which fetch was installed last', not a profileVersion comparison."""
+ import threading
+ plane.upper = {"display": {"personality": "old"}}
+ backend = get_config_backend()
+ st = backend._state(plane.home)
+ plane.upper["display"]["personality"] = "v1"
+ fetched, release = _hold_gets(monkeypatch)
+
+ slow = threading.Thread(target=backend.poll_one, args=(st,))
+ slow.start()
+ assert fetched.wait(10) # holds an upper=v1 response
+ plane.upper["display"]["personality"] = "v2"
+ assert backend.poll_one(st) is True # a newer fetch, started later, lands first
+ assert st.doc["display"]["personality"] == "v2"
+ release.set()
+ slow.join(10)
+ assert not slow.is_alive()
+
+ assert st.profile_version == 0
+ assert st.doc["display"]["personality"] == "v2"
+
+
+def _old_compression_profile(plane):
+ from hermes_cli.config import read_raw_config
+ assert backend_mod._latest_config_version() > 46
+ plane.upper = {"compression": {"threshold_tokens": 256000}} # the old default the 46->47 step removes
+ plane.profile("default")["writer"] = 46
+ doc = read_raw_config()
+ assert "threshold_tokens" not in (doc.get("compression") or {}), "precondition: migrated in memory"
+
+
+def test_migration_is_not_sent_by_an_unrelated_write(plane):
+ from hermes_cli.config import set_config_value
+ _old_compression_profile(plane)
+
+ set_config_value("display.personality", "pirate")
+
+ (patch,) = plane.patches()
+ assert patch["body"]["set"] == {"display": {"personality": "pirate"}}
+ assert "unset" not in patch["body"] # D12: the migration's removal is never written back
+
+
+def test_migration_is_not_sent_after_a_cas_reread(plane):
+ from hermes_cli.config import set_config_value
+ _old_compression_profile(plane)
+ plane.profile("default")["version"] = 3 # another writer moved the profile level: first PATCH 409s
+
+ set_config_value("display.personality", "pirate")
+
+ patches = plane.patches()
+ assert [p["body"]["expectedVersion"] for p in patches] == [0, 3]
+ for p in patches:
+ assert p["body"]["set"] == {"display": {"personality": "pirate"}}
+ assert "unset" not in p["body"]
+
+
+def test_bulk_save_after_migration_sends_only_the_edit(plane):
+ from hermes_cli.config import read_raw_config, save_config
+ _old_compression_profile(plane)
+ doc = read_raw_config()
+ doc.setdefault("display", {})["personality"] = "pirate"
+
+ save_config(doc)
+
+ for p in plane.patches():
+ assert "unset" not in p["body"]
+ assert "compression" not in json.dumps(p["body"])
+
+
+def _dashboard_put(config):
+ import asyncio
+
+ from fastapi import HTTPException
+
+ from hermes_cli.web_routers.config_env import ConfigUpdate, update_config
+ try:
+ asyncio.run(update_config(ConfigUpdate(config=config)))
+ except HTTPException as exc:
+ return exc.status_code, exc.detail
+ return 200, None
+
+
+def test_dashboard_save_of_a_newly_locked_key_returns_the_lock_message(plane):
+ """The lock arrived on the plane after the last poll, so only the server refuses (403)."""
+ from hermes_cli.config import read_raw_config
+ plane.upper = {"display": {"personality": "old"}}
+ read_raw_config()
+ plane.upper_locks = [{"path": "display.personality", "level": "tenant"}]
+
+ status, detail = _dashboard_put({"display": {"personality": "new"}})
+
+ assert status == 403
+ assert "display.personality" in detail and "tenant" in detail
+ assert plane.profile("default")["values"] == {}
+
+
+def test_dashboard_save_secret_literal_is_a_400(plane):
+ status, detail = _dashboard_put({"model": {"api_key": "sk-live-not-a-ref-1234567890"}})
+ assert status == 400
+ assert "secret-shaped" in detail and "sk-live" not in detail
+ assert plane.patches() == []
+
+
+def test_dashboard_unexpected_config_failure_stays_opaque(plane):
+ from hermes_cli.config import read_raw_config
+ read_raw_config()
+ plane.fail_status = 500 # the write reaches the plane, which fails: not an expected refusal
+ status, detail = _dashboard_put({"display": {"personality": "new"}})
+ assert (status, detail) == (500, "Internal server error")
+
+
+def test_stub_plane_deep_merge_follows_contract_6_2():
+ """The test double resolves like the plane: null over a mapping is ignored (contract §6.2)."""
+ from .stub_plane import deep_merge
+ upper = {"display": {"personality": "concise"}, "model": "a", "tags": [1, 2]}
+ assert deep_merge(upper, {"display": None}) == upper
+ assert deep_merge(upper, {"model": None})["model"] is None
+ assert deep_merge(upper, {"tags": [3]})["tags"] == [3]
diff --git a/tests/plugins/config_backends/test_remote_conformance.py b/tests/plugins/config_backends/test_remote_conformance.py
index 9c21b0f0265..ed179710682 100644
--- a/tests/plugins/config_backends/test_remote_conformance.py
+++ b/tests/plugins/config_backends/test_remote_conformance.py
@@ -16,6 +16,10 @@ from plugins.config_backends.remote.values import secret_literal_path
VENDOR = Path(__file__).resolve().parents[3] / "plugins" / "config_backends" / "remote" / "vendor"
MANIFEST = VENDOR / "conformance" / "config-fixtures.sha256"
+# contract.md §13.4: a LITERAL pin (an imported constant would make the check a tautology). This
+# is the digest P1 shipped and review approved (gateway-gateway 9151149d7f); a fixture change in gg
+# is a reviewed bump here.
+APPROVED_FIXTURE_DIGEST = "e7e92b9b356c509b58b3e64f859922aff1c9cdd97924d53b756e4113de06c0af"
RESOLUTION = sorted((VENDOR / "conformance" / "config-resolution").glob("*.json"))
@@ -25,7 +29,9 @@ def _load(name: str):
def test_vendored_fixtures_match_manifest_and_source():
source = json.loads((VENDOR / "SOURCE.json").read_text(encoding="utf-8"))
- assert hashlib.sha256(MANIFEST.read_bytes()).hexdigest() == source["fixtureDigest"]
+ manifest_digest = hashlib.sha256(MANIFEST.read_bytes()).hexdigest()
+ assert manifest_digest == APPROVED_FIXTURE_DIGEST, "vendored manifest is not the approved fixture set"
+ assert source["fixtureDigest"] == APPROVED_FIXTURE_DIGEST, "SOURCE.json names a different fixture set"
listed = {}
for line in MANIFEST.read_text(encoding="utf-8").splitlines():
digest, rel = line.split(None, 1)