feat: prepare CASAN paid PoC release package
This commit is contained in:
@@ -7,6 +7,7 @@ set -uo pipefail
|
||||
#
|
||||
# Env:
|
||||
# CASAN_CI_RUN_FRONTEND=0|1 default 1
|
||||
# CASAN_CI_RUN_CONTROL_PANEL=0|1 default 1
|
||||
# CASAN_CI_RUN_INFRA_LAB=0|1 default 0 (Docker Compose lab is optional in CI)
|
||||
# CASAN_CI_STEP_TIMEOUT_SEC default 600
|
||||
# CASAN_CI_SUITE_FILTER optional regex; run matching suite names only
|
||||
@@ -188,6 +189,17 @@ else
|
||||
skip "frontend-vitest (CASAN_CI_RUN_FRONTEND=0)"
|
||||
fi
|
||||
|
||||
if [[ "${CASAN_CI_RUN_CONTROL_PANEL:-1}" == "1" ]]; then
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
run "control-panel-tests" npm run console:test
|
||||
run "control-panel-build" npm run console:build
|
||||
else
|
||||
skip "control-panel-tests/build (npm unavailable)"
|
||||
fi
|
||||
else
|
||||
skip "control-panel-tests/build (CASAN_CI_RUN_CONTROL_PANEL=0)"
|
||||
fi
|
||||
|
||||
if [[ "${CASAN_CI_RUN_INFRA_LAB:-0}" == "1" ]]; then
|
||||
if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1; then
|
||||
run "local-prod-infra-lab" bash "$TESTS/phase-prod-infra-lab-tests.sh"
|
||||
|
||||
@@ -267,6 +267,16 @@ def extract_patch(text: str) -> str:
|
||||
return patch
|
||||
|
||||
|
||||
def validate_write_output(text: str) -> str:
|
||||
"""Fail at the producing harness when a write-intent reply is not a diff.
|
||||
|
||||
Keeping this separate from storage avoids creating an artifact before the
|
||||
reviewer has completed, while ensuring H2/H3 accurately identify a model
|
||||
that violated the required output contract.
|
||||
"""
|
||||
return extract_patch(text)
|
||||
|
||||
|
||||
def validate_and_store_patch(job_path: str, job: dict, patch: str) -> dict:
|
||||
roots = [str(value).strip("/") for value in job.get("workspace", {}).get("context_roots", [])]
|
||||
changed = []
|
||||
@@ -640,6 +650,14 @@ def run(job_path: str) -> int:
|
||||
if not allowed:
|
||||
emit(goal_id, "H4-security", "blocked", "Local worker output rejected")
|
||||
raise ValueError("local_output_security_blocked")
|
||||
if write_intent:
|
||||
try:
|
||||
validate_write_output(safe_local)
|
||||
except ValueError as error:
|
||||
reason = str(error)
|
||||
stage(job_path, "local-worker", "error", reason, job.get("local_provider", ""), local_model)
|
||||
emit(goal_id, "H2-tool", "error", "Local worker violated patch output contract", {"reason": reason})
|
||||
raise
|
||||
stage(job_path, "local-worker", "pass", "Primary solution prepared", job.get("local_provider", ""), local_model)
|
||||
update_job(job_path, local_draft=safe_local, local_usage=local_meta)
|
||||
emit(goal_id, "H2-tool", "pass", "Local solution prepared", {"provider": job.get("local_provider", ""), "model": local_model, **local_meta})
|
||||
@@ -670,10 +688,23 @@ def run(job_path: str) -> int:
|
||||
if not allowed:
|
||||
emit(goal_id, "H4-security", "blocked", "Cloud reviewer output rejected")
|
||||
raise ValueError("cloud_output_security_blocked")
|
||||
stage(job_path, "cloud-reviewer", "pass", "Independent review incorporated", reviewer_provider, reviewer_model)
|
||||
emit(goal_id, "H3-eval", "pass", "Independent review incorporated", {"provider": reviewer_provider, "model": reviewer_model, **cloud_meta})
|
||||
final_status = "completed"
|
||||
metric_status = "success"
|
||||
if write_intent:
|
||||
try:
|
||||
validate_write_output(safe_result)
|
||||
except ValueError as error:
|
||||
cloud_ok = False
|
||||
cloud_reason = f"reviewer_output_contract_invalid:{error}"
|
||||
if cloud_ok:
|
||||
stage(job_path, "cloud-reviewer", "pass", "Independent review incorporated", reviewer_provider, reviewer_model)
|
||||
emit(goal_id, "H3-eval", "pass", "Independent review incorporated", {"provider": reviewer_provider, "model": reviewer_model, **cloud_meta})
|
||||
final_status = "completed"
|
||||
metric_status = "success"
|
||||
else:
|
||||
safe_result = safe_local
|
||||
stage(job_path, "cloud-reviewer", "warning", cloud_reason, reviewer_provider, reviewer_model)
|
||||
emit(goal_id, "H3-eval", "warning", "Cloud reviewer output contract rejected; local solution retained", {"reason": cloud_reason})
|
||||
final_status = "degraded"
|
||||
metric_status = "degraded"
|
||||
else:
|
||||
safe_result = safe_local
|
||||
stage(job_path, "cloud-reviewer", "warning", cloud_reason, reviewer_provider, reviewer_model)
|
||||
|
||||
Reference in New Issue
Block a user