fix: reconcile configured APT effect without retroactive acceptance and retain host reboot evidence
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -20,6 +20,13 @@ CASES=('apt_configure_recovery','apt_native_update','ensure_package','apply_upda
|
||||
|
||||
|
||||
def runtime_session():
|
||||
configured=BASE/'configured-reconcile-runtime.json'
|
||||
if configured.exists():
|
||||
report=cloud.contract.protected_json(configured)
|
||||
require(report['completed'] and report['preserved_state'] and report['readiness_only'] and
|
||||
not report['native_acceptance'] and report['unknown_grant']=='33775478-15b0-46ec-b059-44f500dbb0b6',
|
||||
'qualified preserving configured-reconciliation runtime')
|
||||
return report,BASE/'configured-reconcile-runtime'
|
||||
latest=BASE/'journal-capacity-runtime.json'
|
||||
if latest.exists():
|
||||
report=cloud.contract.protected_json(latest)
|
||||
@@ -76,7 +83,15 @@ def enable():
|
||||
apt_config_sha256=ready['apt_config_sha256'],provider_sha256=ready['provider_sha256'],
|
||||
hook_sha256=hashlib.sha256((cloud.ROOT/'tools/apt-transaction/hook').read_bytes()).hexdigest()))
|
||||
policy=dict(schema_version=1,profile='development',expires_at=(m.now()+dt.timedelta(hours=1)).isoformat(),scopes=[scope])
|
||||
old=m.protected_json(BASE/'recovery-policy-closed.json' if session!=BASE else cloud.ROOT/'devstate/cloud-logs/policy-closed.json')
|
||||
if session==BASE/'configured-reconcile-runtime':
|
||||
old=m.protected_json(BASE/'capacity-recovery/recovery-policy-closed-unknown.json')
|
||||
prior_checkpoint=m.protected_json(BASE/'capacity-recovery/cases/apt_configure_recovery/checkpoint.json')
|
||||
closed=cloud.Backend().call('jobs.get',dict(tenant_id=cloud.TENANT,job_id=prior_checkpoint['plan']['jobs'][0]['job_id']))
|
||||
require(closed['state']=='failed' and closed['result']['error_code']=='APT_RECOVERY_CONFIGURED_ACCEPTANCE_REBOOT_FLAG_VERIFIED' and
|
||||
closed['result']['grant_id']=='33775478-15b0-46ec-b059-44f500dbb0b6',
|
||||
'ordinary signed Sync must first close the exact historical configured effect as failed')
|
||||
else:
|
||||
old=m.protected_json(BASE/'recovery-policy-closed.json' if session!=BASE else cloud.ROOT/'devstate/cloud-logs/policy-closed.json')
|
||||
record=cloud.bootstrap.rpc('server.conf',prior.replace_policy,dict(id=str(uuid.uuid4()),previous_sha256=old['policy_sha256'],policy=policy))
|
||||
m.write_private(session/'recovery-policy.json',dict(record,policy=policy))
|
||||
print('Fixed APT runtime endpoint and expiring limits enabled; no job or approval created')
|
||||
@@ -97,6 +112,8 @@ def accept(case,resume_unsubmitted=False):
|
||||
m=cloud.contract;target=prior.prior.identity()
|
||||
require(prior.prior.evidence('gate')['unresolved']==0,'no unresolved attempt')
|
||||
ready,session=runtime_session();cases=session/'cases';cases.mkdir(mode=0o700,exist_ok=True)
|
||||
require(session!=BASE/'configured-reconcile-runtime' or case!='apt_configure_recovery',
|
||||
'configured historical1.0 is never executed again; next action is separate native1.1 upgrade')
|
||||
if session!=BASE and case=='apt_configure_recovery':
|
||||
original=m.protected_json(STATE/case/'checkpoint-capacity-terminal.json')
|
||||
old_job=original['plan']['jobs'][0]
|
||||
@@ -123,8 +140,10 @@ def accept(case,resume_unsubmitted=False):
|
||||
break
|
||||
except m.GuardError:
|
||||
require(time.monotonic()<deadline,'fresh stored exact planning unavailable; no job submitted');time.sleep(3)
|
||||
request=recovery_request(device,target) if case=='apt_configure_recovery' else None
|
||||
if request is not None and session!=BASE:
|
||||
request=recovery_request(device,target) if case=='apt_configure_recovery' else m.case_input(case,target,planning=data)
|
||||
if data['host_reboot_required']:
|
||||
request['reason']+='; Host reboot already required; flag unchanged; no reboot in this job'
|
||||
if request is not None and session==BASE/'capacity-recovery':
|
||||
request['reason']+='; prior fixed plan expired with zero grants at the old journal capacity; preserve it and authorize this fresh plan separately'
|
||||
prior.accept(case,request=request,folder_root=cases)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user