fix(aihr): expose missing case schema in pilot gates

This commit is contained in:
2026-07-15 01:56:07 +08:00
parent 1f31dfd506
commit e069714b76
3 changed files with 24 additions and 6 deletions
+2
View File
@@ -1,5 +1,7 @@
# BRD 功能审查与未完成项记录
- 2026-07-15 BRD 严格门禁旧案例结构兼容修复:`scripts/demo-check.sh` 原先在 `aihr_case_record` 整表或 `learning_points/supervisor_comment` 字段缺失时直接执行查询,可能以 Unknown column/table 中断,无法输出真正的 schema 门槛;现先探测表和字段,缺失时以 `stored_cases=0`、`case_media_schema=0/2`、`case_learning_schema=0/2` 继续判定,新增旧表/无表回归。该修复只改善迁移缺口可见性,不放松案例 `20` 条和字段 `2/2` 门槛。
- 2026-07-15 BRD 内容与本地开发库对齐复核:仓库基础 SQL 和 `aihr_20260714_prompt_template_seed_mysql8.sql` 均已声明 6 个内置 Prompt,但本地 `ry-vue` 此前只执行到 5 个,导致严格门禁的 `prompt_templates=6/6` 在代码已具备时仍可能被本地库状态误导;本轮仅在本地开发库执行该幂等迁移,复核得到生活顾问启用场景 `14` 条、服务推介/增值 `1` 条、日常服务 `1` 条、住宅 SOP 附件 `5` 条、内置 Prompt `6` 条。未修改生产数据库;生产仍需正式迁移窗口和发布证据。
- 2026-07-15 当前提交 `03a691c7` 发布前只读复核:生产根站、`/h5/`、`/prod-api/auth/tenant/list` 和 `/prod-api/api/aihr/mobile/home/user` 均返回 `200`,`wygj-aihr.service` 为 `active`;线上管理端仍加载 `assets/index-B9T505HT.js`(SHA-256 `66a827a7b3e5d794ae9da54c6e2276080995614fa52f54d49f746087663f8c94`),H5 仍加载 `assets/index-CDn6TrX8.js`(SHA-256 `eecb4820f3887aceb952efe3e6f2210bab325be8b03f2813e6ec304c68b26f08`),当前本地新鲜构建分别为 `assets/index-nV05JukM.js`(SHA-256 `b25d4945c5e41a93a3b6a288d6acc1be689431e363426626753e2227f8a290dc`)和 `assets/index-9sen8HYN.js`(SHA-256 `66900a9aa00c17e04d73a2d3509c16784b1ddcfc109098751b95b4138ebe26de`);当前后端外层包 SHA-256 `289de91ee6ec58042bea5b70f795f8905f08b41abd7ec4120477d7ee5b61192c`,AIHR 模块归一化 SHA-256 `65a79f02028687d441cb0e2b1ce003ac44097498cdbaf36630bef9a29c5b6de`,线上对应模块为 `b57c06ec6da4dd0e5eef16fb96c23881b2f1f253f461eb58ec3158122f76b543`。本轮已重新构建三端并只做 GET/SSH/hash 检查,未同步静态资源、迁移生产数据库、重启服务或写入业务数据;当前仍是代码可发布、线上未追平。
+11 -6
View File
@@ -81,7 +81,7 @@ check_pilot_samples() {
[[ "$(pilot_sql_scalar "SELECT DATE('$pilot_end') IS NOT NULL")" == "1" ]] || fail "invalid AIHR_PILOT_END_DATE: $pilot_end"
[[ "$pilot_start" > "$pilot_end" ]] && fail "pilot start date must not be after end date"
local catalog_schema_count scenario_count scenario_service_promotion_count scenario_daily_service_count rubric_expected_count rubric_five_dimension_count completed_people pilot_people org_active org_phone_linked org_hire_date_linked org_pilot_people org_pilot_projects org_completed_people audio_table_count audio_upload_table_count case_media_schema_count case_learning_schema_count practice_session_schema_count daily_drill_schema_count prompt_template_count prompt_version_schema_count requester_identity_schema_count hire_date_schema_count sop_document_count case_stored_count case_unmasked_count
local catalog_schema_count scenario_count scenario_service_promotion_count scenario_daily_service_count rubric_expected_count rubric_five_dimension_count completed_people pilot_people org_active org_phone_linked org_hire_date_linked org_pilot_people org_pilot_projects org_completed_people audio_table_count audio_upload_table_count case_table_exists case_media_schema_count case_learning_schema_count practice_session_schema_count daily_drill_schema_count prompt_template_count prompt_version_schema_count requester_identity_schema_count hire_date_schema_count sop_document_count case_stored_count case_unmasked_count
local calibration_stats calibration_count calibration_matched sop_total sop_usable sop_pending satisfaction_count satisfaction_average
local org_identity_cte="
WITH active_org AS (
@@ -142,6 +142,7 @@ check_pilot_samples() {
) ready_rubrics")"
audio_table_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'aihr_practice_audio'")"
audio_upload_table_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'aihr_practice_audio_upload'")"
case_table_exists="$(pilot_sql_scalar "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'aihr_case_record'")"
case_media_schema_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'aihr_case_record' AND column_name IN ('media_oss_id','media_url')")"
case_learning_schema_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'aihr_case_record' AND column_name IN ('learning_points','supervisor_comment')")"
practice_session_schema_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'aihr_practice_session' AND column_name IN ('dim_task_completion','dim_response_timeliness','response_latency_ms','annotations_json','review_advice','incentive_point','satisfaction_score','satisfaction_comment')")"
@@ -151,12 +152,16 @@ check_pilot_samples() {
requester_identity_schema_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'aihr_sop_answer_review' AND column_name = 'requester_ext_party_id'")"
hire_date_schema_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'aihr_org_snapshot' AND column_name = 'hire_date'")"
sop_document_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_knowledge_attach WHERE tenant_id = '$pilot_tenant' AND type = 'sop' AND status = 2")"
case_stored_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_case_record WHERE tenant_id = '$pilot_tenant' AND status = '已入库'")"
local case_pii_columns="title, transcript, summary"
if (( case_learning_schema_count == 2 )); then
case_pii_columns+=", learning_points, supervisor_comment"
case_stored_count=0
case_unmasked_count=0
if (( case_table_exists == 1 )); then
case_stored_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_case_record WHERE tenant_id = '$pilot_tenant' AND status = '已入库'")"
local case_pii_columns="title, transcript, summary"
if (( case_learning_schema_count == 2 )); then
case_pii_columns+=", learning_points, supervisor_comment"
fi
case_unmasked_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_case_record WHERE tenant_id = '$pilot_tenant' AND status = '已入库' AND CONCAT_WS(' ', ${case_pii_columns}) REGEXP '1[3-9][0-9]{9}|[[:alnum:]._%+-]+@[[:alnum:].-]+\\.[[:alpha:]]{2,}|[0-9]{1,2}(栋|幢|号楼|单元)[0-9]{3,4}|[0-9]{1,2}[--][0-9]{3,4}'")"
fi
case_unmasked_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_case_record WHERE tenant_id = '$pilot_tenant' AND status = '已入库' AND CONCAT_WS(' ', ${case_pii_columns}) REGEXP '1[3-9][0-9]{9}|[[:alnum:]._%+-]+@[[:alnum:].-]+\\.[[:alpha:]]{2,}|[0-9]{1,2}(栋|幢|号楼|单元)[0-9]{3,4}|[0-9]{1,2}[--][0-9]{3,4}'")"
completed_people="$(pilot_sql_scalar "
SELECT COUNT(*)
FROM (
@@ -232,4 +232,15 @@ old_case_schema_output="$(AIHR_PILOT_START_DATE=2026-07-07 AIHR_PILOT_END_DATE=2
exit 1
}
pilot_sql_scalar "DROP TABLE aihr_case_record" >/dev/null
missing_case_table_output="$(AIHR_PILOT_START_DATE=2026-07-07 AIHR_PILOT_END_DATE=2026-07-10 check_pilot_samples)"
[[ "$missing_case_table_output" == *'stored_cases=0/20 case_unmasked=0'* ]] || {
echo "FAIL: missing case table did not remain inspectable: $missing_case_table_output" >&2
exit 1
}
[[ "$missing_case_table_output" == *'case_media_schema=0/2 case_learning_schema=0/2'* ]] || {
echo "FAIL: missing case table schema gate was not visible: $missing_case_table_output" >&2
exit 1
}
echo "PASS: demo pilot gates use a bounded window and unique formal identities"