Skip to content

Tests build only HeedCore and the tests; text-check reads the builds' warnings - #300

Merged
Mpdreamz merged 1 commit into
mainfrom
ci/test-builds-only
Nov 19, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
ci/test-builds-only

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

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-check then touched every source and compiled it all a second time (6 to 7 minutes).

Changes

  • mise run test runs scripts/test.sh: build HeedPackageTests, then run it. --filter and --skip-build pass through (CI's flake rerun uses --skip-build).
  • mise run check compiles the app, which the test build no longer does. AGENTS.md says to run it after touching Sources/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 dirties mise run test's incremental state. An empty or missing log fails instead of passing.
  • Job names test and build are unchanged (the release workflow waits on them).

Verified

  • Cold test-only build of HeedCore and its tests: 465 s of CPU in total (790 s wall at a load average of about 65, with other agents building). Full suite: 2961 tests pass without the app compiled; --skip-build and --filter forward through mise; the script runs under macOS's bash 3.2.
  • Mutated on purpose: interpolating an ExternalText into a String produced the warning in a real build log, and text-check failed on it. Clean, empty and missing logs behave as described. The mutation is not in the diff.
  • Not verified until this PR's CI runs: the new step timings, and that the workflow's log capture carries the warnings on a runner.

🤖 Generated with Claude Code

`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]>
@github-actions github-actions Bot added the chore Maintenance label Nov 19, 2026
@Mpdreamz
Mpdreamz merged commit 258875d into main Nov 19, 2026
5 checks passed
@Mpdreamz
Mpdreamz deleted the ci/test-builds-only branch November 19, 2026 15:24
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant