fix: reconcile batch scope, resource safety and durable receipts (#44)
Core regression / Python core, intervention UI and release configuration (push) Failing after 9m5s
Core regression / JavaScript syntax (push) Successful in 7s
Core regression / Python core, intervention UI and release configuration (pull_request) Failing after 8m0s
Core regression / JavaScript syntax (pull_request) Successful in 7s

This commit is contained in:
阿白叔 committed 2026-11-27 12:26:19 +08:00
1 parent 0b7f3e5c4a
commit 392ae365da
45 files changed
+2855 -305

No files matched your search

@@ -798,6 +798,50 @@ Require QP_App.UndoCount=0,"launch failure invoked undo"
''', routines_transform=replace_shell)
@pytest.mark.parametrize('exit_code,may_write,expected_code', [
(4, False, 'lookup_unavailable'),
(1, False, '-2147220665'),
(4, True, '-2147220665'),
])
def test_native_lookup_timeout_code_reaches_status_tsv(tmp_path, exit_code, may_write, expected_code):
def replace_native_shell(routines):
start = routines.index('Sub QPNativeReplace(')
end = routines.index('End Sub', start)
return (routines[:start] + routines[start:end].replace(
'Set Shell = CreateObject("WScript.Shell")', 'Set Shell = New NativeResultShell')
+ routines[end:] + f'''
Class NativeResultShell
Public Function Run(ByVal CommandLine, ByVal WindowStyle, ByVal Wait)
Run={exit_code}
End Function
End Class
''')
if may_write:
(tmp_path / 'snapshot-value-job.tsv.native.json').write_text(
'{"stage": "native_replace_started"}', encoding='utf-8')
mutation_possible = 'True' if may_write else 'False'
run_vbs(tmp_path, 'part_number', f'''
Dim FailureSource, FailureDetail, StatusPath
QP_HelperExecutable=WScript.FullName
QP_HelperScript=""
QP_BatchMode=True
On Error Resume Next
QPAutomaticReplaceAndRestore Command,SnapshotPath
Failure=Err.Number: FailureSource=Err.Source: FailureDetail=Err.Description
Err.Clear
On Error GoTo 0
Require Failure<>0,"native failure did not reach status writer"
Require QP_NativeMutationPossible={mutation_possible},"native mutation evidence was lost or invented"
Require QP_App.UndoCount=0,"batch failure invoked undo"
QPFail QP_Root,"batch_failed",Failure,FailureSource,FailureDetail
StatusPath=QP_Fso.BuildPath(QP_Root,"status.tsv")
Require QPReadState(StatusPath,"value-job")="batch_failed","failure state was lost"
''', routines_transform=replace_native_shell)
rows = (tmp_path / 'status.tsv').read_text(encoding='utf-8-sig').splitlines()
assert rows[-1].split('\t')[:3] == ['value-job', 'batch_failed', expected_code]
def test_main_continues_after_zero_match_without_calling_native_helper(tmp_path):
run_vbs(tmp_path, 'preserve', r'''
QP_Fso.DeleteFile SnapshotPath