Skip to content

Commit df99a3a

Browse files
authored
chore: deploy-audit cleanup — drop fictional binary scaffolding, fix version embed (#19)
A deploy-readiness audit on the hawk-eco set surfaced several files in this repo that referenced a `yaad` binary, a Homebrew bottle, and a Docker image — none of which yaad actually produces. yaad is a Go library (no `cmd/`, no `package main`, no goreleaser config). All four are removed and the runtime version constant is wired up correctly. Removed ------- - install.sh — fetched `yaad_${OS}_${ARCH}` from GitHub Releases and invoked `yaad auto`. No binary exists, no goreleaser is configured to build one, and there is no `auto` subcommand. Following this script would always fail. - Formula/yaad.rb — Homebrew formula pointed at `releases/download/v0.2.0/yaad_<os>_<arch>` artifacts that have never been published, ran `yaad --version` against an absent binary, and was still pinned at `0.2.0` while the rest of the repo had re-baselined to `0.1.0` (CHANGELOG explicitly claimed it had been rebaselined — it had not). Will return once a binary actually ships. - deploy/docker/docker-compose.yml + .dockerignore — `dockerfile: Dockerfile` with context `../../`; no Dockerfile is present anywhere in the repo. `docker compose build` would fail on first invocation. Consumers wire `internal/server.RESTServer` into their own daemons, or use `hawk daemon` which embeds yaad. - deploy/ directory — removed (empty after the compose file went away). Fixed ----- - internal/version/version.go: `Version` is now populated at compile time via `go:embed` from the new `internal/version/VERSION` file (kept in sync with the root VERSION via `make sync-version`). Previously hard-coded to `"dev"` and only overrideable through ldflags — but yaad has no build path that sets those ldflags, so every `go build` / `go install` / `go get` reported `dev` regardless of the VERSION file. Matches the pattern eyrie + tok already use. - Makefile: documents the go:embed pattern in the versioning comment and adds a `make sync-version` target that copies root VERSION into internal/version/VERSION. - CHANGELOG.md: dropped the (false) claim that Formula/yaad.rb was rebaselined; documents the removal of install.sh / Formula / deploy/docker; documents the version.go embed switch. Pinned ------ - .github/workflows/ci.yml: deadcode pinned to v0.30.0 (was `@latest`). Matches eyrie + hawk and gives reproducible CI. Validation ---------- - go build ./... — clean - go vet ./... — clean - gofumpt -l . / goimports -l . — clean - golangci-lint run --timeout=5m — 0 issues - go test ./internal/version/... -v — all 5 tests PASS - go test ./... -short — all 33 packages PASS - govulncheck ./... — no vulnerabilities
1 parent d76ee40 commit df99a3a

9 files changed

Lines changed: 61 additions & 148 deletions

File tree

.dockerignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ jobs:
166166
run: git clone --depth=1 https://github.com/GrayCodeAI/tok.git ../tok
167167
- name: deadcode
168168
run: |
169-
go install golang.org/x/tools/cmd/deadcode@latest
169+
go install golang.org/x/tools/cmd/deadcode@v0.30.0
170170
deadcode ./... 2>&1 | head -50
171171
172172
# -------------------------------------------------------------------------

CHANGELOG.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Changed
1111
- **Version re-baselined to `0.1.0`** across `internal/server/mcp.go`
1212
(advertised MCP server version), `sdk/python/pyproject.toml`,
13-
`sdk/typescript/package.json`, `Formula/yaad.rb` (formula `version`
14-
+ every release-asset URL), and `openapi.yaml` (header `version` and
15-
the `/yaad/health` example). Aligns yaad with the rest of the
13+
`sdk/typescript/package.json`, and `api/openapi.yaml` (header `version`
14+
and the `/yaad/health` example). Aligns yaad with the rest of the
1615
hawk-eco ecosystem (`hawk`, `tok`, `eyrie`, `sight`, `inspect`).
16+
- **`internal/version`**: `Version` is now read at compile time via
17+
`go:embed` from `internal/version/VERSION` (kept in sync with the root
18+
`VERSION` via `make sync-version`). Previously hard-coded to `"dev"`
19+
and only overrideable through ldflags that no build path was actually
20+
setting — so every build reported `dev` regardless of the VERSION
21+
file. Pure `go build` / `go install` / `go get` now report the
22+
correct version with zero ldflags wiring required.
23+
24+
### Removed
25+
- **`install.sh`** — fetched `yaad_${OS}_${ARCH}` from GitHub Releases and
26+
ran `yaad auto`. yaad is library-only (no `cmd/`, no `package main`, no
27+
goreleaser config); there is no such binary or subcommand.
28+
- **`Formula/yaad.rb`** — Homebrew formula pointed at
29+
`releases/download/v0.2.0/yaad_<os>_<arch>` artifacts that have never
30+
been published, ran `yaad --version` against a binary that does not
31+
exist, and was still pinned at `0.2.0` while the rest of the repo
32+
re-baselined to `0.1.0`. Will return once a binary actually ships.
33+
- **`deploy/docker/docker-compose.yml`** + **`.dockerignore`**
34+
referenced a `Dockerfile` that does not exist in the repo. yaad is a
35+
library; consumers wire `internal/server/RESTServer` into their own
36+
daemons (or use `hawk daemon`).
1737

1838
### Security
1939
- **Stop tracking `.yaad/integrity.key`** — this is a per-installation

Formula/yaad.rb

Lines changed: 0 additions & 36 deletions
This file was deleted.

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ NAME := yaad
88

99
# ---------------------------------------------------------------------------
1010
# Versioning — sourced from VERSION file; falls back to git describe.
11-
# See https://github.com/GrayCodeAI/hawk/blob/main/VERSIONING.md.
11+
# See https://github.com/GrayCodeAI/hawk/blob/main/docs/versioning.md.
1212
# yaad is library-only: it ships no binary, so there is no goreleaser config
13-
# and no ldflags to inject. VERSION is exposed only via `make version`.
13+
# and no ldflags to inject the version. The runtime `version.Version`
14+
# constant is read at compile time via `go:embed` from
15+
# `internal/version/VERSION` (kept in sync with the root VERSION via
16+
# `make sync-version`). `make version` just echoes what `go:embed` will see.
1417
# ---------------------------------------------------------------------------
1518
VERSION ?= $(shell cat VERSION 2>/dev/null | head -n1 | tr -d '[:space:]' || git describe --tags --always --dirty 2>/dev/null || echo "dev")
1619
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
@@ -29,7 +32,7 @@ GOVULNCHECK := $(GOBIN_DIR)/govulncheck
2932
# Phony declarations (alphabetical).
3033
# ---------------------------------------------------------------------------
3134
.PHONY: all bench build ci clean cover fmt help lint lint-fix \
32-
security test test-10x test-race tidy version vet
35+
security sync-version test test-10x test-race tidy version vet
3336

3437
# ---------------------------------------------------------------------------
3538
# Default target.
@@ -91,6 +94,10 @@ tidy: ## Tidy go.mod / go.sum.
9194
go mod tidy
9295
go mod verify
9396

97+
sync-version: ## Copy root VERSION into internal/version/VERSION (kept in sync for go:embed).
98+
@cp VERSION internal/version/VERSION
99+
@echo "internal/version/VERSION updated to $$(cat VERSION)"
100+
94101
# ---------------------------------------------------------------------------
95102
# Composite gate used by CI and pre-push.
96103
# ---------------------------------------------------------------------------

deploy/docker/docker-compose.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

install.sh

Lines changed: 0 additions & 58 deletions
This file was deleted.

internal/version/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

internal/version/version.go

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,43 @@
1-
// Package version provides the canonical version string for the yaad binary.
1+
// Package version provides the canonical version string for yaad.
22
//
3-
// Single source of truth: the VERSION file at the repo root. To bump the
4-
// version, edit that one file. Both build paths read it and inject these vars
5-
// at build time via ldflags (the package path and var names below must match
6-
// in all callers — Makefile and .goreleaser.yml):
3+
// Single source of truth: the VERSION file at the repo root, which is
4+
// kept in sync with the co-located internal/version/VERSION via the
5+
// `make tidy` target (or `release-please`, which bumps both atomically).
76
//
8-
// go build -ldflags " \
9-
// -X github.com/GrayCodeAI/yaad/internal/version.Version=$(cat VERSION) \
10-
// -X github.com/GrayCodeAI/yaad/internal/version.Commit=$(git rev-parse --short HEAD) \
11-
// -X github.com/GrayCodeAI/yaad/internal/version.Date=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
7+
// The co-located VERSION file is embedded at compile time via `go:embed`,
8+
// so `go build`, `go install`, and `go get` all see the correct version
9+
// with zero ldflags wiring required. Release builds (goreleaser, or
10+
// `make build` if a binary is ever added) may additionally inject a
11+
// short commit + build date through ldflags:
1212
//
13-
// - `make build` reads VERSION (see the Makefile's VERSION/LDFLAGS).
14-
// - Goreleaser injects {{.Version}} from the git tag during release builds.
13+
// go build -ldflags " \
14+
// -X github.com/GrayCodeAI/yaad/internal/version.Commit=$(git rev-parse --short HEAD) \
15+
// -X github.com/GrayCodeAI/yaad/internal/version.Date=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
1516
//
16-
// The defaults below ("dev", "none", "unknown") apply only to local builds
17-
// without ldflags so a fresh `go build` still produces a runnable binary.
17+
// Do NOT edit Version directly — bump the root VERSION file and resync
18+
// the co-located one (or let release-please/goreleaser do it).
1819
package version
1920

2021
import (
22+
_ "embed"
2123
"fmt"
2224
"runtime"
25+
"strings"
2326
)
2427

25-
// Version is the current version of yaad. Set via ldflags at release time.
26-
var Version = "dev"
28+
//go:embed VERSION
29+
var versionFile string
2730

28-
// Commit is the git commit short SHA. Set via ldflags at release time.
31+
// Version is the current version of yaad, embedded from the VERSION file
32+
// at compile time.
33+
var Version = strings.TrimSpace(versionFile)
34+
35+
// Commit is the git commit short SHA. Set via ldflags at release time;
36+
// defaults to "none" for plain `go build`.
2937
var Commit = "none"
3038

31-
// Date is the build date in RFC3339. Set via ldflags at release time.
39+
// Date is the build date in RFC3339. Set via ldflags at release time;
40+
// defaults to "unknown" for plain `go build`.
3241
var Date = "unknown"
3342

3443
// String returns just the version string (kept for backwards compatibility

0 commit comments

Comments
 (0)