feat-ui-operation-history-and-durable-execution
Core regression / Python core and release configuration (push) Successful in 17s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python core and release configuration (pull_request) Successful in 16s
Core regression / JavaScript syntax (pull_request) Successful in 3s

This commit is contained in:
阿白叔 committed 2026-11-03 17:54:17 +08:00
1 parent 4874c7e95a
commit cf90ced825
44 files changed
+3165 -92

No files matched your search

@@ -159,6 +159,8 @@ Sub QPMain()
Set Command = QPReadCommand(QP_Fso.BuildPath(QP_Root, "command.tsv"))
QP_CurrentJobId = CStr(Command("job_id"))
QPRequireProject Command
If QP_BatchMode And Not QP_Fso.FileExists(QP_Fso.BuildPath(QP_Root, "recovery.request")) Then _
QPVerifyExpectedBaselines CStr(Command("project_path"))
SnapshotPath = QPJobSnapshotPath(CStr(Command("job_id")))
State = QPReadState(QP_Fso.BuildPath(QP_Root, "status.tsv"), _
CStr(Command("job_id")))
@@ -1003,7 +1005,10 @@ Sub QPFinishBatchItem()
QPMarkBatchMutation Command
QPCloseBatchProject TargetPath, True
ElseIf Not QP_SessionMode Then
QPWriteVerifiedState Command
QPCloseBatchProject TargetPath, False
Else
QPWriteVerifiedState Command
End If
If FinalState = "restored_ok" Then
QPProgress "verify_saved_project", 0, 1
@@ -1019,6 +1024,7 @@ Sub QPFinishBatchItem()
Plans.Add CStr(Index), Candidate
Next
QPVerifyRestoredPlans Command, Records, Plans, ValueStates
QPWriteVerifiedState Command
If Not QP_SessionMode Then QPCloseBatchProject TargetPath, False
FinalState = "saved_ok"
QPLog QP_Root, "INFO", "saved_readback_verified job=" & QP_CurrentJobId
@@ -1046,6 +1052,74 @@ Sub QPFinishBatchItem()
QPProgress "finished", 1, 1
End Sub
Function QPCurrentSemanticState()
Dim Components, Comp, State
QPInvalidatePinIndex
QPInvalidateComponentIndex
Set Components = QP_App.ActiveView.Query(VDM_COMP, VD_ALL)
State = ""
For Each Comp In Components
State = State & QPUntouchedFullState(Comp)
Next
QPCurrentSemanticState = "S" & vbTab & "full_sheet_v1" & vbCrLf & QPSortSnapshotLines(State)
End Function
Sub QPRequireExpectedState(ByVal Expected, ByVal Actual)
If CStr(Expected) <> CStr(Actual) Then Err.Raise vbObjectError + 879, _
"QuickPartReplace.Baseline", "project changed since the last verified receipt; reconcile before continuing"
End Sub
Sub QPWriteVerifiedState(ByRef Command)
Dim Text, View
Set View = QP_App.ActiveView
Text = "job_id" & vbTab & "project_path" & vbTab & "schematic_name" & vbTab & _
"sheet_number" & vbTab & "semantic_state" & vbCrLf
Text = Text & QPEncode(CStr(Command("job_id"))) & vbTab & QPEncode(CStr(Command("project_path"))) & _
vbTab & QPEncode(CStr(View.GetName(0))) & vbTab & QPEncode(CStr(View.Block.SheetNum)) & _
vbTab & QPEncode(QPCurrentSemanticState()) & vbCrLf
QPWriteUtf8 QP_Fso.BuildPath(QP_Root, "post-state-" & CStr(Command("job_id")) & ".tsv"), Text
End Sub
Sub QPVerifyExpectedBaselines(ByVal TargetPath)
Dim ErrorNumber, Description
On Error Resume Next
QPCheckExpectedBaselines TargetPath
ErrorNumber = Err.Number
Description = Err.Description
Err.Clear
On Error GoTo 0
If ErrorNumber <> 0 Then Err.Raise vbObjectError + 879, "QuickPartReplace.Baseline", Description
End Sub
Sub QPCheckExpectedBaselines(ByVal TargetPath)
Dim Path, Lines, Fields, Index, Documents, Document, OriginalSchematic, OriginalSheet
Path = QP_Fso.BuildPath(QP_Root, "expected-baselines.tsv")
If Not QP_Fso.FileExists(Path) Then Exit Sub
Lines = Split(QPReadUtf8(Path), vbLf)
If Replace(Lines(0), vbCr, "") <> "project_path" & vbTab & "schematic_name" & vbTab & "sheet_number" & vbTab & "semantic_state" Then _
Err.Raise vbObjectError + 879, "QuickPartReplace.Baseline", "invalid expected semantic baseline"
OriginalSchematic = CStr(QP_App.ActiveView.GetName(0))
OriginalSheet = CStr(QP_App.ActiveView.Block.SheetNum)
Set Documents = QP_App.SchematicSheetDocuments()
For Index = 1 To UBound(Lines)
If Len(Replace(Lines(Index), vbCr, "")) > 0 Then
Fields = Split(Replace(Lines(Index), vbCr, ""), vbTab)
If UBound(Fields) <> 3 Then Err.Raise vbObjectError + 879, "QuickPartReplace.Baseline", "incomplete expected semantic baseline"
If QPCanonicalPath(QPDecode(Fields(0))) <> QPCanonicalPath(TargetPath) Then _
Err.Raise vbObjectError + 879, "QuickPartReplace.Baseline", "semantic baseline project mismatch"
QPRequireSheetManifest TargetPath, Documents, QPDecode(Fields(1)), QPDecode(Fields(2))
Set Document = Documents.Open(QPDecode(Fields(1)), QPDecode(Fields(2)))
Document.Activate
QPRequireExpectedState QPDecode(Fields(3)), QPCurrentSemanticState()
Document.Close False, ""
End If
Next
Set Document = Documents.Open(OriginalSchematic, OriginalSheet)
Document.Activate
QPInvalidatePinIndex
QPInvalidateComponentIndex
End Sub
Sub QPMarkBatchMutation(ByRef Command)
Dim Shell, Entry, Required, CommandLine, Key, Value, ExitCode
Set Shell = CreateObject("WScript.Shell")
@@ -1962,6 +2036,7 @@ Sub QPRecoverSavedJob(ByRef Command, ByVal SnapshotPath)
Err.Raise vbObjectError + 865, "QuickPartReplace.Recovery", "mixed source and target components; no recovery writes performed"
If OldCount = Plans.Count Then
QPRequireCommandSnapshot Command, SnapshotPath
If QP_BatchMode Then QPWriteVerifiedState Command
Set RecoveryDocuments = QP_App.SchematicSheetDocuments()
If RecoveryDocuments.Count <> 1 Then _
Err.Raise vbObjectError + 865, "QuickPartReplace.Recovery", "read-only recovery document ownership changed"
@@ -1989,6 +2064,7 @@ Sub QPRecoverSavedJob(ByRef Command, ByVal SnapshotPath)
' A fresh owned recovery session has already verified the disk state.
' Closing without saving avoids a second save/reopen cycle for no writes.
QPRequireCommandSnapshot Command, SnapshotPath
QPWriteVerifiedState Command
QPCloseBatchProject CStr(Command("project_path")), False
QP_BatchMode = False
QPWriteStatus QP_Root, QP_CurrentJobId, "restored_ok", "recovery_saved_verified", _