fix(aihr): scope pilot satisfaction to safe identities
This commit is contained in:
@@ -56,7 +56,7 @@ docker exec -i wygj-mysql mysql -uroot -proot --default-character-set=utf8mb4 <<
|
||||
CREATE DATABASE \`$TEST_DB\` CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
|
||||
USE \`$TEST_DB\`;
|
||||
CREATE TABLE aihr_practice_scenario (tenant_id varchar(20), position varchar(80), enabled tinyint);
|
||||
CREATE TABLE aihr_practice_session (tenant_id varchar(20), session_id varchar(100), ext_party_id varchar(100), mode varchar(30), finished_time datetime);
|
||||
CREATE TABLE aihr_practice_session (tenant_id varchar(20), session_id varchar(100), ext_party_id varchar(100), mode varchar(30), finished_time datetime, satisfaction_score tinyint);
|
||||
CREATE TABLE aihr_practice_assignment (tenant_id varchar(20), ext_party_id varchar(100), create_time datetime);
|
||||
CREATE TABLE aihr_org_snapshot (
|
||||
tenant_id varchar(20), employment_status varchar(20), ext_party_id varchar(100),
|
||||
@@ -89,20 +89,22 @@ INSERT INTO aihr_practice_assignment VALUES
|
||||
('000000','E','2026-07-08 08:00:00'),
|
||||
('000000','13900000005','2026-07-08 08:00:00'),
|
||||
('000000','F','2026-07-08 08:00:00');
|
||||
INSERT INTO aihr_practice_session
|
||||
INSERT INTO aihr_practice_session (tenant_id, session_id, ext_party_id, mode, finished_time)
|
||||
SELECT '000000', CONCAT('e-', n), CASE WHEN n <= 5 THEN 'E' ELSE '13900000005' END, 'mobile', '2026-07-08 09:00:00'
|
||||
FROM (
|
||||
SELECT 1 n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5
|
||||
UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
|
||||
) n;
|
||||
INSERT INTO aihr_practice_session
|
||||
INSERT INTO aihr_practice_session (tenant_id, session_id, ext_party_id, mode, finished_time)
|
||||
SELECT '000000', CONCAT('f-', n), 'F','mobile','2026-07-08 10:00:00' FROM (
|
||||
SELECT 1 n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5
|
||||
UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10
|
||||
) n;
|
||||
INSERT INTO aihr_practice_session VALUES
|
||||
INSERT INTO aihr_practice_session (tenant_id, session_id, ext_party_id, mode, finished_time)
|
||||
VALUES
|
||||
('000000','e-out','E','mobile','2026-07-06 10:00:00'),
|
||||
('000000','unsafe-inside','D','mobile','2026-07-08 10:00:00');
|
||||
UPDATE aihr_practice_session SET satisfaction_score = 5 WHERE finished_time >= '2026-07-07 00:00:00';
|
||||
INSERT INTO aihr_practice_calibration (tenant_id,session_id,original_score,corrected_score,create_time) VALUES
|
||||
('000000','f-1',80,82,'2026-07-08 11:00:00'),
|
||||
('000000','unsafe-inside',80,40,'2026-07-08 11:00:00'),
|
||||
@@ -123,10 +125,12 @@ pilot_output="$(AIHR_PILOT_START_DATE=2026-07-07 AIHR_PILOT_END_DATE=2026-07-10
|
||||
[[ "$pilot_output" == *'org_ten_sessions=1/2'* ]] || { echo "FAIL: formal 9/10 boundary: $pilot_output" >&2; exit 1; }
|
||||
[[ "$pilot_output" == *'calibration=1/20 consistency=1/1'* ]] || { echo "FAIL: calibration window: $pilot_output" >&2; exit 1; }
|
||||
[[ "$pilot_output" == *'sop_usable=1/1 sop_pending=1'* ]] || { echo "FAIL: SOP window: $pilot_output" >&2; exit 1; }
|
||||
[[ "$pilot_output" == *'satisfaction=5.0/5 responses=19'* ]] || { echo "FAIL: safe satisfaction identity scope: $pilot_output" >&2; exit 1; }
|
||||
|
||||
pilot_sql_scalar "INSERT INTO aihr_practice_session VALUES ('000000','e-10','13900000005','mobile','2026-07-09 09:00:00')" >/dev/null
|
||||
pilot_sql_scalar "INSERT INTO aihr_practice_session (tenant_id, session_id, ext_party_id, mode, finished_time, satisfaction_score) VALUES ('000000','e-10','13900000005','mobile','2026-07-09 09:00:00',5)" >/dev/null
|
||||
pilot_output="$(AIHR_PILOT_START_DATE=2026-07-07 AIHR_PILOT_END_DATE=2026-07-10 check_pilot_samples)"
|
||||
[[ "$pilot_output" == *'org_ten_sessions=2/2'* ]] || { echo "FAIL: formal 10/10 boundary: $pilot_output" >&2; exit 1; }
|
||||
[[ "$pilot_output" == *'satisfaction=5.0/5 responses=20'* ]] || { echo "FAIL: formal satisfaction scope after window update: $pilot_output" >&2; exit 1; }
|
||||
|
||||
if (AIHR_PILOT_STRICT=true AIHR_PILOT_START_DATE= AIHR_PILOT_END_DATE= check_pilot_samples) >/tmp/wygj-pilot-strict-test.log 2>&1; then
|
||||
echo "FAIL: strict mode accepted an implicit date window" >&2
|
||||
|
||||
Reference in New Issue
Block a user