Skip to content

Lab: reject unsafe startup and isolate native test launches - #233

Merged
dayfine merged 10 commits into
lab/mainfrom
lab/startup-isolation
Nov 6, 2026
Merged

dayfine merged 10 commits into
lab/mainfrom
lab/startup-isolation

Conversation

@dayfine

@dayfine dayfine commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Base: lab/main. Mechanical prerequisite: fork PR #234, merged into this branch without rewriting published history. No AutoStory feature parents. The base-relative diff still includes #234 until that change reaches lab/main.

A mistyped test command (--test bdsp) could launch the GUI, and a macOS relaunch without --profile could restore the live app's default controller settings. Existing lab/main also discovers serial ports and cameras before checking test mode.

The revised implementation separates:

  • General StartupArguments: parse before Qt/settings/devices, preserve documented Qt options, and dispatch exclusively to GUI or tests. With no lab adapter, no arguments still mean ordinary GUI startup.
  • Lab-only LabStartupPolicy: require an explicit macOS lab profile or select the identity compiled with PA_LAB_PROFILE; reject conflicts. No-argument relaunches of bound binaries select the correct profile, and unbound lab builds fail closed.
  • Test startup: explicit tests skip saved settings, window restoration and startup device discovery; persisted test mode exits before device startup and its cleanup initialization. This baseline keeps an interim QCoreApplication test entry point; it must be replaced by reuse of the existing headless runner when preparing upstream validation.

Validation: 40 native cases (16 general grammar/Qt compatibility, 24 lab policy/dispatch) pass locally with Apple Clang C++23 and warnings as errors; code health passes against origin/lab/main. The initial Ubuntu CI caught incorrect source paths; those are fixed in a separate commit. Fresh macOS, Windows Clang and Ubuntu builds/native suites are dispatched for the revised head. macOS CI also checks invalid executable invocations. No console or app deployment was performed.

How to review

  1. Review the mechanical shutdown extraction in Extract application shutdown helpers without behavior changes #234. It is independently based on fork main and has no lab policy.
  2. Read StartupArguments.h/.cpp and its generic tests, then LabStartupPolicy.h/.cpp and its separate tests.
  3. Review the behavior wiring in Main.cpp after the mechanical prerequisite:
git diff origin/startup/shutdown-refactor..origin/lab/startup-isolation -- SerialPrograms/Source/CommonFramework/Main.cpp

For the full diff with moved lines distinguished:

git diff --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change origin/lab/main...lab/startup-isolation

Startup design and upstream sequence documents the examples and exact boundary: reuse PokemonAutomation#1845 for upstream test lifecycle, prepare general validation separately, preserve release defaults/Qt options, and keep profile requirements on lab branches. No pending headless-runner code is imported here.

Profiles do not enforce physical serial-device ownership; a lease before port open remains separate work. After merge, lab integration branches merge origin/lab/main; upstream-bound feature branches never merge lab tooling.

Code-health dependency: #235 fixes baseline matching for namespace moves and namespace comments after metatype macros. This C++ revision passes the updated linter; canonical CI requires that tooling PR to merge into agents first.

@dayfine
dayfine marked this pull request as ready for review November 6, 2026 08:54
@dayfine
dayfine merged commit 32f9003 into lab/main Nov 6, 2026
9 of 18 checks passed
@dayfine
dayfine deleted the lab/startup-isolation branch November 6, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant