feat(plan-01): Phase 1 — relocate harness code to packages/casan-harness (symlink facade)
Physically move the pure-code subtrees out of .specify into the package, leaving compat symlinks at the old .specify/<dir> paths so every existing reference (internal CASAN_HARNESS_ROOT + external CI/docker/mjs) keeps resolving. Runtime state stays put. Moved (git mv): scripts/ tests/ security/ templates/ config/ governance/ memory/ .specify/<dir> -> packages/casan-harness/<dir> (+ .specify/<dir> symlink) Stays in .specify (state/governance/domain, handled later): logs/ agentops/ level5/ init-options.json traceability-map.json Python `.resolve()` self-location followed the compat symlink into packages and lost the app root; generate-casan-demo-context.py, generate-agentops-dashboard.py and dashboard-server.py now walk UP for the `.specify` state marker instead of a fixed parent depth (fixes "missing trace files" in run-casan4). Full gate: PASS=64 FAIL=0 SKIP=3 (CASAN_CI_STEP_TIMEOUT_SEC=1200 — track-a ~450s runs close to the 600s default and can tip over under load; this is timing variance, not a regression — it passed cleanly with headroom). Runtime log/audit artifacts kept unstaged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
2c765c9a45
commit
664bd1f00c
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
set -uo pipefail
|
||||
|
||||
# CASAN harness preflight (Plan-15/13 enforcement wiring).
|
||||
# Runs governance cores BEFORE a model call. Currently enforces RAI data
|
||||
# governance: a prompt classified PII/confidential must not go to a CLOUD model
|
||||
# without approval. Opt-in via CASAN_PREFLIGHT=1 so existing flows are unchanged.
|
||||
#
|
||||
# Args mirror model-router: <prompt-file> <out-json> [--role R] [--model M]
|
||||
# Env: CASAN_MODEL_APPROVAL (approval token for sending sensitive data to cloud)
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROMPT="${1:-}"
|
||||
|
||||
# SEC-20 (ARCH-04/09): fail closed if the required toolchain is missing or a
|
||||
# required binary is PATH-shadowed by a planted copy (default checks only refuse on
|
||||
# missing / in-workspace binaries; prod can set CASAN_TOOLCHAIN_TRUSTED_DIRS).
|
||||
if [[ -f "$SCRIPT_DIR/toolchain-verify.sh" ]]; then
|
||||
if ! bash "$SCRIPT_DIR/toolchain-verify.sh" >/dev/null 2>&1; then
|
||||
echo "PREFLIGHT_BLOCK toolchain-verify (missing/shadowed binary)" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
MODEL=""
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--model) MODEL="${2:-}"; shift 2 ;;
|
||||
*) shift ;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$MODEL" in
|
||||
openai:*|anthropic:*)
|
||||
if [[ -n "$PROMPT" && -f "$PROMPT" ]]; then
|
||||
if ! python3 "$SCRIPT_DIR/rai-guard.py" check-cloud --input "$PROMPT" --target cloud \
|
||||
--approval "${CASAN_MODEL_APPROVAL:-}" >/dev/null 2>&1; then
|
||||
echo "PREFLIGHT_BLOCK rai-check-cloud model=$MODEL" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "PREFLIGHT_OK model=${MODEL:-local}"
|
||||
exit 0
|
||||
Reference in New Issue
Block a user