From 90509c9bfeeeec2e21b91bac389eaf008853e608 Mon Sep 17 00:00:00 2001 From: dayfine Date: Sat, 14 Nov 2026 02:06:25 -0800 Subject: [PATCH 1/3] Lab channel: write Lab/state.json for the lab server (#131 Slice 1) The lab channel now writes Lab/state.json beside the legacy Lab/state, version 1 of the lab server's app_state contract (fork #478): instance UUID, pid and profile, panel, program state, the last start or stop and where it came from (ui, lab with the request's id, program, error), the controller, the newest video frame's sequence and capture time, and unknown observations. It is rewritten at every poll as a heartbeat; the legacy file is unchanged. A request may carry the lab server's id on a "request " line. LabTransitionTracker names the source of each start and stop from the program's state changes; LabConsoleCommands gains video() so the channel can count frames. Tests: LabStateJson checks the writer against the contract's goldens byte for byte, and the transition sources; LabChannel covers the request id and the UUIDs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Source/CommonFramework/Windows/Lab.md | 32 +- .../CommonFramework/Windows/LabChannel.cpp | 112 +++- .../CommonFramework/Windows/LabChannel.h | 52 +- .../Windows/LabChannel_Tests.cpp | 76 +++ .../CommonFramework/Windows/LabRequest.cpp | 6 + .../CommonFramework/Windows/LabRequest.h | 7 +- .../CommonFramework/Windows/LabStateJson.cpp | 313 ++++++++++ .../CommonFramework/Windows/LabStateJson.h | 81 +++ .../Windows/LabStateJson_Tests.cpp | 550 ++++++++++++++++++ .../Windows/LabStateJson_Tests.h | 21 + .../CommonFramework/Windows/LabTransition.cpp | 108 ++++ .../CommonFramework/Windows/LabTransition.h | 91 +++ .../ComputerPrograms_UnitTestRunner.cpp | 2 + .../NintendoSwitch_LabCommands.cpp | 5 + .../NintendoSwitch_LabCommands.h | 1 + SerialPrograms/cmake/SourceFiles.cmake | 6 + 16 files changed, 1449 insertions(+), 14 deletions(-) create mode 100644 SerialPrograms/Source/CommonFramework/Windows/LabStateJson.cpp create mode 100644 SerialPrograms/Source/CommonFramework/Windows/LabStateJson.h create mode 100644 SerialPrograms/Source/CommonFramework/Windows/LabStateJson_Tests.cpp create mode 100644 SerialPrograms/Source/CommonFramework/Windows/LabStateJson_Tests.h create mode 100644 SerialPrograms/Source/CommonFramework/Windows/LabTransition.cpp create mode 100644 SerialPrograms/Source/CommonFramework/Windows/LabTransition.h diff --git a/SerialPrograms/Source/CommonFramework/Windows/Lab.md b/SerialPrograms/Source/CommonFramework/Windows/Lab.md index 0dc2608227..24093b73a3 100644 --- a/SerialPrograms/Source/CommonFramework/Windows/Lab.md +++ b/SerialPrograms/Source/CommonFramework/Windows/Lab.md @@ -28,6 +28,7 @@ takes effect at the next launch. | `Lab/outbox/.out` | app writes | The request's journal (below). It appears only once the request has finished; `.tmp` shows the progress so far. | | `Lab/outbox/_