Fix Device Core release health contract and prove r5 restoration

This commit is contained in:
Codex
2026-09-29 19:26:33 +03:00
parent d161d7fb91
commit ed500278a0
5 changed files with 437 additions and 10 deletions
+25
View File
@@ -65,3 +65,28 @@ python3 -m unittest discover -s infra/gitea-ci -p 'test_*.py'
The Device Core repository's full `infra/deploy-runner` suite must also pass against
the changed canonical runner. Its historical skipped tests remain reported as
skipped, not as live acceptance.
## Initial r5 health-contract incident
The first normal release (run 5, source `67b2ae586399eb1eb7d3a6c074a292e0dbb7b406`)
failed acceptance and rollback acceptance because the new domain selected the old
generic disabled-foundation health expectations. The current preserved foundation
reports discovery and management enabled and `typed-service-ping-v1`. The release
now uses an explicit contract before build, after activation and during rollback.
Legacy transition contracts remain unchanged. Device Core's
`test_device_release_health_contract.py` runs the actual Core and Manager HTTP
handlers against the pinned installer; it fails on the original installer and
passes on this correction, including negative dependency/auth/capability cases.
`build_reconciliation.py` packages one fixed data descriptor for
`device-core-release-reconciliation`. Its plan and apply prove the exact failed
journal/archive, six backup digests, restored sources, old image IDs, runtime
configuration, Compose and preserved services. No build, restart, secret repair,
port or database action exists in this domain. Apply writes only a marker and a
separate canonical receipt; failure removes only that marker. It never rewrites
the original failed journal. Later releases require marker + applied archive +
receipt + original incident evidence. Other rollback failures remain blocked.
The r5 archive must never be replayed. Reconciliation does not install a release
or activate automatic deployment. Only after its live acceptance may a NEW
successful CI run become the next normal-release candidate.
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
"""Build the exact evidence-only r5 reconciliation, never application code."""
import argparse
import gzip
import hashlib
import io
import json
from pathlib import Path
import tarfile
ROOT = Path(__file__).resolve().parent
ENTRY = 'deployment/device-core-release-r5-reconciliation-v1.json'
def bundle():
descriptor = (ROOT / 'r5-reconciliation-v1.json').read_bytes()
identity = json.loads(descriptor)['releaseId']
members = {
'manifest.env': ('id='+identity+'\ncomponent=device-core-release-reconciliation\ntype=app-overlay\n').encode(),
'files.txt': (ENTRY+'\n').encode(),
'payload/'+ENTRY: descriptor,
}
output=io.BytesIO()
with gzip.GzipFile(fileobj=output, mode='wb', mtime=0, filename='') as compressed:
with tarfile.open(fileobj=compressed, mode='w') as archive:
for name,data in sorted(members.items()):
info=tarfile.TarInfo(name);info.mode=0o644;info.size=len(data)
archive.addfile(info,io.BytesIO(data))
return identity,output.getvalue()
if __name__=='__main__':
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--output-dir',required=True,type=Path)
args=parser.parse_args();args.output_dir.mkdir(parents=True,exist_ok=True)
identity,data=bundle();path=args.output_dir/('nodedc-'+identity+'.tgz')
with path.open('xb') as stream:stream.write(data)
print(json.dumps({'artifact':str(path),'sha256':hashlib.sha256(data).hexdigest(),'id':identity}))
@@ -0,0 +1,8 @@
{
"schemaVersion": "nodedc.device-core.release-reconciliation.v1",
"releaseId": "device-core-release-r5-reconciliation-v1-20260929-001",
"failedReleaseId": "device-core-release-v1-r5-67b2ae586399eb1eb7d3a6c074a292e0dbb7b406",
"failedSha256": "b8dd1384f499d1173ce7d95dc1f2433a404290f443bd612816ad9136ccbf9347",
"backupId": "device-core-release-device-core-release-v1-r5-67b2ae586399eb1eb7d3a6c074a292e0dbb7b406-20260929-190019",
"mode": "prove-restored-baseline-only"
}