By: ananjiani <ananjiani@noreply.codeberg.org>
fix(buildbot): pin flake evaluation to checkout revision (#300)
## Problem
Cold Buildbot evaluations fail with a root flake `narHash` mismatch. The parent locks the working tree without the empty `modules/home/editors/doom-emacs` gitlink directory; the evaluator worker fetches the committed tree with that empty directory. A warm retry hides the mismatch.
## Fix
- Read `git rev-parse HEAD` on the build worker after checkout and PR merge.
- Pass `{flake_dir}?rev=<worker HEAD>#{attribute}` to nix-eval-jobs so both steps read the committed tree.
- Fail if Git fails or returns an invalid revision; never fall back to the working tree.
- Keep `got_revision` unchanged for status reports. On PR builds it names the PR head, not the synthetic merge commit.
The change is a local Buildbot patch wired in Theoden config. No cache wipe, Nix downgrade, or flake.lock change.
## Checks
- Cold isolated Git fixture: old command fails with the same hash mismatch; pinned command passes.
- Original repo: pinned command passes the root-source step; stopped before full evaluation.
- Root and subdirectory flake forms checked.
- All four Buildbot patches apply together.
- Patched package builds; 71 Python tests pass.
- Call-site test checks actual eval argv and rejects bad HEAD. Restoring the old argv makes the test fail.
- Required pre-commit Nix check and commit hooks pass.
- Independent review passes.
## Rollout
No server changes were made. After required CI passes and this PR merges, Theoden receives the patch through normal Comin deployment. CI still uses the old evaluator until that happens, so this PR can hit the old first-run failure. A retry may be needed.
Do not merge until the required `buildbot/nix-build` check passes.
Co-authored-by: Ammar Nanjiani <ammar.nanjiani@gmail.com>
Reviewed-on: https://codeberg.org/ananjiani/infra/pulls/300
Total
1m52s
| Time to Start | Worker time | Duration | Time to finish | Idle | |
|---|---|---|---|---|---|
| Config | 1s | 8s | 8s | 10s | 1s |
| Eval | 7s | 58s | 58s | 1m05s | 0s |
| Build | 1m01s | 1m16s | 53s | 1m54s | 0s |
| Suite | 1s | 2m23s | 1m52s | 1m54s | 1s |