feat(agent): audit orchestrated runs
This commit is contained in:
@@ -135,6 +135,7 @@ FROM (
|
||||
UNION ALL SELECT 'aihr_knowledge_query_log'
|
||||
UNION ALL SELECT 'aihr_knowledge_conversation'
|
||||
UNION ALL SELECT 'aihr_knowledge_admin_audit'
|
||||
UNION ALL SELECT 'aihr_agent_run'
|
||||
UNION ALL SELECT 'aihr_learning_question'
|
||||
UNION ALL SELECT 'aihr_practice_question_feedback'
|
||||
UNION ALL SELECT 'aihr_onboard_exam'
|
||||
@@ -229,6 +230,29 @@ REMOTE
|
||||
|
||||
[[ -z "$missing_work_report_columns" ]] \
|
||||
|| fail "remote work-report schema missing required columns: $(printf '%s' "$missing_work_report_columns" | tr '\n' ', ' | sed 's/, $//')"
|
||||
local agent_schema_contract
|
||||
agent_schema_contract="$(ssh -o BatchMode=yes -o ConnectTimeout=10 "$remote_ssh" bash -s -- "$remote_db" <<'REMOTE'
|
||||
set -euo pipefail
|
||||
db="$1"
|
||||
mysql --batch --skip-column-names --connect-timeout=5 "$db" <<'SQL'
|
||||
SELECT CONCAT(
|
||||
(SELECT COUNT(*) FROM information_schema.columns
|
||||
WHERE table_schema = DATABASE() AND table_name = 'aihr_agent_run'), '|',
|
||||
(SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = DATABASE() AND table_name = 'aihr_agent_run'
|
||||
AND index_name = 'uk_aihr_agent_run'), '|',
|
||||
(SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = DATABASE() AND table_name = 'aihr_agent_run'
|
||||
AND index_name = 'idx_aihr_agent_run_user')
|
||||
);
|
||||
SQL
|
||||
REMOTE
|
||||
)" || fail "remote Agent audit schema check failed: $remote_ssh:$remote_db"
|
||||
|
||||
[[ "$agent_schema_contract" = "15|run_id|tenant_id,user_id,create_time" ]] \
|
||||
|| fail "remote Agent audit schema is invalid: got ${agent_schema_contract:-missing}"
|
||||
local missing_knowledge_category_columns
|
||||
missing_knowledge_category_columns="$(ssh -o BatchMode=yes -o ConnectTimeout=10 "$remote_ssh" bash -s -- "$remote_db" <<'REMOTE'
|
||||
set -euo pipefail
|
||||
|
||||
Reference in New Issue
Block a user