Run only Habits and Practices packages that draw their own screens

This host no longer draws Habits' and Practices' screens, so a package of
theirs built for an older host interface would leave them blank. Each app
in apps/versions.json may now name the oldest host interface its packages
must be built for; Habits and Practices name 30. An older installed or
rolled-back package gives way to the bundled copy, and the compatibility
test skips the node's older releases of those two as this build does.
This commit is contained in:
waozi committed 2026-10-25 00:25:23 -03:00
1 parent 86de4a7087
commit b868c162c9
8 files changed
+43 -6

No files matched your search

+2
View File
@@ -18,6 +18,7 @@
"sequence": 24,
"bundled": true,
"host_api": 30,
"oldest_host_api": 30,
"release": "2.1.46"
},
"practices": {
@@ -26,6 +27,7 @@
"sequence": 23,
"bundled": true,
"host_api": 30,
"oldest_host_api": 30,
"release": "2.1.46"
},
"lists": {
+5
View File
@@ -43,6 +43,11 @@ def validate(root):
host = component.get("host_api", ledger["host_api"])
if type(host) is not int or not ledger["oldest_host_api"] <= host <= ledger["host_api"]:
raise ValueError(f"{name}: host_api must be between oldest_host_api and host_api")
# This host runs no package of the app built for an older interface:
# its screens moved into the package, so the bundled copy runs instead.
oldest = component.get("oldest_host_api", ledger["oldest_host_api"])
if type(oldest) is not int or not ledger["oldest_host_api"] <= oldest <= host:
raise ValueError(f"{name}: oldest_host_api must be between the ledger's and its host_api")
changelog = root / "apps" / source / "CHANGELOG.md"
headings = re.findall(r"^## \[([^\]]+)\] - ([^\n]+)$", changelog.read_text(), re.M)
if not headings or not re.fullmatch(VERSION, headings[0][0]):
+8 -1
View File
@@ -36,7 +36,14 @@ lines = ["// Generated from apps/versions.json; module releases are independent.
"PackageBundledSequence :: (index: s32) -> s32 {",
f" if index < 0 || index >= {len(names)} {{", " return 0", " }",
f" sequences: [{len(names)}]s32 = .[" + ", ".join(str(apps[n]["sequence"] if apps[n]["bundled"] else 0) for n in names) + "]",
" return sequences[index]", "}", ""]
" return sequences[index]", "}", "",
"// The oldest host interface a package of each app may be built for. An",
"// app whose screens moved into its package needs a package that draws",
"// them; an older one gives way to the bundled copy.",
"PackageHostAPIOldestFor :: (index: s32) -> s32 {",
f" if index < 0 || index >= {len(names)} {{", f" return {ledger['oldest_host_api']}", " }",
f" oldest: [{len(names)}]s32 = .[" + ", ".join(str(apps[n].get("oldest_host_api", ledger["oldest_host_api"])) for n in names) + "]",
" return oldest[index]", "}", ""]
path = root / "src/apps/versions.zi"
content = "\n".join(lines)
if not path.exists() or path.read_text() != content:
+2 -1
View File
@@ -10,6 +10,7 @@
#import, file "module_types.zi";
#import, file "catalog.zi";
#import, file "host_api.zi";
#import, file "versions.zi";
#import, file "inbe_types.zi";
#import, file "package_files.zi";
#import, file "../app/text_buffers.zi";
@@ -67,7 +68,7 @@ PackageParseReleaseFor :: (json: string, app_id: string, index: s32, public_hex:
signed := DaochiParseRelease(json, public_hex, PackageMaximumBytes, PackageVerifySignature)
if !signed.valid || app_id.count == 0 || TextFromCString(*signed.app_id[0]) != app_id ||
TextFromCString(*signed.runtime[0]) != "kryon-app-v1" ||
signed.host_api < PackageHostAPIOldest || signed.host_api > PackageHostAPI ||
signed.host_api < PackageHostAPIOldestFor(index) || signed.host_api > PackageHostAPI ||
signed.module_api != PackageModuleAPI || signed.data_schema != 0 {
return release
}
+11
View File
@@ -14,3 +14,14 @@ PackageBundledSequence :: (index: s32) -> s32 {
sequences: [7]s32 = .[43, 22, 24, 23, 27, 31, 16]
return sequences[index]
}
// The oldest host interface a package of each app may be built for. An
// app whose screens moved into its package needs a package that draws
// them; an older one gives way to the bundled copy.
PackageHostAPIOldestFor :: (index: s32) -> s32 {
if index < 0 || index >= 7 {
return 12
}
oldest: [7]s32 = .[12, 12, 30, 30, 12, 12, 12]
return oldest[index]
}
+3 -2
View File
@@ -129,9 +129,10 @@ def forward(binary, origin, ledger, output):
print(f"forward {app_id}: the node has no release this build can run")
continue
raise
if not oldest <= metadata["host_api"] <= current or metadata["module_api"] != ledger["module_api"]:
floor = ledger["apps"][name].get("oldest_host_api", oldest)
if not floor <= metadata["host_api"] <= current or metadata["module_api"] != ledger["module_api"]:
print(f"forward {app_id}: skipped {metadata['version']}, built for host "
f"{metadata['host_api']} outside {oldest}..{current}")
f"{metadata['host_api']} outside {floor}..{current}")
continue
artifact = metadata["artifacts"][0]
data = fetch(f"{route}/{artifact['sha256']}.zx", artifact["size"])
+4
View File
@@ -25,6 +25,10 @@ CheckPackageReleases :: () -> s32 {
if !PackageParseRelease(PackageFixture("current-api"), 2, public).valid {
return 25
}
// Lists still runs packages built for the ledger's oldest interface.
if !PackageParseRelease(PackageFixture("lists-oldest-api"), 1, public).valid {
return 26
}
habits := PackageParseRelease(PackageFixture("habits"), 2, public)
if !PackageVerifyBytes(PackageFixture("habits-bytes"), habits) {
return 20
+8 -2
View File
@@ -236,8 +236,14 @@ def main():
# The host runs releases built for any interface it still supports.
ledger = json.loads((ROOT / "apps/versions.json").read_text())
altered("wrong-api", lambda value: value.update(host_api=ledger["host_api"] + 1))
altered("old-api", lambda value: value.update(host_api=ledger["oldest_host_api"] - 1))
altered("oldest-api", lambda value: value.update(host_api=ledger["oldest_host_api"]))
# Habits runs no package built before its screens moved into it.
habits_oldest = ledger["apps"]["habits"].get("oldest_host_api", ledger["oldest_host_api"])
altered("old-api", lambda value: value.update(host_api=habits_oldest - 1))
altered("oldest-api", lambda value: value.update(host_api=habits_oldest))
lists_oldest = json.loads(json.dumps(values["lists"]))
lists_oldest["host_api"] = ledger["apps"]["lists"].get("oldest_host_api", ledger["oldest_host_api"])
lists_oldest["signature"] = key.sign(release_tool.signing_message(lists_oldest)).hex()
(fixtures / "lists-oldest-api").write_text(json.dumps(lists_oldest))
altered("current-api", lambda value: value.update(host_api=ledger["host_api"]))
altered("wrong-module", lambda value: value.update(module_api=ledger["module_api"] + 1))
altered("bad-signature", lambda value: value.update(version="9.0.0"), False)