Skip to content

Latest commit

 

History

History
105 lines (82 loc) · 4.83 KB

development.md

File metadata and controls

105 lines (82 loc) · 4.83 KB

Local development

The loop

just dev

Builds with the release-fast profile (~20s, against ~2m for release), swaps the two binaries into the Cellar that Homebrew's launchd service resolves through opt/, re-signs them, and restarts the service.

That is the whole answer to "how do I test a change." Everything else here exists because one of its steps is easy to get wrong by hand.

Why swap into the Cellar rather than run from target/

rift needs Accessibility, and macOS grants that to a binary, not to a project directory. Running ./target/release/rift directly means granting Accessibility to that path too, and then two rift builds are both permitted and it stops being obvious which one launchd started. Swapping into the path the service already uses keeps one binary, one grant, one running copy.

Why signing is not optional

TCC records the Accessibility grant against the binary's designated requirement. An ad-hoc signature (codesign -s -) leaves that requirement pinned to the cdhash, which changes on every single rebuild — so every rebuild silently loses Accessibility, and rift exits 1 in a launchd respawn loop with nothing but a line in /tmp/rift_$USER.err.log to explain itself.

Signing with a real certificate gives a stable requirement, and the grant survives rebuilds. It need not be a Developer ID: a free account's Apple Development certificate does the same job for a binary that never leaves your Mac. just uses RIFT_CODESIGN_IDENTITY if set, and otherwise the identity in the justfile.

Release builds get this when CI signs them with a certificate, which it does now: MACOS_SIGNING is signed, with the same Apple Development certificate just uses (see ci-setup.md). Under adhoc, a brew upgrade would lose the grant the same way a local ad-hoc rebuild does.

Other recipes

recipe what it does
just list everything
just dev the loop above
just install same, full release profile
just status service state, payload health, last errors
just logs tail both service logs
just sa re-inject the scripting addition (after a Dock restart or reboot)
just check what CI runs: fmt, cargo check --locked, cargo test
just fmt format only the files you changed and have not pushed
just release <version> see releasing.md

Display churn

just churn connects and disconnects a virtual display at the running rift and checks its invariants each cycle, so an unplug no longer means reaching behind the machine. See display-churn.md, and vm-harness.md for running it in a VM instead of against your own session.

When something goes wrong

rift keeps an always-on flight recorder: reproduce the bug, then rift execute trace dump <path>. A recorded trace dropped into tests/traces/ is replayed by every cargo test. See tracing.md.

Open performance findings are in performance.md; reported, unresolved problems in known-issues.md.

Formatting

The committed tree predates the current nightly rustfmt: cargo +nightly fmt --all rewrites roughly a hundred files nobody touched. just fmt formats only files you have actually changed, which is what you want in every case.

"Changed" means the files in commits you have not pushed yet, plus whatever is still in the working tree — the same set the next push's CI run will judge. Both halves matter. A file you have committed is no longer a working-tree change, so a gate that asks only git diff HEAD stops seeing it: the drift becomes invisible locally and surfaces on the push instead. That is worth knowing because just tag refuses a dirty tree, so the tree is always clean when you cut a release, which used to make the format half of just check a no-op at exactly the moment you were trusting it.

just fmt-check now says how many files it looked at, and says so when the answer is none — an empty run and a real one should never look alike.

Gotchas

  • After a reboot or a Dock restart, the scripting addition is gone from Dock's memory even though it is still installed. just sa, or let run_on_start do it. just status says which.
  • brew upgrade replaces the swapped binaries with the tap's build. Expect to grant Accessibility again, unless CI signs with the same certificate as your identity (MACOS_SIGNING=signed with the free Apple Development certificate). And the tap's build is not your working tree: re-run just install if you were testing something.
  • Two window managers at once do not fail loudly, they fight — windows oscillate as each reacts to the other's frame changes. Stop yabai and skhd before starting rift, and verify with launchctl list | grep -iE 'yabai|skhd|rift' rather than assuming.