fix(update): derive stop identity from lab run copy#16
Conversation
The update lab stop path exited before reading the run copy metadata, so variant runs could kill the wrong process and clear the wrong defaults domain. Loading identity from the staged app copy keeps stop cleanup aligned with the app that was actually launched. Signed-off-by: Kevin Cui <bh@bugs.cc>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
WalkthroughThe PR refactors scripts/update-lab/update-lab.sh to consolidate app-bundle identity loading. Two new helper functions—load_app_identity and load_run_copy_identity—extract CFBundleIdentifier and CFBundleExecutable from Info.plist files and populate shared globals. The stop scenario now attempts to load the identity of a previously copied app before cleanup, the main flow replaces multiple inline PlistBuddy reads with a single helper call (failing fast on unreadable plist), and the post-scenario teardown now invokes stop_lab --with-app. Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/update-lab/update-lab.sh`:
- Around line 89-91: The stop flow currently masks failures by using
"load_run_copy_identity || true" which allows stop_lab to proceed with
potentially wrong defaults (BUNDLE_ID / EXECUTABLE_NAME); remove the "|| true"
and instead let load_run_copy_identity propagate its non-zero exit so the script
aborts on identity resolution failures, or explicitly check its return and exit
with an error before calling stop_lab (affecting the SCENARIO == "stop" branch
and the functions load_run_copy_identity and stop_lab).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 69b9596d-7461-4da6-a91f-d7274479de86
📒 Files selected for processing (1)
scripts/update-lab/update-lab.sh
The stop path now derives the app identity from the staged run copy, but
fell back to the env-var defaults (LockIME Dev / com.oomol.LockIME.dev)
when no run copy was present — which alias the real dev app, so stop could
pkill the developer's running dev build and clear its defaults domain.
Gate the app-specific cleanup (process kill, skip-key clearing) behind a
--with-app flag that callers pass only when an identity was actually
resolved: from the run copy in the stop branch, or from APP_SRC in the
main flow. Server teardown and dir removal stay unconditional, so
`make update-test-stop` remains an idempotent no-op when nothing is staged.
Also fix load_run_copy_identity crashing under bash 3.2 (macOS's default):
"${apps[@]}" on an empty array is fatal with `set -u`, so guard the loop
with an explicit length check. CI runs bash 5.x and never hit this.
Signed-off-by: Kevin Cui <bh@bugs.cc>
The update lab stop path exited before reading the run copy metadata, so variant runs could kill the wrong process and clear the wrong defaults domain. Loading identity from the staged app copy keeps stop cleanup aligned with the app that was actually launched.