Repository navigation
Tests build only HeedCore and the tests; text-check reads the builds' warnings - #300
Merged
Merged
Conversation
`swift test` compiled the whole package: HeedApp, MLX (Cmlx and its Metal shaders), Sparkle and the GhosttyKit link. HeedCore has no dependencies and the tests only read the app's sources as text, so none of that is needed. On CI the test step spent about 9 minutes compiling for 22 seconds of tests, and text-check then touched every source and compiled it all again for another 6 to 7. - `mise run test` is scripts/test.sh: build HeedPackageTests, then run it. `--filter` and `--skip-build` pass through. - `mise run check` compiles the app, which the test build no longer does. - text-check reads build logs instead of building: the test job's build (heed's sources touched first, so every warning shows) and the release build's, which is whole-module. Locally it builds in its own .build/text-check, so it no longer dirties the incremental state `mise run test` keeps. An empty or missing log fails rather than passing vacuously. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Nov 19, 2026
Mpdreamz
added a commit
that referenced
this pull request
Nov 19, 2026
…aches pruned (#301) Follows #300. Even with a restored `.build`, every CI run recompiled heed's own sources in full. ## Cause Swift Build rebuilds an input whose modification time changed. The inode does not matter and neither does the direction: a copy with the same content and mtime but a new inode rebuilt in 10 s (a no-op), while the same content with a fresh mtime rebuilt for 516 s, and a changed file with an *older* mtime rebuilt too. A fresh `git checkout` stamps every file with the time it ran, so main's cache never matched. ## Changes - `scripts/pin-mtimes.sh` stamps each tracked file with a time derived from its git blob id: same content, same time, on every checkout (a collision is 1 in 2^28). No history is needed, so the clone stays shallow (the repository is 1.5 GB, so a full fetch would cost more than it saves). The setup action runs it first, so the release workflow gets it too. - The test job no longer touches its sources to force every warning. `text-check` reads what the incremental build compiled: a file that did not recompile was clean when main compiled it, and a file that depends on a changed declaration (the deprecations in `Prompt.swift`) recompiles. - `scripts/prune-caches.sh` keeps each job's newest two `.build` caches after main saves one. The repository's cache allowance was full (10.38 of 10 GB, 15 caches, each run adding ~700 MB), so GitHub was evicting by least recent use. A read-only dry run of the selection keeps the newest two per job, would free about 5.8 GB, and matches no GhosttyKit, toolchain or mise cache. Both jobs get `actions: write` for it; it only runs on main. ## Verified - Locally, on the test product at the same path CI uses: after a simulated fresh checkout (every file copied to a new inode, new mtime, same content) plus the pin, the rebuild took **10 s instead of 516 s**; one changed file (`ExternalText.swift`, used widely) took **20 s**. - Not verified until it runs on CI: that the saved cache is reused on a runner. This PR's own CI is still a full build, because main's cache was saved with checkout-time mtimes. The gain shows on the next main run and on the pull request after it; I will measure that and report it. - Not covered: the release build is whole-module, so a change to `HeedCore` still recompiles it and the app in full. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Mpdreamz
added a commit
that referenced
this pull request
Nov 19, 2026
…an be listed (#302) The local half of the build-speed work (#300 and #301 are CI's). With several agents building at once, each `swift build` starts a compiler per core. The machine here (8 cores, 16 GB) sat at a load of 20 to 60 with 5 of 6 GB of swap used while four or five agents compiled. ## Changes - `scripts/slot.sh CMD...` runs a command in one of two slots shared by every worktree. A slot is a directory holding its owner's pid (no `flock` on macOS's bash 3.2). A waiter prints who is building; a killed owner's slot is taken over, including one that died before writing its pid. `HEED_BUILD_SLOTS=N` sets the count and `0` turns it off. `mise run test | check | build | bundle | bench | live`, `text-check` and `ghostty` go through it. The test run itself (about 25 s) does not take a slot. - `scripts/prune-worktree-builds.sh [DAYS]` lists worktrees whose `.build` is idle with sizes, skipping the main checkout and any worktree building right now. It deletes only with `--delete`. ## Findings that shaped it - Seeding a new worktree with a copy-on-write clone of another's `.build` does not work: the clone took 587 s and 77 build steps at a different path, a full rebuild. Swift Build ties its state to the absolute path, so there is nothing to share between worktrees and the only lever is not keeping idle ones. - This machine: 35 worktrees are idle 3 days or more and hold 90 GB of `.build` (listed, not deleted). ## Verified - `slot.sh`, with `HEED_SLOT_DIR` pointed at a scratch directory: with two slots a third job waited for one to free (6 s) and said so; the command's exit status passes through (7); after `kill -9` on both holders a new job took a slot at once; `HEED_BUILD_SLOTS=0` runs directly. `mise run test` goes through a slot (no-op build plus the filtered tests, 19 s). - Not verified: the count of 2 is a judgement for this machine, and I have not measured total throughput with several agents queued. The pid-less dead-owner path (freed after a minute) was written but not exercised. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
The test step compiled the whole package (HeedApp, MLX with its Metal shaders, Sparkle, the GhosttyKit link) for tests that need none of it: HeedCore has no dependencies and the tests only read the app's sources as text. On CI that was about 9 minutes of compiling for 22 seconds of tests, and
text-checkthen touched every source and compiled it all a second time (6 to 7 minutes).Changes
mise run testrunsscripts/test.sh: buildHeedPackageTests, then run it.--filterand--skip-buildpass through (CI's flake rerun uses--skip-build).mise run checkcompiles the app, which the test build no longer does. AGENTS.md says to run it after touchingSources/HeedApp; CI's release build still compiles it on every PR.scripts/text-check.sh LOG...scans build logs for the deprecation message and builds nothing. The test job feeds it the test build's log (HeedCore and the tests, touched first so every warning shows); the build job feeds it the release build's (whole-module, so every warning of HeedCore and the app). With no arguments it builds locally in its own.build/text-check, so it no longer dirtiesmise run test's incremental state. An empty or missing log fails instead of passing.testandbuildare unchanged (the release workflow waits on them).Verified
--skip-buildand--filterforward through mise; the script runs under macOS's bash 3.2.ExternalTextinto a String produced the warning in a real build log, andtext-checkfailed on it. Clean, empty and missing logs behave as described. The mutation is not in the diff.🤖 Generated with Claude Code