refactor(Scripts): migrate risky developer tooling to Swift - #234
Open
kyleve wants to merge 15 commits into
Open
refactor(Scripts): migrate risky developer tooling to Swift#234kyleve wants to merge 15 commits into
kyleve wants to merge 15 commits into
Conversation
Add the independent macOS Tools package with typed process infrastructure and a tested xcstrings port. Pin ArgumentParser, Subprocess, and ShellCheck; wire package and shell tests into CI; and credit the new development dependencies.
Replace the 437-line shell implementation with the Stuff tools command. Decode simctl JSON into typed models, preserve the legacy registry, serialize checkout creation with bounded stale-lock recovery, and restrict deletion to exact owned targets. Add dry runs for delete and recreate plus hermetic coverage for ambiguity, interruption, pruning, and ownership.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Toolspackage with a thinstuffexecutable and a directly testedStuffToolCorelibrary../xcstrings,./simulator,./test,./profile,./flaky,./icons,./Where/install, and./Ledger/installpaths as compatibility shims while moving their substantive orchestration to Swift.mainCI topology: iOS and the complete serial snapshot suite run on CircleCI M4 Pro workers, and the retired snapshot-shard map, balancer, report generation, and CLI flags are removed from both legacy and Swift tooling.Why
Roughly 2,300 lines of shell and embedded Python controlled the highest-risk Xcode, result-bundle, simulator, and deletion workflows with little direct coverage. A bounded SwiftPM migration gives those macOS-only workflows typed inputs and hermetic orchestration tests without forcing language purity onto structured, Linux-capable tools that were already healthy.
Changes
Swift tooling package
2.CommandRunning; tests cover streaming volume, stream ordering, non-UTF-8 bytes, signals, cancellation, handler failure, environment, working directory, stdin, and non-zero status./Applications.Xcode and simulator orchestration
test,profile, andflaky.testderives affected bundles from Tuist JSON plusswift package dump-package, runs snapshot scope as the complete unfilteredStuffSnapshotTestsscheme, preserves progress reporting, and treats a successful zero-test process as failure.SNAPSHOT_SETTLE_TIMEOUT_MULTIPLIER, and keep cached test/image progress counters consistently labeled.profileandflakyretain their separate semantics over shared xcresult and process infrastructure; profile keeps capture-phase timings but no longer writes shard-balancer input.Mutating workflows
devicectldecoding and exact physical-device selection, surfaces signing-team lookup failures, and treats confirmation EOF as cancellation before installation.--dry-runmodes perform no mutation for icons, simulator deletion, and both installers.Retained-language hardening
tla-checkis now bootstrap/discovery shell around importable, Java-free-testedTools/tla_check.pybehavior.sync-agentsare require-safe and tested against temporary repositories; the sync test also guards one-pass.gitignoremirroring.Design decisions
#!/usr/bin/swiftscripts and SwiftPM command plugins remain rejected: the former preserve cold-start and testability costs, while the latter do not fit DerivedData, simulator, device, network, and/Applicationsaccess.Review focus
CommandRunner.RepositoryGraph,TestRunPlan, andTestService.Compatibility
Public root command paths, help follow-ups, usage exit policies, supported defaults, and non-sharding flags remain stable;
--dry-runis additive. The retired--snapshot-shardand--timing-reportoptions disappear together with main's shard map and balancer. Linux setup remains independent of the macOS Tools package for its supported formatting, shell lint, and agent-sync workflows.Backlog reconciliation
The bounded Swift tooling migration moved from the open P2 list to Completed issues after all migration phases, embedded-Python extraction, and retained-tool regression coverage passed.
Testing
swift test --package-path Tools— 118 tests in 42 suites passed after merging main.python3 -m unittest discover -s Tools/Tests -p 'test_*.py'— 6 retained Python tests passed after shard-tool removal.ruby Where/Tools/Tests/upgrade_backup_test.rb— 7 tests / 17 assertions passed../test StuffCoreTests— backup regression plus 1 selected iOS test passed through the public shim after merging main../test --help, invalid./testusage (status 1), and invalid./Ledger/installusage (status 2) matched their public contracts../profile --skip-clean --no-snapshots— live profile run passed../flaky --suite-runs 1 --iterations 2 --no-update— 1,964 tests completed with no suspects../icons --list, add dry run, and remove dry run passed../Where/install --dry-run --cloudkit --device "Probe Phone"passed without signing or device access../Ledger/install --dry-run --no-openpassed without build, process, filesystem, or launch work.ruby Where/RegionKit/Tools/generate-regions.rbreproduced all committed resources without a diff.git lfs ls-files --jsonreported zero unresolved snapshot PNG references../swiftformat --lint./shellcheck./xcstrings --lint— 7 catalogs matched Xcode serialization../attribution --check— 13 credits up to date../sync-agents