Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
780f8ef
R06: add fail-closed pending update readback and disarm
Oleksii-debug Sep 28, 2026
0f895f3
R06: expose native pending-update recovery boundary
Oleksii-debug Sep 28, 2026
82bdda0
R06: wire pending update recovery into packaged host
Oleksii-debug Sep 28, 2026
fc1a8ee
R06: add accessible pending update recovery controls
Oleksii-debug Sep 28, 2026
984721b
R06: load pending update recovery surface
Oleksii-debug Sep 28, 2026
e6b90a9
R06: cover pending update restart recovery and cancel semantics
Oleksii-debug Sep 28, 2026
3622c16
R06: align pending recovery validation transport semantics
Oleksii-debug Sep 28, 2026
085427a
R06: assert shared validation error contract for pending recovery
Oleksii-debug Sep 28, 2026
a78b2ba
R06: allowlist pending update recovery commands
Oleksii-debug Sep 28, 2026
cf214fb
R06: serialize staged update recovery commands
Oleksii-debug Sep 28, 2026
fcdf14c
R06: regress shared update operation lock
Oleksii-debug Sep 28, 2026
e79293d
R06: serialize packaged update and recovery operations
Oleksii-debug Sep 28, 2026
aa1f744
R06: reconverge apply handoff core on latest recovery parent
Oleksii-debug Sep 28, 2026
7229225
R06: serialize pending journal update operations in host
Oleksii-debug Sep 28, 2026
928a818
R06: reconverge apply handoff with serialized update-family lock
Oleksii-debug Sep 28, 2026
7320c9e
R06: regress concurrent staging and pending cancellation
Oleksii-debug Sep 28, 2026
806dfde
R06: reconverge apply transport command on latest parent
Oleksii-debug Sep 28, 2026
c3aaa27
R06: reconverge accessible apply handoff control
Oleksii-debug Sep 28, 2026
106a378
R06: reconverge apply handoff regressions on latest parent
Oleksii-debug Sep 28, 2026
fb15925
R06: reconverge apply handoff onto serialized recovery parent
Oleksii-debug Sep 28, 2026
d5392fe
R06: detect pending update automatically after host startup
Oleksii-debug Sep 28, 2026
f4f0c90
R06: serialize prepare-apply with all update commands
Oleksii-debug Sep 28, 2026
ba301c3
R06: add standalone atomic updater and rollback core
Oleksii-debug Sep 28, 2026
d24eb58
R06: regress serialized prepare-apply handoff
Oleksii-debug Sep 28, 2026
de33ff9
R06: add atomic updater rollback regressions
Oleksii-debug Sep 28, 2026
e912702
R06: remove duplicate update serialization wrapper
Oleksii-debug Sep 28, 2026
3c4bff1
R06: remove duplicate serialization test lineage
Oleksii-debug Sep 28, 2026
d7ef108
R06: keep one canonical update operation lock
Oleksii-debug Sep 28, 2026
bb35203
R06: reconverge atomic updater onto current apply-handoff head
Oleksii-debug Sep 28, 2026
d97e68f
R06: prove stage and pending cancel cannot overlap
Oleksii-debug Sep 28, 2026
e5e3a10
R06: converge apply handoff on canonical pending-update lock lineage
Oleksii-debug Sep 28, 2026
dbb23cb
R06: reconverge updater on current apply-handoff lineage
Oleksii-debug Sep 28, 2026
697f7c4
R06: rollback every post-publication updater failure
Oleksii-debug Sep 28, 2026
f8d7c40
R06: regress post-publication verification rollback
Oleksii-debug Sep 28, 2026
2ea484b
R06: reconverge atomic updater on current apply-handoff lineage
Oleksii-debug Sep 28, 2026
4313547
R06: bind updater apply to stable target and handoff
Oleksii-debug Sep 28, 2026
69f7328
R06: regress target and apply-authority TOCTOU
Oleksii-debug Sep 28, 2026
5cec163
R06: keep post-publication rollback regression phase-exact
Oleksii-debug Sep 28, 2026
f0653c0
R06: disarm apply authority after exact install
Oleksii-debug Sep 28, 2026
899fb7d
R06: regress updater replay-authority disarm
Oleksii-debug Sep 28, 2026
4916b1f
R06: publish rollback backup atomically
Oleksii-debug Sep 28, 2026
0ed162e
R06: regress crash-safe rollback generation
Oleksii-debug Sep 28, 2026
b071dbf
R06: serialize standalone updater across processes
Oleksii-debug Sep 28, 2026
bcccd7c
R06: add host-only updater process orchestration
Oleksii-debug Sep 28, 2026
b323615
R06: cover updater process orchestration fail-closed semantics
Oleksii-debug Sep 28, 2026
9a48899
R06: add 64-bit-safe Windows parent-exit barrier
Oleksii-debug Sep 28, 2026
80cff7a
R06: cover updater parent-exit barrier semantics
Oleksii-debug Sep 28, 2026
42c9805
R06: wire trusted updater runner to atomic apply core
Oleksii-debug Sep 28, 2026
36f2dbc
R06: add fail-closed updater runner regressions
Oleksii-debug Sep 28, 2026
19e995b
R06: tighten updater runner malformed-command assertion
Oleksii-debug Sep 28, 2026
faec747
R06: add trusted post-update relaunch boundary
Oleksii-debug Sep 28, 2026
c63d5da
R06: relaunch installed target and rollback failed spawn
Oleksii-debug Sep 28, 2026
63b101c
R06: cover relaunch ordering and failed-spawn rollback
Oleksii-debug Sep 28, 2026
5b8063b
R06: test trusted exact-target relaunch boundary
Oleksii-debug Sep 28, 2026
f45b188
R06: rollback unexpected post-apply target substitution
Oleksii-debug Sep 28, 2026
590288f
R06: prove target-substitution rollback uses parsed install target
Oleksii-debug Sep 28, 2026
f95acaf
R06: centralize host-owned packaged application version
Oleksii-debug Sep 28, 2026
82721e2
R06: add packaged standalone updater entrypoint
Oleksii-debug Sep 28, 2026
6505261
R06: share host-owned version with packaged updater
Oleksii-debug Sep 28, 2026
80f2da9
R06: package standalone updater with release artifact evidence
Oleksii-debug Sep 28, 2026
5da88d4
R06: qualify packaged updater trust wiring
Oleksii-debug Sep 28, 2026
784ec4c
R06: qualify standalone updater artifact in canonical release gate
Oleksii-debug Sep 28, 2026
0a1d2b4
R06: bind host launch to canonical same-publisher updater
Oleksii-debug Sep 28, 2026
83aa50e
R06: add explicit apply-and-restart native execution boundary
Oleksii-debug Sep 28, 2026
6f7fef8
R06: bind packaged updater launch and host shutdown
Oleksii-debug Sep 28, 2026
536a521
R06: surface durable apply-ready authority across restarts
Oleksii-debug Sep 28, 2026
12d82b4
R06: preserve exact request identity in update responses
Oleksii-debug Sep 28, 2026
c0e5a32
R06: expose accessible explicit install-and-restart action
Oleksii-debug Sep 28, 2026
56eb145
R06: qualify host-owned updater launch and restart boundary
Oleksii-debug Sep 28, 2026
630beb9
R06: add durable post-update health receipt authority
Oleksii-debug Sep 28, 2026
7cedf91
R06: preserve rollback through post-restart health receipt
Oleksii-debug Sep 28, 2026
55f4d2e
R06: qualify health receipt ordering and recovery paths
Oleksii-debug Sep 28, 2026
ec72bec
R06: test durable post-restart health receipt lifecycle
Oleksii-debug Sep 28, 2026
ebd45b7
R06: add host-owned post-restart health commit boundary
Oleksii-debug Sep 28, 2026
3f5cddb
R06: bind post-restart health commit ahead of pending recovery
Oleksii-debug Sep 28, 2026
f51a110
R06: commit update health before pending startup recovery
Oleksii-debug Sep 28, 2026
617f656
R06: qualify packaged post-restart health commit boundary
Oleksii-debug Sep 28, 2026
b840c8d
R06: preserve health receipt when rollback itself fails
Oleksii-debug Sep 29, 2026
433b30a
R06: bind updater direct invocation to its signed app sibling
Oleksii-debug Sep 29, 2026
9688f50
R06: qualify updater self-identity and confused-deputy rejection
Oleksii-debug Sep 29, 2026
b8285ee
R06: allowlist updater execution and post-restart health commands
Oleksii-debug Sep 29, 2026
ae21639
R06: isolate staged candidate in publisher rejection regression
Oleksii-debug Sep 29, 2026
b25ce18
R06: provision pytest for runtime integration suite
Oleksii-debug Sep 29, 2026
a617ea1
R06: align packaging fail-closed assertions with dual artifacts
Oleksii-debug Sep 29, 2026
798010a
R06: assert semantic initial install-button disable state
Oleksii-debug Sep 29, 2026
70cf117
R06: assert stale cleanup covers both packaged artifacts
Oleksii-debug Sep 29, 2026
4b282be
R06: repair exact-head update qualification contracts
Oleksii-debug Sep 29, 2026
6658c41
R06: make health regressions discoverable by unittest
Oleksii-debug Sep 29, 2026
620b459
R06: make parent-wait regressions discoverable by unittest
Oleksii-debug Sep 29, 2026
09e2b92
R06: make process regressions discoverable by unittest
Oleksii-debug Sep 29, 2026
2c89169
R06: make relaunch regressions discoverable by unittest
Oleksii-debug Sep 29, 2026
37eba77
R06: make updater runner regressions discoverable by unittest
Oleksii-debug Sep 29, 2026
afbd227
R06: keep runtime regression gates dependency-free
Oleksii-debug Sep 29, 2026
b5cd9f1
R06: keep updater qualification on canonical unittest runner
Oleksii-debug Sep 29, 2026
1f6b307
R06: align packaged artifact cleanup qualification
Oleksii-debug Sep 29, 2026
0ac5ba4
R06: lock update transport commands to empty payload
Oleksii-debug Sep 29, 2026
ae89b5a
R06: reconcile qualification successor onto current updater head
Oleksii-debug Sep 29, 2026
b448b40
R06 updater: carry atomic authority/resource repair into convergence
Oleksii-debug Sep 29, 2026
0446825
R06 updater: carry authority/resource regressions into convergence
Oleksii-debug Sep 29, 2026
c55bb27
R06 updater: align convergence success fixture with disarm contract
Oleksii-debug Sep 29, 2026
89bab26
Merge pull request #253 from Oleksii-debug/r06-update-qualification-c…
Oleksii-debug Sep 29, 2026
34f8036
R06 health: bind receipt readback to opened descriptor
Oleksii-debug Sep 29, 2026
45a8395
R06 health: regress descriptor-bound receipt reads
Oleksii-debug Sep 29, 2026
dd09b8f
R06 health: bind artifact hashing to opened descriptor
Oleksii-debug Sep 29, 2026
3b250b7
R06 health: regress artifact pathname swaps
Oleksii-debug Sep 29, 2026
8605b8b
Qualify #257 on literal pull-request head
Oleksii-debug Sep 29, 2026
9fd5b9a
Compose qualified updater stack onto current packaged authority
Oleksii-debug Sep 29, 2026
ccd3f8a
R06: sanitize updater live failures and expose busy state
Oleksii-debug Sep 30, 2026
4cdf5e0
R06: regress updater failure sanitization and busy semantics
Oleksii-debug Sep 30, 2026
9bc58b3
R06: sanitize staging UI failures and expose busy state
Oleksii-debug Sep 30, 2026
db42577
R06: regress sanitized updater staging failures
Oleksii-debug Sep 30, 2026
5c477bb
R06: syntax-check pending updater frontend module
Oleksii-debug Sep 30, 2026
8a0652c
R06: bind updater hashing to opened descriptor identity
Oleksii-debug Sep 30, 2026
9518f34
R06: regress updater hash pathname replacement
Oleksii-debug Sep 30, 2026
e28d282
R06: bind updater copies to source descriptor identity
Oleksii-debug Sep 30, 2026
f497513
R06: regress updater source identity replacement
Oleksii-debug Sep 30, 2026
b6803c7
R06: keep updater open-failure regression on valid source fixture
Oleksii-debug Sep 30, 2026
946fcd9
R06: preserve updater artifact identity across publisher verification
Oleksii-debug Sep 30, 2026
0d0e2cb
R06: regress byte-identical updater identity swaps
Oleksii-debug Sep 30, 2026
5541b4f
R06: preserve updater verification failure contract
Oleksii-debug Sep 30, 2026
08756ff
R06: align identity-swap regressions with stable diagnostics
Oleksii-debug Sep 30, 2026
d2fdaa3
test: isolate updater source-open failure on Windows
Oleksii-debug Sep 30, 2026
fd68724
R06: regress updater identity swaps before publication
Oleksii-debug Sep 30, 2026
e0e9d76
R06: rebind updater launch plan to verified host authority
Oleksii-debug Sep 30, 2026
a4a9eb4
R06: regress updater launch-plan substitution and reverify
Oleksii-debug Sep 30, 2026
b8798c9
R06: align launch test double with resolved plan contract
Oleksii-debug Sep 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lanes/dev1/repair_overlay/frontend/application-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,19 @@ async function invokeNativeUpdate(command){
}

function setBusy(busy){
const view=$('application-update-view');
if(view)view.setAttribute('aria-busy',busy?'true':'false');
for(const id of ['application-update-select','application-update-stage']){
const button=$(id);
if(button)button.disabled=busy;
}
}

function reportFailure(error,message){
console.error('application update operation failed',error);
announce(message);
}

async function selectAndVerify(command=VERIFY_UPDATE_COMMAND){
const staging=command===STAGE_UPDATE_COMMAND;
setBusy(true);
Expand All @@ -109,7 +116,12 @@ async function selectAndVerify(command=VERIFY_UPDATE_COMMAND){
}
}catch(error){
clearDetails();
announce(`${staging?'Оновлення не підготовлено':'Оновлення не перевірено'}: ${error?.message||'невідома помилка'}`);
reportFailure(
error,
staging
?'Оновлення не підготовлено. Пакет не встановлено й файли програми не змінено.'
:'Оновлення не перевірено. Виберіть локальний manifest і пакет та повторіть перевірку.'
);
}finally{
setBusy(false);
}
Expand Down Expand Up @@ -153,3 +165,4 @@ function mount(){

mount();
void import('./diagnostics-ui.js');
void import('./pending-update.js');
178 changes: 178 additions & 0 deletions lanes/dev1/repair_overlay/frontend/pending-update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
const API_VERSION='scripture.transport.v1';
const HEALTH_COMMAND='application_update.commit_post_restart_health';
const STATUS_COMMAND='application_update.pending_status';
const PREPARE_APPLY_COMMAND='application_update.prepare_apply';
const APPLY_AND_RESTART_COMMAND='application_update.apply_and_restart';
const CANCEL_COMMAND='application_update.cancel_pending';
const $=id=>document.getElementById(id);
let sequence=0;
let startupCheckStarted=false;

function setStatus(message,{global=true}={}){
if(global){
const live=$('global-status');
if(live){live.textContent='';requestAnimationFrame(()=>{live.textContent=message})}
}
const local=$('pending-update-status');
if(local)local.textContent=message;
}

function element(tag,text){
const node=document.createElement(tag);
if(text!==undefined)node.textContent=text;
return node;
}

async function invoke(command){
const invokeNative=window.pywebview?.api?.invoke;
if(typeof invokeNative!=='function')throw new Error('Ця дія доступна лише у packaged Windows application.');
const response=await invokeNative({api_version:API_VERSION,request_id:`pending-${Date.now()}-${++sequence}`,command,payload:{}});
if(!response?.ok)throw new Error(response?.error?.message||'Операція завершилась помилкою.');
return response.data??{};
}

function setBusy(busy){
const section=$('pending-update-recovery');
if(section)section.setAttribute('aria-busy',busy?'true':'false');
for(const id of ['pending-update-check','pending-update-prepare-apply','pending-update-apply-restart','pending-update-cancel']){
const button=$(id);if(button)button.disabled=busy||(id==='pending-update-apply-restart'&&button.dataset.ready!=='true');
}
}

function reportFailure(context,error,message){
console.error(context,error);
setStatus(message);
}

function setApplyReady(ready){
const button=$('pending-update-apply-restart');
if(!button)return;
button.dataset.ready=ready?'true':'false';
button.disabled=!ready;
}

function clearDetails(){$('pending-update-details')?.replaceChildren()}

function renderPending(data){
const host=$('pending-update-details');
if(!host||data.pending!==true)return;
host.replaceChildren();
const rows=[
['Статус',data.status==='apply_ready'?'Намір встановлення підготовлено; можна встановити й перезапустити':'Підготовлено, але не встановлено'],
['Продукт',data.product_id],['Платформа',data.target_platform],
['Поточна версія',data.current_version],['Цільова версія',data.target_version],
['Source head',data.source_head],['Файл пакета',data.artifact_name],
['Розмір',Number.isFinite(Number(data.artifact_size))?`${data.artifact_size} байт`:'—'],
['SHA-256',data.artifact_sha256],['Автентичність','Same-publisher Authenticode повторно підтверджено']
];
for(const [label,value] of rows){host.append(element('dt',label),element('dd',value??'—'))}
}

async function checkPending({startup=false}={}){
setBusy(true);clearDetails();
if(!startup)setStatus('Повторно перевіряю підготовлене оновлення.');
try{
const data=await invoke(STATUS_COMMAND);
if(data.pending===true&&(data.status==='staged'||data.status==='apply_ready')){
renderPending(data);
const ready=data.status==='apply_ready';
setApplyReady(ready);
setStatus(ready
?`Захищений намір встановлення ${data.artifact_name??'пакета'} → ${data.target_version??'цільова версія'} відновлено й повторно перевірено. Можна встановити та перезапустити програму.`
:`Підготовлене оновлення ${data.artifact_name??'пакет'} → ${data.target_version??'цільова версія'} повторно перевірено. Воно ще не встановлене.`);
}else if(data.pending===false&&data.status==='none'){
setApplyReady(false);
setStatus('Підготовленого оновлення немає.',{global:!startup});
}else throw new Error('Отримано неочікуваний стан.');
}catch(error){
clearDetails();setApplyReady(false);
reportFailure('pending update status failed',error,'Підготовлене оновлення не вдалося безпечно перевірити. Спробуйте перевірити його ще раз.');
}finally{setBusy(false)}
}

async function prepareApply(){
setBusy(true);setApplyReady(false);setStatus('Повторно перевіряю пакет і готую захищений намір встановлення.');
try{
const data=await invoke(PREPARE_APPLY_COMMAND);
if(data.pending===true&&data.status==='apply_ready'&&data.installation_performed===false){
renderPending(data);setApplyReady(true);
setStatus(`Намір встановлення ${data.artifact_name??'пакета'} → ${data.target_version??'цільова версія'} підготовлено. Файли програми ще не замінювались. Окрема кнопка «Встановити й перезапустити» запускає підписаний native updater.`);
}else throw new Error('Підготовку apply handoff не підтверджено.');
}catch(error){
setApplyReady(false);
reportFailure('prepare update apply failed',error,'Не вдалося безпечно підготувати встановлення. Файли програми не змінено.');
}
finally{setBusy(false)}
}

async function applyAndRestart(){
setBusy(true);
setStatus('Запускаю перевірений native updater. Програма закриється; updater дочекається завершення цього процесу, встановить точні повторно перевірені байти й запустить програму знову.');
try{
const data=await invoke(APPLY_AND_RESTART_COMMAND);
if(data.pending===true&&data.status==='updater_started'&&data.updater_process_started===true&&data.restart_requested===true){
setStatus('Native updater запущено. Завершую поточну програму для безпечного встановлення та перезапуску.');
}else throw new Error('Запуск native updater не підтверджено.');
}catch(error){
reportFailure('start native updater failed',error,'Не вдалося безпечно запустити встановлення. Поточна версія програми залишається активною.');
setBusy(false);
}
}

async function cancelPending(){
setBusy(true);clearDetails();setApplyReady(false);setStatus('Скасовую підготовлений стан оновлення.');
try{
const data=await invoke(CANCEL_COMMAND);
if(data.pending===false&&(data.status==='cancelled'||data.status==='none')){
setStatus(data.status==='cancelled'?'Підготовлене оновлення та його apply-наміри скасовано. Інсталяція не виконувалась.':'Підготовленого оновлення вже немає.');
}else throw new Error('Скасування не підтверджено.');
}catch(error){
reportFailure('cancel pending update failed',error,'Не вдалося безпечно скасувати підготовлене оновлення. Повторіть перевірку стану перед наступною дією.');
}
finally{setBusy(false)}
}

async function commitPostRestartHealth(){
setBusy(true);
setStatus('Перевіряю стан після перезапуску та збережений rollback.');
try{
const data=await invoke(HEALTH_COMMAND);
if(data.status==='healthy'&&data.health_committed===true&&data.rollback_cleanup_performed===true){
setStatus(`Оновлена версія ${data.target_version??'програми'} успішно запустила native bridge. Rollback попередньої версії ${data.previous_version??''} безпечно завершено.`);
}else if(data.status!=='none'||data.health_committed!==false){
throw new Error('Отримано неочікуваний post-update health state.');
}
await checkPending({startup:true});
}catch(error){
clearDetails();setApplyReady(false);setBusy(false);
reportFailure('post-update health check failed',error,'Перевірку стану після перезапуску не підтверджено. Rollback recovery збережено; автоматичне очищення не виконано.');
}
}

function startStartupCheck(){
if(startupCheckStarted)return;
startupCheckStarted=true;
void commitPostRestartHealth();
}

function mount(){
const view=$('application-update-view');if(!view||$('pending-update-recovery'))return;
const section=element('section');section.id='pending-update-recovery';section.className='surface';section.setAttribute('aria-labelledby','pending-update-heading');
const heading=element('h3','Підготовлене оновлення після перезапуску');heading.id='pending-update-heading';
const help=element('p','Після запуску програма спочатку перевіряє post-update health receipt: точну поточну версію, встановлені байти та збережений rollback. Лише після успішної перевірки старий rollback і stale pending authority прибираються. Потім програма перевіряє звичайний pending state. «Підготувати встановлення» створює durable apply handoff, а «Встановити й перезапустити» запускає підписаний native updater. Browser не передає шляхів, PID або командного рядка updater.');
const actions=element('div');actions.className='action-row';
const check=element('button','Перевірити підготовлене оновлення');check.type='button';check.id='pending-update-check';
const prepare=element('button','Підготувати встановлення');prepare.type='button';prepare.id='pending-update-prepare-apply';
const apply=element('button','Встановити й перезапустити');apply.type='button';apply.id='pending-update-apply-restart';apply.dataset.ready='false';apply.disabled=true;
const cancel=element('button','Скасувати підготовлене оновлення');cancel.type='button';cancel.id='pending-update-cancel';
actions.append(check,prepare,apply,cancel);
const status=element('p','Очікую готовності native host для post-update health і pending перевірки.');status.id='pending-update-status';status.className='notice info';status.setAttribute('role','status');status.setAttribute('aria-live','polite');status.setAttribute('aria-atomic','true');
const details=element('dl');details.id='pending-update-details';details.className='details-list';details.setAttribute('aria-label','Повторно перевірені метадані підготовленого оновлення');
section.append(heading,help,actions,status,details);view.append(section);
check.addEventListener('click',()=>checkPending());prepare.addEventListener('click',prepareApply);apply.addEventListener('click',applyAndRestart);cancel.addEventListener('click',cancelPending);

window.addEventListener('pywebviewready',startStartupCheck,{once:true});
if(typeof window.pywebview?.api?.invoke==='function')queueMicrotask(startStartupCheck);
}

mount();
56 changes: 49 additions & 7 deletions lanes/dev1/repair_overlay/packaging/build_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ Assert-NativeSuccess "packaged payload manifest generation"

$Sep = ";"
$Name = "ScriptureArchive-R06-DEV01"
$UpdaterName = "$Name-Updater"
$Out = Join-Path $Dist "$Name.exe"
if (Test-Path -LiteralPath $Out) {
Remove-Item -LiteralPath $Out -Force
$UpdaterOut = Join-Path $Dist "$UpdaterName.exe"
foreach ($artifact in @($Out, $UpdaterOut)) {
if (Test-Path -LiteralPath $artifact) {
Remove-Item -LiteralPath $artifact -Force
}
}
try {
& (Join-Path $Venv "Scripts\pyinstaller.exe") --noconfirm --clean --onefile --windowed `
Expand All @@ -99,14 +103,24 @@ try {
--paths $PlatformRoot --paths $Repo `
--distpath $Dist --workpath $Work --specpath $Spec `
(Join-Path $PlatformRoot "run_windows.py")
Assert-NativeSuccess "PyInstaller build"
Assert-NativeSuccess "PyInstaller application build"

& (Join-Path $Venv "Scripts\pyinstaller.exe") --noconfirm --clean --onefile --windowed `
--name $UpdaterName `
--paths $PlatformRoot --paths $Repo `
--distpath $Dist --workpath $Work --specpath $Spec `
(Join-Path $PlatformRoot "scripture_archive_platform\desktop_host\updater_main.py")
Assert-NativeSuccess "PyInstaller updater build"
} finally {
Remove-Item -LiteralPath $BuildIdentityDir -Recurse -Force -ErrorAction SilentlyContinue
}

if (-not (Test-Path -LiteralPath $Out -PathType Leaf)) {
throw "Expected executable not produced: $Out"
}
if (-not (Test-Path -LiteralPath $UpdaterOut -PathType Leaf)) {
throw "Expected updater executable not produced: $UpdaterOut"
}

$PayloadReadback = Join-Path $Dist "packaged_payload_fidelity.json"
& $Python $FidelityTool verify `
Expand All @@ -117,6 +131,8 @@ Assert-NativeSuccess "embedded packaged payload fidelity verification"

$hash = (Get-FileHash -Algorithm SHA256 $Out).Hash.ToLowerInvariant()
$size = (Get-Item $Out).Length
$updaterHash = (Get-FileHash -Algorithm SHA256 $UpdaterOut).Hash.ToLowerInvariant()
$updaterSize = (Get-Item $UpdaterOut).Length
$payloadEvidenceHash = (Get-FileHash -Algorithm SHA256 $PayloadReadback).Hash.ToLowerInvariant()
$pythonVersion = (& $Python --version 2>&1 | Out-String).Trim()
Assert-NativeSuccess "Python version query"
Expand All @@ -127,6 +143,10 @@ $manifest = [ordered]@{
artifact_path = $Out
size_bytes = $size
sha256 = $hash
updater_artifact_name = (Split-Path -Leaf $UpdaterOut)
updater_artifact_path = $UpdaterOut
updater_size_bytes = $updaterSize
updater_sha256 = $updaterHash
built_utc = (Get-Date).ToUniversalTime().ToString("o")
git_sha = $actualGitSha
github_event_sha = $env:GITHUB_SHA
Expand All @@ -138,31 +158,53 @@ $manifest = [ordered]@{
packaged_payload_fidelity_file = (Split-Path -Leaf $PayloadReadback)
packaged_payload_fidelity_sha256 = $payloadEvidenceHash
proof_scope = @(
"PyInstaller build completed",
"artifact size/hash readback verified",
"PyInstaller application and standalone updater builds completed",
"application and updater artifact size/hash readback verified",
"embedded frontend/campaign/build-identity bytes verified against exact staged manifest",
"Git-tracked embedded frontend overlay/campaign bytes verified against exact checkout Git blob IDs",
"WebView2 runtime presence probed before build",
"packaged diagnostics build identity bound to exact checkout SHA"
)
not_proven = @(
"production Authenticode signing identity is configured",
"Python module bytecode identity inside PYZ",
"human NVDA acceptance",
"full application functional acceptance",
"visual correctness",
"recovery execution"
"post-restart health commit"
)
}
$ManifestPath = Join-Path $Dist "build_manifest.json"
$manifest | ConvertTo-Json -Depth 6 | Set-Content -Encoding utf8 $ManifestPath

"SHA256=$hash" | Set-Content -Encoding utf8 (Join-Path $Dist "$Name.sha256.txt")
"SIZE=$size" | Add-Content -Encoding utf8 (Join-Path $Dist "$Name.sha256.txt")
"SHA256=$updaterHash" | Set-Content -Encoding utf8 (Join-Path $Dist "$UpdaterName.sha256.txt")
"SIZE=$updaterSize" | Add-Content -Encoding utf8 (Join-Path $Dist "$UpdaterName.sha256.txt")

& $Python (Join-Path $PSScriptRoot "windows_release.py") verify-artifact `
--artifact $Out `
--manifest $ManifestPath `
--output (Join-Path $Dist "artifact_readback.json")
Assert-NativeSuccess "artifact verification"
Assert-NativeSuccess "application artifact verification"

$UpdaterManifestPath = Join-Path $Dist "updater_build_manifest.json"
$updaterManifest = [ordered]@{
schema_version = 1
artifact_name = (Split-Path -Leaf $UpdaterOut)
artifact_path = $UpdaterOut
size_bytes = $updaterSize
sha256 = $updaterHash
git_sha = $actualGitSha
application_version_authority = "scripture_archive_platform.desktop_host.version.CURRENT_APPLICATION_VERSION"
authenticode_authority = "scripture_archive_platform.desktop_host.authenticode.verify_same_publisher_authenticode"
}
$updaterManifest | ConvertTo-Json -Depth 4 | Set-Content -Encoding utf8 $UpdaterManifestPath
& $Python (Join-Path $PSScriptRoot "windows_release.py") verify-artifact `
--artifact $UpdaterOut `
--manifest $UpdaterManifestPath `
--output (Join-Path $Dist "updater_artifact_readback.json")
Assert-NativeSuccess "updater artifact verification"

Write-Output "Built $Out ($size bytes) SHA256=$hash"
Write-Output "Built $UpdaterOut ($updaterSize bytes) SHA256=$updaterHash"
Loading
Loading