| 1 | package claude |
| 2 | |
| 3 | // The arm64 build of the pinned release, for tests only. The certified |
| 4 | // runner target is linux/amd64: ExecutableSHA256 is the only pin a |
| 5 | // launcher or a release trusts, and no release ships with the one below. |
| 6 | // It is the official 2.1.312 linux-arm64 binary, as its release manifest |
| 7 | // lists it, so a test that runs the real program can run on an arm64 CI |
| 8 | // machine. |
| 9 | const ExecutableSHA256Arm64 = "dc4af28917455e009d26704b82a438353a06149e825b6cdf782908b2d28661f5" |
| 10 | |
| 11 | // ReleasePin returns the digest of the official 2.1.312 Linux binary |
| 12 | // built for goarch: the certified pin on amd64, the arm64 build's on |
| 13 | // arm64. A test hands it runtime.GOARCH to check the binary on the |
| 14 | // machine it runs on. ok is false where there is no pinned build. |
| 15 | func ReleasePin(goarch string) (pin string, ok bool) { |
| 16 | switch goarch { |
| 17 | case "amd64": |
| 18 | return ExecutableSHA256, true |
| 19 | case "arm64": |
| 20 | return ExecutableSHA256Arm64, true |
| 21 | } |
| 22 | return "", false |
| 23 | } |
| 24 | |
| 25 | // ExecutableSHA256DarwinArm64 is the official 2.1.312 darwin-arm64 |
| 26 | // binary, the one Claude Code a Mac worker runs (Mac runners spec §8.2). |
| 27 | // Read on docs-t1 on 2026-11-28 (slice F task 1, S1): the release |
| 28 | // manifest's darwin-arm64 checksum, and the sha256 of the 275988512 |
| 29 | // bytes downloaded from the official URL. The manifest is not trusted at |
| 30 | // runtime; this constant is. |
| 31 | const ExecutableSHA256DarwinArm64 = "6b5ec691195e551b02c41df9f7d723f4ea61eaa03c2df90acefe3736f1aeb620" |
| 32 | |
| 33 | // ReleasePinFor returns the digest of the official 2.1.312 binary for |
| 34 | // goos/goarch: the certified linux/amd64 pin, the linux/arm64 test pin, |
| 35 | // and darwin/arm64's. ok is false everywhere else, darwin/amd64 |
| 36 | // included: a Mac worker runs only the darwin/arm64 build. |
| 37 | func ReleasePinFor(goos, goarch string) (pin string, ok bool) { |
| 38 | switch goos { |
| 39 | case "linux": |
| 40 | return ReleasePin(goarch) |
| 41 | case "darwin": |
| 42 | if goarch == "arm64" { |
| 43 | return ExecutableSHA256DarwinArm64, true |
| 44 | } |
| 45 | } |
| 46 | return "", false |
| 47 | } |
| 48 | |