Skip to content

The agent that grows with you

test(config-remote): vendor portal-groups fixtureVersion 2 conformance set; multi-group response, group lock and opaque ETag v2 regressions

Ben Barclay58504aab4a66
diff --git a/plugins/config_backends/remote/vendor/SOURCE.json b/plugins/config_backends/remote/vendor/SOURCE.json
index 401d0c2ca29..701c163f746 100644
--- a/plugins/config_backends/remote/vendor/SOURCE.json
+++ b/plugins/config_backends/remote/vendor/SOURCE.json
@@ -1 +1 @@
-{ "repo": "NousResearch/gateway-gateway", "commit": "9151149d7f4c823dc113908e339dbcc9194fb3a7", "fixtureDigest": "e7e92b9b356c509b58b3e64f859922aff1c9cdd97924d53b756e4113de06c0af", "contractDigest": "314e100330af2d71be87238c1cf3aa8a40aedc0f4de58a9c4fadc808f68750ed" }
+{ "repo": "NousResearch/gateway-gateway", "commit": "36dff9281f7e1a4658d5ab0ccdc8bb7bcfffc815", "fixtureDigest": "3fdf70682367f81a455daa8e3894efb5a979064087e6394174206373053fafc4", "contractDigest": "314e100330af2d71be87238c1cf3aa8a40aedc0f4de58a9c4fadc808f68750ed" }
diff --git a/plugins/config_backends/remote/vendor/conformance/config-fixtures.sha256 b/plugins/config_backends/remote/vendor/conformance/config-fixtures.sha256
index ce88811f205..09734f9a32a 100644
--- a/plugins/config_backends/remote/vendor/conformance/config-fixtures.sha256
+++ b/plugins/config_backends/remote/vendor/conformance/config-fixtures.sha256
@@ -17,6 +17,18 @@ d9fb020409a233e84fc5269bb2d0ac2d01c26fcc57f3d89062c66587876a5e5e conformance/co
98d916571bfe7ce8a736e9ae5b54edaa8f390d6a35dad03831bb1f4b5ef3b804 conformance/config-resolution/lower-level-adds-lock-on-unlocked-path.json
3bf3119103e676a4aa94df1ee7ae101050ea4628112504a610b89efee87ba9d0 conformance/config-resolution/lower-overrides-upper-and-sets-unset-keys.json
a8875dd38ae1e48ac9fc593410463dc4eb386510a95c59e95152bcaf98704817 conformance/config-resolution/mappings-merge-key-by-key-across-levels.json
+e019c4c8cfd81a08a0ce5cca8ef7c4cf164b594208d1cd06b91a47a23263b02b conformance/config-resolution/multi-group-emptied-mapping-pruned.json
+b8052a27ea8c3060fc5bb1d5b5723081878f6a1a5abd6a469ba22639898de414 conformance/config-resolution/multi-group-higher-ancestor-lock-covers-lower-child-lock.json
+6425b262a6ce13b6256a190de3ca1b99e22e2fa25a1c6090e6388f65ca47982e conformance/config-resolution/multi-group-higher-child-lock-strips-lower-ancestor-scalar.json
+917ea8cf8fc5648448c07dd20848b064e490d5ce4d0a262067264d48f5624431 conformance/config-resolution/multi-group-highest-locking-group-value.json
+b16463754c5263b461aef9fb859d80ae7a3c933fafe2821d32a38815f596c887 conformance/config-resolution/multi-group-lock-in-lower-group-wins.json
+d257ed9a57516a458538e4dc89c2f11fca2059d979bcc217aa536731edafcd8b conformance/config-resolution/multi-group-lock-only-freezes-inherited.json
+a9e4864f5049565942ae3cde3a0ad24a94034b1aed66346411f0841129b08453 conformance/config-resolution/multi-group-lock-strips-higher-ancestor-scalar.json
+51ca5f89f99baa5b544dd56051f2b5b2c82e8e2a3b2be4209978a213d2e42073 conformance/config-resolution/multi-group-nested-locks.json
+1df99cdcd6f3224c76aca0e98fb24b8f742299f02cce1dd7658611149920403c conformance/config-resolution/multi-group-no-groups.json
+7427d62a26323c27bf562ce64e9d29c426966930389666dadf926e4433a76bf8 conformance/config-resolution/multi-group-priority-tie-break-by-id.json
+83316bb3130ba54178be7ffc2f2a049a0368d3dcee7c81366e1c5cf4e7f90040 conformance/config-resolution/multi-group-same-key-priority-wins.json
+c79bba8c4ea1beb99046c973902bb608036b07dd04d135b292b86e519a0f66e2 conformance/config-resolution/multi-group-three-groups-per-path-governor.json
d5304c09003d5ff03706f70f0de69d07e463197dd575ede2853a4492c3ba242e conformance/config-resolution/non-mapping-replaces-mapping-and-back.json
6cdf96a39e936de149a849fa5dfc53d15bfc42b62ece79fd8ee84a250e217698 conformance/config-resolution/null-over-empty-mapping-supplies-nothing.json
0e564cb6d4b26bd2e51980029eec16c943d1a5800d1c50f1dc01aa660a58f8bd conformance/config-resolution/null-over-mapping-ignored.json
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-emptied-mapping-pruned.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-emptied-mapping-pruned.json
new file mode 100644
index 00000000000..89cfeaeaada
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-emptied-mapping-pruned.json
@@ -0,0 +1,89 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-emptied-mapping-pruned",
+ "description": "Proves d5-provenance: A mapping emptied because a higher group's lock governs its only key is dropped, not left as an empty leaf; every group provenance leaf names a group.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-low",
+ "priority": 1,
+ "values": {
+ "a": {
+ "b": 1
+ }
+ },
+ "locks": [
+ "a"
+ ]
+ },
+ {
+ "kind": "group",
+ "groupId": "g-high",
+ "priority": 2,
+ "values": {
+ "z": 1
+ },
+ "locks": [
+ "a.b"
+ ]
+ },
+ {
+ "kind": "principal",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "z": 1
+ },
+ "provenance": {
+ "z": "group"
+ },
+ "groupProvenance": {
+ "z": "g-high"
+ },
+ "locks": [
+ {
+ "path": "a",
+ "level": "group",
+ "groupId": "g-low"
+ }
+ ]
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "a.c",
+ "value": "p",
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "a",
+ "lockedBy": "group",
+ "lockedByGroupId": "g-low"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-higher-ancestor-lock-covers-lower-child-lock.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-higher-ancestor-lock-covers-lower-child-lock.json
new file mode 100644
index 00000000000..fbcc51a6b6a
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-higher-ancestor-lock-covers-lower-child-lock.json
@@ -0,0 +1,93 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-higher-ancestor-lock-covers-lower-child-lock",
+ "description": "Proves d5-lock, r9: A higher group locks a with a scalar over a lower group's lock on a.b; the higher locking group governs the whole section, so a is the higher group's scalar.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {
+ "a": {
+ "b": "t"
+ }
+ },
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-high",
+ "priority": 2,
+ "values": {
+ "a": 5
+ },
+ "locks": [
+ "a"
+ ]
+ },
+ {
+ "kind": "group",
+ "groupId": "g-low",
+ "priority": 1,
+ "values": {
+ "a": {
+ "b": 1
+ }
+ },
+ "locks": [
+ "a.b"
+ ]
+ },
+ {
+ "kind": "principal",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "a": 5
+ },
+ "provenance": {
+ "a": "group"
+ },
+ "groupProvenance": {
+ "a": "g-high"
+ },
+ "locks": [
+ {
+ "path": "a",
+ "level": "group",
+ "groupId": "g-high"
+ }
+ ]
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "a.b",
+ "value": "p",
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "a",
+ "lockedBy": "group",
+ "lockedByGroupId": "g-high"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-higher-child-lock-strips-lower-ancestor-scalar.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-higher-child-lock-strips-lower-ancestor-scalar.json
new file mode 100644
index 00000000000..d8fd10ab77a
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-higher-child-lock-strips-lower-ancestor-scalar.json
@@ -0,0 +1,105 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-higher-child-lock-strips-lower-ancestor-scalar",
+ "description": "Proves d5-lock, r7, r9: A higher group locks a.b with no value while a lower group locks a with a scalar; the scalar would clobber a.b, so it is stripped and the inherited a (including a.b) stays frozen.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {
+ "a": {
+ "b": "inherited",
+ "c": "tenant"
+ }
+ },
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-low",
+ "priority": 1,
+ "values": {
+ "a": 5
+ },
+ "locks": [
+ "a"
+ ]
+ },
+ {
+ "kind": "group",
+ "groupId": "g-high",
+ "priority": 2,
+ "values": {},
+ "locks": [
+ "a.b"
+ ]
+ },
+ {
+ "kind": "principal",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "a": {
+ "b": "inherited",
+ "c": "tenant"
+ }
+ },
+ "provenance": {
+ "a.b": "tenant",
+ "a.c": "tenant"
+ },
+ "groupProvenance": {},
+ "locks": [
+ {
+ "path": "a",
+ "level": "group",
+ "groupId": "g-low"
+ }
+ ]
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "a.b",
+ "value": "p",
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "a",
+ "lockedBy": "group",
+ "lockedByGroupId": "g-low"
+ }
+ },
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "a.c",
+ "value": "p",
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "a",
+ "lockedBy": "group",
+ "lockedByGroupId": "g-low"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-highest-locking-group-value.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-highest-locking-group-value.json
new file mode 100644
index 00000000000..804f8f7900d
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-highest-locking-group-value.json
@@ -0,0 +1,96 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-highest-locking-group-value",
+ "description": "Proves d5-lock: When several groups lock a key the value is the highest-priority LOCKING group's value; a higher non-locking group does not supply it.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-a",
+ "priority": 10,
+ "values": {
+ "x": 1
+ },
+ "locks": [
+ "x"
+ ]
+ },
+ {
+ "kind": "group",
+ "groupId": "g-b",
+ "priority": 20,
+ "values": {
+ "x": 2
+ },
+ "locks": [
+ "x"
+ ]
+ },
+ {
+ "kind": "group",
+ "groupId": "g-c",
+ "priority": 30,
+ "values": {
+ "x": 3
+ },
+ "locks": []
+ },
+ {
+ "kind": "principal",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "x": 2
+ },
+ "provenance": {
+ "x": "group"
+ },
+ "groupProvenance": {
+ "x": "g-b"
+ },
+ "locks": [
+ {
+ "path": "x",
+ "level": "group",
+ "groupId": "g-b"
+ }
+ ]
+ },
+ "writes": [
+ {
+ "by": "agent",
+ "op": "set",
+ "path": "x",
+ "value": 4,
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "x",
+ "lockedBy": "group",
+ "lockedByGroupId": "g-b"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-lock-in-lower-group-wins.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-lock-in-lower-group-wins.json
new file mode 100644
index 00000000000..53076c7d3a0
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-lock-in-lower-group-wins.json
@@ -0,0 +1,104 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-lock-in-lower-group-wins",
+ "description": "Proves d5-lock: A lower-priority group that locks a key locks it for the principal and supplies the value, over a higher-priority group that sets it unlocked.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-eng",
+ "priority": 20,
+ "values": {
+ "terminal": {
+ "backend": "local"
+ }
+ },
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-sec",
+ "priority": 10,
+ "values": {
+ "terminal": {
+ "backend": "docker"
+ }
+ },
+ "locks": [
+ "terminal.backend"
+ ]
+ },
+ {
+ "kind": "principal",
+ "values": {
+ "terminal": {
+ "backend": "ssh"
+ }
+ },
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "terminal": {
+ "backend": "docker"
+ }
+ },
+ "provenance": {
+ "terminal.backend": "group"
+ },
+ "groupProvenance": {
+ "terminal.backend": "g-sec"
+ },
+ "locks": [
+ {
+ "path": "terminal.backend",
+ "level": "group",
+ "groupId": "g-sec"
+ }
+ ]
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "terminal.backend",
+ "value": "ssh",
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "terminal.backend",
+ "lockedBy": "group",
+ "lockedByGroupId": "g-sec"
+ }
+ },
+ {
+ "by": "group",
+ "op": "set",
+ "path": "terminal.backend",
+ "value": "x",
+ "expect": {
+ "result": "accept"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-lock-only-freezes-inherited.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-lock-only-freezes-inherited.json
new file mode 100644
index 00000000000..608ddd1ea0d
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-lock-only-freezes-inherited.json
@@ -0,0 +1,82 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-lock-only-freezes-inherited",
+ "description": "Proves d5-lock: The highest-priority locking group has no value at the locked path, so the inherited tenant value is frozen and a lower group's value is discarded.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {
+ "model": "t"
+ },
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-high",
+ "priority": 30,
+ "values": {},
+ "locks": [
+ "model"
+ ]
+ },
+ {
+ "kind": "group",
+ "groupId": "g-low",
+ "priority": 5,
+ "values": {
+ "model": "low"
+ },
+ "locks": []
+ },
+ {
+ "kind": "principal",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "model": "t"
+ },
+ "provenance": {
+ "model": "tenant"
+ },
+ "groupProvenance": {},
+ "locks": [
+ {
+ "path": "model",
+ "level": "group",
+ "groupId": "g-high"
+ }
+ ]
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "unset",
+ "path": "model",
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "model",
+ "lockedBy": "group",
+ "lockedByGroupId": "g-high"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-lock-strips-higher-ancestor-scalar.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-lock-strips-higher-ancestor-scalar.json
new file mode 100644
index 00000000000..a99c4e0d0f5
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-lock-strips-higher-ancestor-scalar.json
@@ -0,0 +1,89 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-lock-strips-higher-ancestor-scalar",
+ "description": "Proves d5-lock, r7: A higher group's scalar at a strict ancestor of a lower group's lock is stripped; the locked sub-path keeps the locking group's value.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-high",
+ "priority": 9,
+ "values": {
+ "a": 5
+ },
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-low",
+ "priority": 1,
+ "values": {
+ "a": {
+ "b": 1
+ }
+ },
+ "locks": [
+ "a.b"
+ ]
+ },
+ {
+ "kind": "principal",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "a": {
+ "b": 1
+ }
+ },
+ "provenance": {
+ "a.b": "group"
+ },
+ "groupProvenance": {
+ "a.b": "g-low"
+ },
+ "locks": [
+ {
+ "path": "a.b",
+ "level": "group",
+ "groupId": "g-low"
+ }
+ ]
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "a",
+ "value": 7,
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "a.b",
+ "lockedBy": "group",
+ "lockedByGroupId": "g-low"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-nested-locks.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-nested-locks.json
new file mode 100644
index 00000000000..68381ec7cc9
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-nested-locks.json
@@ -0,0 +1,102 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-nested-locks",
+ "description": "Proves d5-lock, r9: A higher group's lock inside a lower group's locked section supplies that sub-path; the rest of the section comes from the lower locking group; the covered lock is dropped from the lock list.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-low",
+ "priority": 1,
+ "values": {
+ "a": {
+ "b": "low",
+ "c": "low"
+ }
+ },
+ "locks": [
+ "a"
+ ]
+ },
+ {
+ "kind": "group",
+ "groupId": "g-high",
+ "priority": 2,
+ "values": {
+ "a": {
+ "b": "high",
+ "c": "high"
+ },
+ "z": "high"
+ },
+ "locks": [
+ "a.b"
+ ]
+ },
+ {
+ "kind": "principal",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "a": {
+ "c": "low",
+ "b": "high"
+ },
+ "z": "high"
+ },
+ "provenance": {
+ "a.c": "group",
+ "a.b": "group",
+ "z": "group"
+ },
+ "groupProvenance": {
+ "a.c": "g-low",
+ "a.b": "g-high",
+ "z": "g-high"
+ },
+ "locks": [
+ {
+ "path": "a",
+ "level": "group",
+ "groupId": "g-low"
+ }
+ ]
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "a.c",
+ "value": "p",
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "a",
+ "lockedBy": "group",
+ "lockedByGroupId": "g-low"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-no-groups.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-no-groups.json
new file mode 100644
index 00000000000..059e990f9ad
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-no-groups.json
@@ -0,0 +1,73 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-no-groups",
+ "description": "Proves d5-no-groups: A principal in no group has no group level; groupProvenance is empty and no lock names a group.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {
+ "a": "g"
+ },
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {
+ "b": "t"
+ },
+ "locks": [
+ "b"
+ ]
+ },
+ {
+ "kind": "principal",
+ "values": {
+ "c": "p"
+ },
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "a": "g",
+ "b": "t",
+ "c": "p"
+ },
+ "provenance": {
+ "a": "global",
+ "b": "tenant",
+ "c": "principal"
+ },
+ "groupProvenance": {},
+ "locks": [
+ {
+ "path": "b",
+ "level": "tenant"
+ }
+ ]
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "b",
+ "value": "p",
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "b",
+ "lockedBy": "tenant"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-priority-tie-break-by-id.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-priority-tie-break-by-id.json
new file mode 100644
index 00000000000..66b9c784b1b
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-priority-tie-break-by-id.json
@@ -0,0 +1,73 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-priority-tie-break-by-id",
+ "description": "Proves d5-tie-break: Two groups share a priority (a transient state during a NAS reorder); the group with the byte-wise smaller id is applied last and wins.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-a",
+ "priority": 5,
+ "values": {
+ "k": "a"
+ },
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-b",
+ "priority": 5,
+ "values": {
+ "k": "b"
+ },
+ "locks": []
+ },
+ {
+ "kind": "principal",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "k": "a"
+ },
+ "provenance": {
+ "k": "group"
+ },
+ "groupProvenance": {
+ "k": "g-a"
+ },
+ "locks": []
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "k",
+ "value": "p",
+ "expect": {
+ "result": "accept"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-same-key-priority-wins.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-same-key-priority-wins.json
new file mode 100644
index 00000000000..fc3c7580605
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-same-key-priority-wins.json
@@ -0,0 +1,96 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-same-key-priority-wins",
+ "description": "Proves d5-priority: Two groups set the same key; the higher priority wins per leaf, mappings still merge key by key, and file order is not application order.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {
+ "a": "g",
+ "b": "g"
+ },
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-eng",
+ "priority": 20,
+ "values": {
+ "a": "eng",
+ "c": {
+ "x": "eng"
+ }
+ },
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-ops",
+ "priority": 10,
+ "values": {
+ "a": "ops",
+ "c": {
+ "y": "ops"
+ },
+ "d": "ops"
+ },
+ "locks": []
+ },
+ {
+ "kind": "principal",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "a": "eng",
+ "b": "g",
+ "c": {
+ "y": "ops",
+ "x": "eng"
+ },
+ "d": "ops"
+ },
+ "provenance": {
+ "a": "group",
+ "b": "global",
+ "c.y": "group",
+ "c.x": "group",
+ "d": "group"
+ },
+ "groupProvenance": {
+ "a": "g-eng",
+ "c.y": "g-ops",
+ "c.x": "g-eng",
+ "d": "g-ops"
+ },
+ "locks": []
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "a",
+ "value": "p",
+ "expect": {
+ "result": "accept"
+ }
+ }
+ ]
+}
diff --git a/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-three-groups-per-path-governor.json b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-three-groups-per-path-governor.json
new file mode 100644
index 00000000000..c243c8ba0fb
--- /dev/null
+++ b/plugins/config_backends/remote/vendor/conformance/config-resolution/multi-group-three-groups-per-path-governor.json
@@ -0,0 +1,119 @@
+{
+ "fixtureVersion": 2,
+ "name": "multi-group-three-groups-per-path-governor",
+ "description": "Proves d5-lock, d5-priority: Three groups; each locked path takes the value (or inherited absence) of the highest-priority group whose lock covers it, unlocked paths take the highest-priority value.",
+ "levels": [
+ {
+ "kind": "global",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "tenant",
+ "values": {
+ "a": {
+ "b": "t"
+ }
+ },
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-1",
+ "priority": 1,
+ "values": {
+ "a": {
+ "b": 1,
+ "c": 1
+ }
+ },
+ "locks": [
+ "a"
+ ]
+ },
+ {
+ "kind": "group",
+ "groupId": "g-2",
+ "priority": 2,
+ "values": {
+ "a": {
+ "b": 2
+ },
+ "d": 2
+ },
+ "locks": []
+ },
+ {
+ "kind": "group",
+ "groupId": "g-3",
+ "priority": 3,
+ "values": {},
+ "locks": [
+ "a.b"
+ ]
+ },
+ {
+ "kind": "principal",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "agent",
+ "values": {},
+ "locks": []
+ },
+ {
+ "kind": "profile",
+ "values": {},
+ "locks": []
+ }
+ ],
+ "expect": {
+ "effective": {
+ "a": {
+ "b": "t",
+ "c": 1
+ },
+ "d": 2
+ },
+ "provenance": {
+ "a.b": "tenant",
+ "a.c": "group",
+ "d": "group"
+ },
+ "groupProvenance": {
+ "a.c": "g-1",
+ "d": "g-2"
+ },
+ "locks": [
+ {
+ "path": "a",
+ "level": "group",
+ "groupId": "g-1"
+ }
+ ]
+ },
+ "writes": [
+ {
+ "by": "principal",
+ "op": "set",
+ "path": "d",
+ "value": "p",
+ "expect": {
+ "result": "accept"
+ }
+ },
+ {
+ "by": "principal",
+ "op": "unset",
+ "path": "a.b",
+ "expect": {
+ "result": "reject",
+ "error": "config_key_locked",
+ "path": "a",
+ "lockedBy": "group",
+ "lockedByGroupId": "g-1"
+ }
+ }
+ ]
+}
diff --git a/tests/plugins/config_backends/stub_plane.py b/tests/plugins/config_backends/stub_plane.py
index 3ccbb2dc920..670a99deaf1 100644
--- a/tests/plugins/config_backends/stub_plane.py
+++ b/tests/plugins/config_backends/stub_plane.py
@@ -58,6 +58,10 @@ class StubPlane:
def __init__(self) -> None:
self.upper: Dict[str, Any] = {}
self.upper_locks: List[Dict[str, str]] = []
+ # portal-groups contract §6.7: a member's group levels ({"groupId", "priority", "version"}) and
+ # groupProvenance, emitted as-is so tests prove the agent ignores fields it does not use.
+ self.groups: List[Dict[str, Any]] = []
+ self.group_provenance: Optional[Dict[str, Any]] = None
self.profiles: Dict[str, Dict[str, Any]] = {}
self.fail_status: Optional[int] = None # every /self request returns this
self.requests: List[Dict[str, Any]] = []
@@ -89,9 +93,12 @@ class StubPlane:
"locks": copy.deepcopy(self.upper_locks),
"provenance": {},
"levels": [{"kind": "tenant", "version": 1, "writerConfigVersion": None},
+ *({"kind": "group", "writerConfigVersion": None, **g} for g in self.groups),
{"kind": "profile", "version": prof["version"], "writerConfigVersion": prof["writer"]}],
"profileVersion": prof["version"], "recordVersion": 1,
}
+ if self.group_provenance is not None:
+ body["groupProvenance"] = copy.deepcopy(self.group_provenance)
digest = hashlib.sha256(json.dumps(body, sort_keys=True).encode()).hexdigest()
body["etag"] = f'"{digest}"'
return body
@@ -169,8 +176,13 @@ class StubPlane:
refused = write_check(sets, unsets, locks)
if refused is not None:
path = encode(refused[0])
- return self._send(403, {"error": "config_key_locked", "path": path, "lockedBy": refused[1],
- "message": f"{path} is locked by {refused[1]}"})
+ body = {"error": "config_key_locked", "path": path, "lockedBy": refused[1],
+ "message": f"{path} is locked by {refused[1]}"}
+ group_id = next((lk.get("groupId") for lk in plane.upper_locks
+ if lk["path"] == path and lk["level"] == refused[1]), None)
+ if group_id: # portal-groups contract §6.6
+ body["lockedByGroupId"] = group_id
+ return self._send(403, body)
for p, v in sets.items():
if _depth(v) > MAX_VALUE_DEPTH: # contract §11.1
path = encode(p)
diff --git a/tests/plugins/config_backends/test_remote_backend.py b/tests/plugins/config_backends/test_remote_backend.py
index 97d7a4d5f8d..422bf3d2790 100644
--- a/tests/plugins/config_backends/test_remote_backend.py
+++ b/tests/plugins/config_backends/test_remote_backend.py
@@ -850,6 +850,71 @@ def test_plane_refusals_map_to_http(status, error, expected):
assert exc.code == error
+# --- portal-groups (multi-group plane, contract fixtureVersion 2 / ETag v2) ------------------
+
+def _multi_group_plane(plane):
+ plane.upper = {"terminal": {"backend": "docker"}, "model": {"default": "hermes-4"}}
+ plane.upper_locks = [{"path": "terminal.backend", "level": "group", "groupId": "g-sec"}]
+ plane.groups = [{"groupId": "g-sec", "priority": 10, "version": 3},
+ {"groupId": "g-eng", "priority": 5, "version": 1}]
+ plane.group_provenance = {"terminal": {"backend": "g-sec"}}
+
+
+def test_multi_group_response_fields_are_ignored_and_group_lock_refuses_client_side(plane):
+ """portal-groups §7.5: several group levels, locks[].groupId and groupProvenance are ignorable;
+ a group lock is just an upper lock (lockedBy "group"), refused before anything is sent."""
+ from hermes_cli.config import read_raw_config
+ _multi_group_plane(plane)
+
+ doc = read_raw_config()
+
+ assert doc["terminal"]["backend"] == "docker" and doc["model"]["default"] == "hermes-4"
+ assert get_config_backend().locked(plane.home, "terminal.backend") == "group"
+ with pytest.raises(ConfigLockedError) as exc:
+ write_config_key(plane.home / "config.yaml", "terminal.backend", "local")
+ assert (exc.value.path, exc.value.locked_by) == ("terminal.backend", "group")
+ assert plane.patches() == []
+ write_config_key(plane.home / "config.yaml", "model.default", "hermes-5") # unlocked: written
+ (p,) = plane.patches()
+ assert p["body"]["set"] == {"model.default": "hermes-5"}
+
+
+def test_plane_group_lock_refusal_maps_to_locked_error_and_403():
+ """A server-side config_key_locked from a group lock carries lockedByGroupId (portal-groups
+ §6.6); the agent still maps it to ConfigLockedError(path, "group") and the dashboard's 403."""
+ from hermes_cli.web_routers._common import config_refusal_http
+ from plugins.config_backends.remote import client
+ exc = backend_mod.RemoteBackend._write_error(client.Response(
+ status=403, body={"error": "config_key_locked", "path": "terminal.backend", "lockedBy": "group",
+ "lockedByGroupId": "g-sec", "message": "terminal.backend is locked by group g-sec"},
+ etag=None, retry_after=None))
+ assert isinstance(exc, ConfigLockedError)
+ assert (exc.path, exc.locked_by) == ("terminal.backend", "group")
+ http = config_refusal_http(exc)
+ assert http is not None and http.status_code == 403 and "locked by group" in http.detail
+
+
+def test_etag_is_opaque_and_echoed_verbatim(plane, monkeypatch):
+ """The plane's ETag (hermes-config-etag/2 since portal-groups §6.8) is never parsed: whatever
+ bytes it sends come back unchanged in If-None-Match."""
+ from hermes_cli.config import read_raw_config
+ _multi_group_plane(plane)
+ real_effective = plane.effective
+ opaque = 'W/"v2:any-bytes/at all"'
+
+ def effective(name):
+ body = real_effective(name)
+ body["etag"] = opaque
+ return body
+
+ monkeypatch.setattr(plane, "effective", effective)
+ read_raw_config()
+ backend = get_config_backend()
+ st = backend._state(plane.home)
+ assert backend.poll_one(st) is False and not st.last_error # 304: nothing changed
+ assert _gets(plane)[-1]["if_none_match"] == opaque
+
+
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
diff --git a/tests/plugins/config_backends/test_remote_conformance.py b/tests/plugins/config_backends/test_remote_conformance.py
index ed179710682..55822713224 100644
--- a/tests/plugins/config_backends/test_remote_conformance.py
+++ b/tests/plugins/config_backends/test_remote_conformance.py
@@ -17,10 +17,15 @@ 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"
+# is the manifest at gateway-gateway 36dff9281f: P1's v1 set (e7e92b9b…, gg 9151149d7f) plus the
+# twelve portal-groups fixtureVersion 2 multi-group cases (portal-groups contract §7.2, gg #328).
+# A fixture change in gg is a reviewed bump here.
+APPROVED_FIXTURE_DIGEST = "3fdf70682367f81a455daa8e3894efb5a979064087e6394174206373053fafc4"
RESOLUTION = sorted((VENDOR / "conformance" / "config-resolution").glob("*.json"))
+# Fixture formats this runner was reviewed against. v2 (portal-groups §7.1) adds several group
+# levels, groupProvenance, locks[].groupId and lockedByGroupId; the agent reads none of them (it
+# runs profile writes against expect.locks[path, level] and defaultsMerge, contract §13.2).
+KNOWN_FIXTURE_VERSIONS = {1, 2}
def _load(name: str):
@@ -43,6 +48,12 @@ def test_vendored_fixtures_match_manifest_and_source():
assert len(RESOLUTION) > 0
[email protected]("fixture", RESOLUTION, ids=lambda f: f.stem)
+def test_fixture_version_is_one_this_runner_reads(fixture):
+ """A new format must be reviewed here, not silently half-read."""
+ assert json.loads(fixture.read_text(encoding="utf-8"))["fixtureVersion"] in KNOWN_FIXTURE_VERSIONS
+
+
@pytest.mark.parametrize("vector", _load("config-paths.json")["valid"], ids=lambda v: v["encoded"])
def test_valid_paths_round_trip(vector):
assert P.encode(vector["segments"]) == vector["encoded"]