From 36447d79fec6b537fb26ac210751c3074064b6c8 Mon Sep 17 00:00:00 2001 From: Thor Whalen <1906276+thorwhalen@users.noreply.github.com> Date: Tue, 22 Sep 2026 14:20:30 +0000 Subject: [PATCH] test: pin is_valid_key/validate_key agreement with iteration (#5) Regression test recommended in #5 (now closed -- the bug itself was already fixed upstream by i2mint/dol#85). Guards against a future dol regression reintroducing the key-delegation mismatch. Co-Authored-By: Claude Sonnet 5 --- focal/tests/test_extension_store.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/focal/tests/test_extension_store.py b/focal/tests/test_extension_store.py index bc59a2f..d66008d 100644 --- a/focal/tests/test_extension_store.py +++ b/focal/tests/test_extension_store.py @@ -54,3 +54,20 @@ def test_store( f" \n{retrieved=}" f"\n{object_to_test=}" ) + + +def test_is_valid_key_agrees_with_iteration(): + """Regression test for i2mint/focal#5 (dol#83 key-delegation bug class). + + ``is_valid_key``/``validate_key`` must agree with what the store actually + iterates and holds -- pins the i2mint/dol#85 fix (``mk_relative_path_store`` + installing key-mapping ``is_valid_key``/``validate_key``) against a future + regression. + """ + import tempfile + + d = MultiFileStore(tempfile.mkdtemp()) + d["x.json"] = {"a": 1} + for k in d: + assert d.is_valid_key(k), f"{k} is in the store but is_valid_key says no" + d.validate_key(k) # must not raise