mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-28 13:57:43 +00:00
Merge branch 'feature/updater' into feature/store-i18n
68 conflicts, resolved per hunk; resolutions agreed with the Updater session were applied as agreed: - svc-db-postgres (superuser password script and core) and sys-svc-rdbms realign_dedicated_db: updater's argv/stdin redesign with expand_argument_vars: false, nested into store-i18n's block structure. - svc-db-redis 01_init: store-i18n's ACL password on stdin. - sys-svc-proxy forwarded.conf.j2: store-i18n's handover-aware file, without the forwarded_base include (Host and X-Forwarded-Proto would be sent twice); forwarded_base serves the inline consumers, e.g. web-app-seaweedfs nginx.conf.j2. - basic.conf.j2 and web-app-openproject proxy.conf.j2: issuer redirect, then handover, else updater's location/sso_acl.conf.j2; the server-level webserver_extra_configuration hook stays. - web-app-keycloak: updater's admin-REST settings step and renumbered update steps; update/01_client.yml removed; store-i18n's design step and LDAP block kept;a73435cc9darrived through rename detection. - web-app-nextcloud OpenProject provisioning: updater's rewrite, all credentials on the Ruby runner's stdin. - web-app-semaphore: store-i18n's canonical web root (a1d7835863). - Role READMEs: no generated Cosmos/Architecture/Quick Setup/Credits sections; desk-* paths resolved to the dsk-* renames. Integration fixes for what merged cleanly but did not fit together: - web-app-matrix ansible vars: drop updater's second matrix_client_element_configuration_extension_json, which silently overrode store-i18n's design-aware value. - url.origin instead of a stripped url.base in 19 places store-i18n added since44aaa68924, same lookup targets (the double-slash lint). - Package batch (18ea75049e,cb4d340de9): installs the deploy-start batch covers are removed (caffeine, cursor, blender, npm in dsk-gnt-*, with shared references), the rest carry batch: false and a nocheck with the verified reason (PyPI fallback, before the batch, vendor repository, configured flavor only, addon gate); dev-npm references the root npm id. - sys-token-store write_many.yml: store-i18n's change-gated block and IS_SWARM_MODE. - web-app-openproject: IS_COMPOSE_MODE in 02_migrate/run.yml; the seeded-admin lock (ccbf8f168d) ported into 04_admin/provision.yml and covered by the admin-state digest. - Bucket policy (3b4ac40df5and follow-ups) moved to web-svc-seaweedfs, where store-i18n's object store lives; the S3 admin secret travels on stdin instead of a task-level environment. - act workflow.sh: no Exception-labelled comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
c9e7f950d9
533 files changed
+14274
-1833
No files matched your search
@@ -20,6 +20,7 @@ from pathlib import Path
|
||||
from utils.cache import _reset_cache_for_tests
|
||||
from utils.cache import base as cache_base
|
||||
from utils.cache import users as cache_users
|
||||
from utils.cache.users import store as cache_users_store
|
||||
from utils.cache.yaml import dump_yaml_str
|
||||
from utils.domains.default_primary import default_domain_primary
|
||||
from utils.roles.mapping import ROLE_FILE_META_SERVICES, ROLE_FILE_META_USERS
|
||||
@@ -425,5 +426,89 @@ class TestGetMergedUsersTokenSource(unittest.TestCase):
|
||||
self.assertEqual(after["foo"]["tokens"]["web-app-foo"], "minted")
|
||||
|
||||
|
||||
class TestStoreSignature(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
_reset_cache_for_tests()
|
||||
|
||||
@staticmethod
|
||||
def _signature(store: dict) -> tuple:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
return cache_users._store_signature(
|
||||
{cache_users_store.STORE_FACT: store}, Path(tmp) / "tokens.yml"
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _hydrated(store: dict) -> str:
|
||||
users = {"foo": {"tokens": {"web-app-foo": ""}}}
|
||||
return repr(cache_users._hydrate_users_tokens(users, store))
|
||||
|
||||
def test_the_tokens_file_signs_like_the_store_fact_with_the_same_tokens(self):
|
||||
store = {"foo": {"tokens": {"web-app-foo": "minted"}}}
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
tokens_file = Path(tmp) / "tokens.yml"
|
||||
tokens_file.write_text(dump_yaml_str({"users": store}), encoding="utf-8")
|
||||
self.assertEqual(
|
||||
cache_users._store_signature({}, tokens_file),
|
||||
cache_users._store_signature(
|
||||
{cache_users_store.STORE_FACT: store}, tokens_file
|
||||
),
|
||||
)
|
||||
|
||||
def test_a_missing_tokens_file_signs_like_an_empty_store_fact(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
absent = Path(tmp) / "tokens.yml"
|
||||
self.assertEqual(
|
||||
cache_users._store_signature({}, absent),
|
||||
cache_users._store_signature(
|
||||
{cache_users_store.STORE_FACT: {}}, absent
|
||||
),
|
||||
)
|
||||
|
||||
def test_fields_and_padding_the_hydration_ignores_keep_the_signature(self):
|
||||
plain = {"foo": {"tokens": {"web-app-foo": "minted"}}}
|
||||
for variant in (
|
||||
{"foo": {"tokens": {"web-app-foo": " minted "}}},
|
||||
{"foo": {"tokens": {"web-app-foo": "minted"}, "note": "unread"}},
|
||||
{"foo": {"tokens": {"web-app-foo": "minted", "web-app-bar": None}}},
|
||||
{"foo": {"tokens": {"web-app-foo": "minted"}}, "bar": "not-a-mapping"},
|
||||
):
|
||||
with self.subTest(variant=variant):
|
||||
self.assertEqual(self._hydrated(variant), self._hydrated(plain))
|
||||
self.assertEqual(self._signature(variant), self._signature(plain))
|
||||
|
||||
def test_the_store_order_enters_the_signature_because_the_hydration_keeps_it(
|
||||
self,
|
||||
):
|
||||
first = {"bar": {"tokens": {"x": "1"}}, "baz": {"tokens": {"y": "2"}}}
|
||||
swapped = {"baz": {"tokens": {"y": "2"}}, "bar": {"tokens": {"x": "1"}}}
|
||||
self.assertNotEqual(self._hydrated(first), self._hydrated(swapped))
|
||||
self.assertNotEqual(self._signature(first), self._signature(swapped))
|
||||
|
||||
def test_an_equal_signature_means_an_equal_hydration(self):
|
||||
stores = [
|
||||
{"foo": {"tokens": {"web-app-foo": "minted"}}},
|
||||
{"foo": {"tokens": {"web-app-foo": " minted "}}},
|
||||
{"foo": {"tokens": {"web-app-foo": "rotated"}}},
|
||||
{"foo": {"tokens": {"web-app-foo": None}}},
|
||||
{"foo": {"tokens": {"web-app-foo": ""}}},
|
||||
{"foo": {"tokens": {}}},
|
||||
{"foo": {"tokens": "not-a-mapping"}},
|
||||
{"foo": {}},
|
||||
{"foo": "not-a-mapping"},
|
||||
{},
|
||||
{"bar": {"tokens": {"x": "1"}}},
|
||||
{"bar": {"tokens": {"x": 1}}},
|
||||
{"bar": {"tokens": {}}},
|
||||
{1: {"tokens": {"x": "1"}}},
|
||||
{"1": {"tokens": {"x": "1"}}},
|
||||
]
|
||||
for first in stores:
|
||||
for second in stores:
|
||||
if self._signature(first) != self._signature(second):
|
||||
continue
|
||||
with self.subTest(first=first, second=second):
|
||||
self.assertEqual(self._hydrated(first), self._hydrated(second))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user