fix(core): allow spaces in a launch argument name
What
The object form of app.launchArguments accepts a name with spaces inside it:
app: { launchArguments: { 'NSSplitView Subview Frames Main': ['0, 0, 200, 600'] } }
A name with a control character, a space at either end, or whitespace other than a space still fails with INVALID_CONFIG.
Why
AppKit autosave names produce user-defaults keys with spaces, such as NSSplitView Subview Frames <name>. The object form refused any whitespace in a name, so such a key could only be written in the list form.
Neither https://github.com/e2e-inc/e2e/pull/1903 nor its review threads give a reason for the rule. I traced every consumer of the object form to see whether a space can split a name:
| Consumer | How the name travels | Safe |
|---|---|---|
appleUserDefaults (core) | -${name} as one array item | yes |
desktop() | Command::new("/usr/bin/open") ... .arg("--args").args(...), no shell (crates/e2e-desktop-napi/src/launch.rs:167) | yes |
mobile() iOS simulator | agent-device pushes the items onto the simctl launch argv | yes |
mobile() iOS device | agent-device pushes them after -- on devicectl device process launch | yes |
mobile() Android | ['--es', name, value]; agent-device 0.21.43 single-quotes every adb shell word outside [A-Za-z0-9_@%+=:,./-] | yes |
| Device providers | none read the names; they pass the same list the engine builds. The Revyl backend refuses launch arguments altogether | yes |
The list form and object values ("a b", (fr, en-GB)) already carried spaces through every one of these paths, so a spaced name adds no new kind of input.
How it works
checkLaunchArgumentsrefuses a name with a control character or whitespace other than U+0020, then a name with a space at either end (packages/core/src/internal/launch-arguments.ts:45). Before, it refused any\s.- A tab, a no-break space, or a space at either end stays refused because it is a typo the app would never read. The list form still takes any string.
docs/reference/config.mdxanddocs/reference/engine.mdxstate the new rule.
Issue
From a teammate's findings report on the desktop engine; no GitHub issue. No Linear tool in this session, so the title carries no ticket id.
Verified
Ran it locally: yes
- Desktop testbed in background mode, a scratch config that adds
launchArguments: { 'NSSplitView Subview Frames Main': ['0, 0, 200, 600'], e2e: true }to the testbed target, and a test that opens the app and reads the launched process's argv throughsysctl KERN_PROCARGS2.
| main | this PR |
|---|---|
INVALID_CONFIG: target "macos" app.launchArguments argument name "NSSplitView Subview Frames Main" must have no whitespace or control characters | test passes, the key is one argument |
argv: [".../build/SignInForm.app/Contents/MacOS/SignInForm","-ApplePersistenceIgnoreState","YES","-NSSplitView Subview Frames Main","(\"0, 0, 200, 600\")","-e2e","YES"]
✓ |macos| tests-scratch/args.e2e.ts > a launch argument name with spaces is one process argument 453ms
- A Foundation binary run as
./p "-NSSplitView Subview Frames Main" '("0, 0, 200, 600")'reads the array back fromUserDefaults.standardunder that key, soNSUserDefaultsparses a spaced name. - Not run on a device: the iOS and Android rows above come from reading agent-device 0.21.43, not from a simulator or emulator launch.
- Self-review in a fresh context found one thing, now fixed: the first version also let a no-break space and other Unicode whitespace through inside a name.