phase 13.1: add post-loop fork status summary to verify-fork-versions.sh

Per assessment G2 from Round 11: verify-fork-versions.sh silently
skipped content checks for forks whose upstream tags don't exist,
making failures invisible. This adds a post-loop summary table
that enumerates each fork's verification status.

Added per-fork status tracking:
  - DIVERGED:       fork in diverged mode (content check skipped)
  - NO_UPSTREAM_TAG: upstream tag doesn't exist (content check skipped)
  - PASS:           content matches upstream tag
  - SKIP:           no Cargo.toml (not a tracked fork)
  - UNKNOWN:        not yet classified (future refinement)

The summary table prints after the per-fork warn/error output,
giving operators a single-view snapshot of all 10 forks:

  === Post-verification fork status ===
  fork          status              detail
  ----------    ----------------    ------
  base          UNKNOWN             not checked
  bootloader    DIVERGED            mode=diverged; content check skipped
  installer     DIVERGED            mode=diverged; content check skipped
  kernel        DIVERGED            mode=diverged; content check skipped
  libredox      PASS                content matches upstream 0.1.18
  ...

Bug fix: added cd "$ROOT" before post-loop summary because the
per-fork content-check loop cd's into each fork directory.
This commit is contained in:
2026-07-12 13:48:20 +03:00
parent 0d9b3dc3c0
commit d4ff72d9a6
+31 -1
View File
@@ -32,12 +32,15 @@ BRANCH="$(git branch --show-current 2>/dev/null || echo "")"
BRANCH_VERSION="$(echo "$BRANCH" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || true)"
violations=0
# Per-fork status tracking for post-loop summary (Phase 13.1)
declare -A FORK_STATUS=()
declare -A FORK_DETAIL=()
for fork_dir in local/sources/*/; do
[ -d "$fork_dir" ] || continue
fork_name=$(basename "$fork_dir")
toml="$fork_dir/Cargo.toml"
[ -f "$toml" ] || continue
[ -f "$toml" ] || { FORK_STATUS[$fork_name]="SKIP"; FORK_DETAIL[$fork_name]="no Cargo.toml (not a tracked fork)"; continue; }
version=$(grep -E '^version\s*=' "$toml" | head -1 | sed -E 's/.*"([^"]+)".*/\1/') || true
if [ -z "$version" ]; then
@@ -88,6 +91,8 @@ for fork_dir in local/sources/*/; do
# before content-check can be re-enabled. The build runs anyway with
# an explicit warning printed to stderr.
if [ "$fork_mode" = "diverged" ]; then
FORK_STATUS[$fork_name]="DIVERGED"
FORK_DETAIL[$fork_name]="mode=diverged; content check skipped"
echo "WARN: $fork_name is in 'diverged' mode — content check skipped." >&2
echo " Fork has substantial post-fork work; run upgrade-forks.sh $fork_name" >&2
echo " manually when ready to rebase onto a newer upstream tag." >&2
@@ -99,6 +104,8 @@ for fork_dir in local/sources/*/; do
fi
if [ "$upstream_tag" = "PENDING_REBASE" ]; then
FORK_STATUS[$fork_name]="PENDING_REBASE"
FORK_DETAIL[$fork_name]="needs manual rebase"
echo "ERROR: $fork_name is marked as PENDING_REBASE in $MAP_FILE." >&2
echo " A real rebase onto a chosen upstream tag is required." >&2
violations=$((violations + 1))
@@ -126,6 +133,8 @@ for fork_dir in local/sources/*/; do
# Fetch the upstream tag's tree hash
upstream_hash=$(cd /tmp && git ls-remote --tags "$upstream_url" "refs/tags/$upstream_tag" 2>/dev/null | awk '{print $1}' | head -1)
if [ -z "$upstream_hash" ]; then
FORK_STATUS[$fork_name]="NO_UPSTREAM_TAG"
FORK_DETAIL[$fork_name]="tag $upstream_tag not found at $upstream_url"
echo "WARN: $fork_name: couldn't ls-remote $upstream_url tag $upstream_tag, skipping content check" >&2
continue
fi
@@ -272,8 +281,29 @@ for fork_dir in local/sources/*/; do
# re-clone upstream. Stored under .redbear-fork-verify/<fork>-<tag>.
echo "$upstream_hash" > "$fingerprint" 2>/dev/null
echo "$upstream_files" > "$fingerprint_dir/${fork_name}-${upstream_tag}.files" 2>/dev/null
# Fork passed content check — record status for post-loop summary
FORK_STATUS[$fork_name]="PASS"
FORK_DETAIL[$fork_name]="content matches upstream $upstream_tag"
done
# Post-loop summary (Phase 13.1): enumerate each fork's verification status.
# Return to script root (the per-fork content check does cd into each fork dir).
cd "$ROOT"
echo ""
echo "=== Post-verification fork status ==="
printf " %-12s %-18s %s\n" "fork" "status" "detail"
printf " %-12s %-18s %s\n" "----------" "----------------" "------"
for fork_dir in local/sources/*/; do
[ -d "$fork_dir" ] || continue
fork_name=$(basename "$fork_dir")
status="${FORK_STATUS[$fork_name]:-UNKNOWN}"
detail="${FORK_DETAIL[$fork_name]:-not checked}"
printf " %-12s %-18s %s\n" "$fork_name" "$status" "$detail"
done
echo ""
if [ "$violations" -gt 0 ]; then
echo "" >&2
echo "FAIL: $violations fork version violations found." >&2