Retain the registry protocol when updating signed app releases
This commit is contained in:
1 parent
88ee19b5f3
commit
eafa106a86
3 files changed
+17
-11
No files matched your search
+2
-1
@@ -219,7 +219,8 @@ key must match `registry-public-key.hex`. The package publisher cannot approve
|
||||
itself: registration requires the separate node operator key. Existing account
|
||||
collections, capabilities, token policies and other publisher keys are retained;
|
||||
suspended, revoked and node-restricted registrations are not replaced. Repeating
|
||||
the preparation keeps unchanged manifest versions and advances changed ones.
|
||||
the preparation retains the registry protocol version and existing scopes while
|
||||
updating the app's client version.
|
||||
|
||||
The wrapper release workflow requires public pins covering all six app IDs,
|
||||
so each included cell has a configured publisher for its updates.
|
||||
|
||||
@@ -85,14 +85,12 @@ def manifest_for(component, existing, key_id, public):
|
||||
if key in item and (item[key] or key in REQUIRED[field])}
|
||||
for item in values[field]]
|
||||
previous_version = existing.get("manifest_version", 0)
|
||||
if not isinstance(previous_version, int) or previous_version < 0:
|
||||
raise ValueError("invalid previous manifest version")
|
||||
values["manifest_version"] = max(1, previous_version)
|
||||
manifest = {key: values[key] for key in FIELDS if key in values}
|
||||
previous = {key: existing[key] for key in FIELDS if existing.get(key)}
|
||||
if previous_version and canonical_bytes(previous) != canonical_bytes(manifest):
|
||||
manifest["manifest_version"] = previous_version + 1
|
||||
return manifest
|
||||
if type(previous_version) is not int or previous_version not in (0, 1):
|
||||
raise ValueError("unsupported previous manifest version")
|
||||
# This is the registry protocol version, not an app release counter.
|
||||
# Client versions and signed package sequences advance independently.
|
||||
values["manifest_version"] = 1
|
||||
return {key: values[key] for key in FIELDS if key in values}
|
||||
|
||||
|
||||
def signed_registration(manifest, publisher, authority):
|
||||
|
||||
@@ -60,11 +60,18 @@ class RegistrationTest(unittest.TestCase):
|
||||
with self.subTest(field=field), self.assertRaises(ValueError):
|
||||
self.manifest(dict(self.existing, **{field: value}))
|
||||
|
||||
def test_idempotent_manifests_and_increasing_version(self):
|
||||
def test_app_updates_retain_the_registry_protocol_version(self):
|
||||
existing = self.manifest()
|
||||
self.assertEqual(self.manifest(existing), existing)
|
||||
self.component["version"] = "2.1.3"
|
||||
self.assertEqual(self.manifest(existing)["manifest_version"], 2)
|
||||
updated = self.manifest(existing)
|
||||
self.assertEqual(updated["manifest_version"], 1)
|
||||
self.assertEqual(updated["current_client_version"], "2.1.3")
|
||||
self.assertEqual(updated["collections"], existing["collections"])
|
||||
self.assertEqual(updated["keys"], existing["keys"])
|
||||
for version in (2, -1, True):
|
||||
with self.subTest(version=version), self.assertRaises(ValueError):
|
||||
self.manifest(dict(existing, manifest_version=version))
|
||||
|
||||
def test_optional_apps_do_not_claim_root_account_collections(self):
|
||||
self.component = dict(name="lists", id="inbe.lists", version="1.0.1")
|
||||
|
||||
Reference in new issue
Block a user