feat: complete governed knowledge lifecycle
This commit is contained in:
@@ -269,6 +269,24 @@ FROM (
|
||||
UNION ALL SELECT 'aihr_personal_ocr_page'
|
||||
UNION ALL SELECT 'aihr_personal_export_task'
|
||||
UNION ALL SELECT 'aihr_personal_publish_request'
|
||||
UNION ALL SELECT 'aihr_knowledge_rollout_scope'
|
||||
UNION ALL SELECT 'aihr_knowledge_rollout_transition'
|
||||
UNION ALL SELECT 'aihr_review_assistance'
|
||||
UNION ALL SELECT 'aihr_review_batch'
|
||||
UNION ALL SELECT 'aihr_review_batch_item'
|
||||
UNION ALL SELECT 'aihr_knowledge_generation'
|
||||
UNION ALL SELECT 'aihr_generation_version'
|
||||
UNION ALL SELECT 'aihr_version_diff'
|
||||
UNION ALL SELECT 'aihr_version_rollback'
|
||||
UNION ALL SELECT 'aihr_deletion_request'
|
||||
UNION ALL SELECT 'aihr_reconciliation_run'
|
||||
UNION ALL SELECT 'aihr_reconciliation_issue'
|
||||
UNION ALL SELECT 'aihr_migration_run'
|
||||
UNION ALL SELECT 'aihr_migration_batch'
|
||||
UNION ALL SELECT 'aihr_migration_dead_letter'
|
||||
UNION ALL SELECT 'aihr_shadow_comparison'
|
||||
UNION ALL SELECT 'aihr_activation_gate'
|
||||
UNION ALL SELECT 'aihr_generation_activation'
|
||||
) required
|
||||
LEFT JOIN information_schema.tables actual
|
||||
ON actual.table_schema = DATABASE() AND actual.table_name = required.table_name
|
||||
@@ -838,6 +856,69 @@ REMOTE
|
||||
[[ -z "$missing_work_assistant_columns" ]] \
|
||||
|| fail "remote work-assistant schema missing required columns: $(printf '%s' "$missing_work_assistant_columns" | tr '\n' ', ' | sed 's/, $//')"
|
||||
|
||||
local missing_knowledge_lifecycle_columns
|
||||
missing_knowledge_lifecycle_columns="$(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(required.table_name, '.', required.column_name)
|
||||
FROM (
|
||||
SELECT 'aihr_data_asset' AS table_name, 'published_version_id' AS column_name
|
||||
UNION ALL SELECT 'aihr_data_asset', 'candidate_version_id'
|
||||
UNION ALL SELECT 'aihr_data_asset', 'published_time'
|
||||
UNION ALL SELECT 'aihr_data_asset', 'retention_class'
|
||||
UNION ALL SELECT 'aihr_data_asset', 'legal_hold'
|
||||
UNION ALL SELECT 'aihr_data_asset', 'delete_state'
|
||||
UNION ALL SELECT 'aihr_data_version', 'version_status'
|
||||
UNION ALL SELECT 'aihr_data_version', 'revision_of_version_id'
|
||||
UNION ALL SELECT 'aihr_data_version', 'revision_reason'
|
||||
UNION ALL SELECT 'aihr_chunk_revision', 'index_generation'
|
||||
UNION ALL SELECT 'aihr_chunk_revision', 'vector_point_id'
|
||||
UNION ALL SELECT 'aihr_index_outbox', 'index_generation'
|
||||
UNION ALL SELECT 'aihr_migration_run', 'verified_dry_run_id'
|
||||
) required
|
||||
LEFT JOIN information_schema.columns actual
|
||||
ON actual.table_schema = DATABASE()
|
||||
AND actual.table_name = required.table_name
|
||||
AND actual.column_name = required.column_name
|
||||
WHERE actual.column_name IS NULL
|
||||
ORDER BY required.table_name, required.column_name;
|
||||
SQL
|
||||
REMOTE
|
||||
)" || fail "remote knowledge-lifecycle schema check failed: $remote_ssh:$remote_db"
|
||||
|
||||
[[ -z "$missing_knowledge_lifecycle_columns" ]] \
|
||||
|| fail "remote knowledge-lifecycle schema missing required columns: $(printf '%s' "$missing_knowledge_lifecycle_columns" | tr '\n' ', ' | sed 's/, $//')"
|
||||
|
||||
local knowledge_lifecycle_index_contract
|
||||
knowledge_lifecycle_index_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(
|
||||
COALESCE((SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)
|
||||
FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'aihr_data_asset' AND index_name = 'idx_aihr_data_asset_published_version'), 'missing'), '|',
|
||||
COALESCE((SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)
|
||||
FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'aihr_data_asset' AND index_name = 'idx_aihr_data_asset_candidate_version'), 'missing'), '|',
|
||||
COALESCE((SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)
|
||||
FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'aihr_data_version' AND index_name = 'idx_aihr_data_version_status'), 'missing'), '|',
|
||||
COALESCE((SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)
|
||||
FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'aihr_chunk_revision' AND index_name = 'idx_aihr_chunk_revision_generation'), 'missing'), '|',
|
||||
COALESCE((SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)
|
||||
FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'aihr_migration_run' AND index_name = 'idx_aihr_migration_verified_dry_run'), 'missing')
|
||||
);
|
||||
SQL
|
||||
REMOTE
|
||||
)" || fail "remote knowledge-lifecycle index check failed: $remote_ssh:$remote_db"
|
||||
|
||||
[[ "$knowledge_lifecycle_index_contract" = "tenant_id,published_version_id|tenant_id,candidate_version_id|tenant_id,version_status,id|tenant_id,asset_id,version_id,index_generation|tenant_id,verified_dry_run_id" ]] \
|
||||
|| fail "remote knowledge-lifecycle index contract is invalid: got ${knowledge_lifecycle_index_contract:-missing}"
|
||||
|
||||
local media_reprocess_contract
|
||||
media_reprocess_contract="$(ssh -o BatchMode=yes -o ConnectTimeout=10 "$remote_ssh" bash -s -- "$remote_db" <<'REMOTE'
|
||||
set -euo pipefail
|
||||
@@ -865,7 +946,7 @@ REMOTE
|
||||
|
||||
[[ "$media_reprocess_contract" = "source_attach_id|tenant_id,source_attach_id,id" ]] \
|
||||
|| fail "remote media-reprocess schema is invalid: got ${media_reprocess_contract:-missing}"
|
||||
echo "remote_schema=64/64 $remote_ssh:$remote_db"
|
||||
echo "remote_schema=82/82 $remote_ssh:$remote_db"
|
||||
echo "remote_media_reprocess_contract=1/1 $remote_ssh:$remote_db"
|
||||
echo "remote_work_report_idempotency=3/3 $remote_ssh:$remote_db"
|
||||
echo "remote_learning_task_question_bank=6/6 $remote_ssh:$remote_db"
|
||||
@@ -884,6 +965,8 @@ REMOTE
|
||||
echo "remote_broadcast_attachment_contract=15/15 $remote_ssh:$remote_db"
|
||||
echo "remote_broadcast_question_context=1/1 $remote_ssh:$remote_db"
|
||||
echo "remote_work_assistant_columns=8/8 $remote_ssh:$remote_db"
|
||||
echo "remote_knowledge_lifecycle_columns=13/13 $remote_ssh:$remote_db"
|
||||
echo "remote_knowledge_lifecycle_indexes=5/5 $remote_ssh:$remote_db"
|
||||
echo "remote_personal_oss_configuration=true $remote_ssh:$remote_db"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user