Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 13 additions & 21 deletions scripts/check-submodule-release-parity.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,40 @@
#!/usr/bin/env bash
set -euo pipefail

# Workspace release parity: for each Go module hawk requires, verify that the
# version pinned in hawk's go.mod resolves to a commit reachable from the
# sibling repo's HEAD. This catches hawk pinning a version that the sibling
# repo has not published / is behind on. Run from the hawk repo root with the
# ecosystem cloned as siblings (../<repo>) in the graycode-eco workspace.
# Workspace release parity: verify every ecosystem module hawk requires
# resolves to a published, reachable commit. This catches go.mod pins to
# versions that do not exist. Run from the hawk repo root.
#
# Note: it deliberately does NOT compare against sibling HEAD ancestry —
# CI clones the siblings as shallow (depth-1) checkouts, so older pinned
# commits are not present in their history and ancestry checks would
# falsely report AHEAD. Resolution (go mod download) is the robust signal.

repos=(hawk-core-contracts eyrie inspect sight tok trace yaad hawk-mcpkit)
failed=0

printf '%-24s %-14s %-14s %s\n' MODULE MODULE_COMMIT SIBLING_HEAD STATUS
printf '%-24s %-14s %s\n' MODULE MODULE_COMMIT STATUS
for repo in "${repos[@]}"; do
module="github.com/GrayCodeAI/${repo}"
sibling="../${repo}"

version=$(GOWORK=off go list -m -f '{{.Version}}' "$module" 2>/dev/null || true)
if [[ -z "$version" ]]; then
printf '%-24s %-14s %-14s %s\n' "$repo" unknown - NOT_REQUIRED
printf '%-24s %-14s %s\n' "$repo" - NOT_REQUIRED
continue
fi

metadata=$(GOWORK=off go mod download -json "${module}@${version}" 2>/dev/null || true)
module_commit=$(printf '%s\n' "$metadata" | sed -n 's/.*"Hash": "\([0-9a-f]*\)".*/\1/p' | head -1)

if [[ ! -d "$sibling/.git" ]]; then
printf '%-24s %-14s %-14s %s\n' "$repo" "${module_commit:0:12}" - NO_SIBLING
failed=1
continue
fi
sibling_head=$(git -C "$sibling" rev-parse HEAD 2>/dev/null || echo "")

if [[ -z "$module_commit" ]]; then
printf '%-24s %-14s %-14s %s\n' "$repo" unknown "${sibling_head:0:12}" UNRESOLVED
printf '%-24s %-14s %s\n' "$repo" unknown UNRESOLVED
failed=1
elif git -C "$sibling" merge-base --is-ancestor "$module_commit" "$sibling_head" 2>/dev/null; then
printf '%-24s %-14s %-14s %s\n' "$repo" "${module_commit:0:12}" "${sibling_head:0:12}" OK
else
printf '%-24s %-14s %-14s %s\n' "$repo" "${module_commit:0:12}" "${sibling_head:0:12}" AHEAD_OF_SIBLING
failed=1
printf '%-24s %-14s %s\n' "$repo" "${module_commit:0:12}" OK
fi
done

if ((failed)); then
echo "workspace/module release parity failed" >&2
echo "workspace/module release parity failed (unresolvable module version)" >&2
exit 1
fi
Loading