Files
orca/scripts/orca-verify-render.sh
T
Jon Chery fc94326b0e feat(P00): deprecation sweep + bash tooling gate + render contract + doc banners (v0.9 P00)
P00 — Re-architecture Foundation (deprecation/migration/test-infra/persona/docs).

Deprecation sweep (REQ-068, REQ-072, REQ-089):
- Add // Deprecated: doc comments to internal/daemon (R-001), internal/transport
  (REQ-073), internal/security/ca.go+csr.go (D-101/REQ-076), internal/engine/
  dispatcher.go+peer.go (CLI-side scheduler), internal/cli/daemon.go.
- orca daemon emits slog.Warn deprecation banner on every run (ungated); fires
  R-001 + v0.10-P05 drain-and-stop + v0.10-P14 deletion.
- orca cert and orca node join (mTLS path) emit deprecation warnings; proxmox
  SSH path (the v0.9 replacement) does not warn.
- Add --no-deprecation-warnings global flag on root command (PersistentPreRunE)
  for orca upgrade migrations.
- 12 new daemon/cert/node deprecation tests in internal/cli/daemon_test.go
  (cli coverage 81.9%, warnDeprecated 100%).
- Add DEPRECATED banners to v0.8 sections of ARCHITECTURE.md (verified the
  v0.9 supersession section + Supersession Table from prior turn are present).

Bash tooling gate (grill C-06, C-15, C-16, C-17, C-18):
- scripts/tests/test_helper.bash + example_test.bash — bats framework + helpers.
- scripts/lib/orca-log.sh — slog-compatible JSON logging to syslog (C-17).
- scripts/orca-verify-render.sh — render-contract validator skeleton (C-16).
- scripts/tests/orca-log_test.bash + orca-verify-render_test.bash — 20 bats
  tests total (happy + failure paths per C-15).
- .shellcheckrc — project shellcheck config.
- Makefile: test-bash + lint-bash targets (graceful skip if tools missing);
  wired into test + lint targets.
- internal/emit/contract.go + contract_test.go — versioned JSON render
  contract (orca.emit/v1) between Go emitters and bash appliers (C-16).
- .ciagent/BASH_CAPABILITY_MAP_v0.9.md — maps shipped internal/transport
  capabilities to bash-side equivalents or accepted drops (C-18).
- D-186 recorded in PROJECT.md: bash exempt from Go coverage gate; compensating
  control is bats + shellcheck + shfmt (C-06).

verify-reqs: 90 requirements consistent. Build/test/lint/fmt all green.
20 bats tests pass. Go tests pass. No v0.8 code deleted — only marked deprecated
(deletion deferred to v0.10-P14 per REQ-090 dual-write window).

---ci---
project: orca
phase: P00
milestone: v0.9
status: execute
---/ci---
2026-08-05 16:26:26 +00:00

76 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# orca-verify-render.sh — bash-side render-contract validator (grill C-16).
# Reads a render-bundle JSON file (one Artifact per line, or a JSON array)
# and validates each entry against the orca.emit/v1 schema.
# Exit 0 if all valid; non-zero with a structured error per failure to stderr.
# Source: scripts/lib/orca-log.sh for structured error logging (C-17).
#
# Usage: orca-verify-render.sh <bundle.json>
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=lib/orca-log.sh
. "$SCRIPT_DIR/lib/orca-log.sh"
EXPECTED_SCHEMA="orca.emit/v1"
if [ "$#" -lt 1 ]; then
orca_log_error "verify-render" "-" "failed" "missing bundle argument"
echo "usage: $0 <bundle.json>" >&2
exit 2
fi
bundle="$1"
if [ ! -f "$bundle" ]; then
orca_log_error "verify-render" "$bundle" "failed" "bundle file not found"
echo "error: bundle not found: $bundle" >&2
exit 2
fi
errors=0
total=0
# Read the bundle line-by-line. Each line should be a JSON object.
# (The Go emitter writes one Artifact per line for line-delimited parsing.)
while IFS= read -r line; do
# Skip blank lines and comments.
[ -z "$line" ] && continue
case "$line" in \#*) continue ;; esac
total=$((total + 1))
# Validate schema_version field presence and value (crude JSON grep; no jq dep).
# Check schema_version via a simple substring test.
schema_match=0
if printf '%s' "$line" | grep -q "\"schema_version\":\"$EXPECTED_SCHEMA\""; then
schema_match=1
fi
if [ "$schema_match" -eq 1 ]; then
# schema_version matches. Check kind, path, mode presence.
for field in kind path mode; do
if ! printf '%s' "$line" | grep -q "\"$field\":"; then
orca_log_error "verify-render" "$bundle" "failed" "missing field: $field"
echo "error: line $total missing field: $field" >&2
errors=$((errors + 1))
continue 2
fi
done
elif printf '%s' "$line" | grep -q '"schema_version":'; then
orca_log_error "verify-render" "$bundle" "failed" "schema_version mismatch on line $total"
echo "error: line $total schema_version mismatch (expected $EXPECTED_SCHEMA)" >&2
errors=$((errors + 1))
else
orca_log_error "verify-render" "$bundle" "failed" "missing schema_version on line $total"
echo "error: line $total missing schema_version" >&2
errors=$((errors + 1))
fi
done < "$bundle"
if [ "$errors" -gt 0 ]; then
orca_log_error "verify-render" "$bundle" "failed" "$errors of $total artifacts invalid"
echo "verify-render: $errors of $total artifacts invalid" >&2
exit 1
fi
orca_log_info "verify-render" "$bundle" "ok" ""
echo "verify-render: $total artifacts valid"
exit 0