-- B10公开输入与答案分区封存;muse_app不能访问evaluation/oracle。 CREATE TABLE evaluation.muse_dataset_version ( version_id uuid PRIMARY KEY, dataset_id text NOT NULL, revision bigint NOT NULL CHECK(revision>0), public_manifest jsonb NOT NULL CHECK(jsonb_typeof(public_manifest)='object'), public_hash text NOT NULL CHECK(public_hash ~ '^[0-9a-f]{64}$'), created_at timestamptz NOT NULL DEFAULT clock_timestamp(), UNIQUE(dataset_id,revision) ); CREATE TABLE oracle.muse_dataset_answers ( version_id uuid PRIMARY KEY REFERENCES evaluation.muse_dataset_version(version_id), answers jsonb NOT NULL CHECK(jsonb_typeof(answers)='array'), answer_hash text NOT NULL CHECK(answer_hash ~ '^[0-9a-f]{64}$') ); -- 发布资料由维护入口写;评测角色只能读取封存输入,不修改样本与分割。 REVOKE INSERT,UPDATE,DELETE,TRUNCATE ON evaluation.muse_dataset_version FROM muse_eval; CREATE TABLE evaluation.muse_experiment ( experiment_id uuid PRIMARY KEY, author_id text NOT NULL, command_id text NOT NULL, request_hash text NOT NULL CHECK(request_hash ~ '^[0-9a-f]{64}$'), dataset_version_id uuid NOT NULL REFERENCES evaluation.muse_dataset_version(version_id), conditions jsonb NOT NULL CHECK(jsonb_typeof(conditions)='object'), conditions_hash text NOT NULL CHECK(conditions_hash ~ '^[0-9a-f]{64}$'), sample_ids jsonb NOT NULL CHECK(jsonb_typeof(sample_ids)='array' AND jsonb_array_length(sample_ids)>0), created_at timestamptz NOT NULL DEFAULT clock_timestamp(), UNIQUE(author_id,command_id) ); CREATE TABLE oracle.muse_blind_assignment ( assignment_id uuid PRIMARY KEY, experiment_id uuid NOT NULL REFERENCES evaluation.muse_experiment(experiment_id), sample_id text NOT NULL, arm_order jsonb NOT NULL CHECK(jsonb_typeof(arm_order)='array'), UNIQUE(experiment_id,sample_id) ); -- 编排可追加匿名映射,不增加答案写权限或映射更新权限。 GRANT INSERT ON oracle.muse_blind_assignment TO muse_eval; CREATE TRIGGER dataset_history_guard BEFORE UPDATE OR DELETE ON evaluation.muse_dataset_version FOR EACH ROW EXECUTE FUNCTION public.muse_guard_literary_history(); CREATE TRIGGER answer_history_guard BEFORE UPDATE OR DELETE ON oracle.muse_dataset_answers FOR EACH ROW EXECUTE FUNCTION public.muse_guard_literary_history(); CREATE TRIGGER experiment_history_guard BEFORE UPDATE OR DELETE ON evaluation.muse_experiment FOR EACH ROW EXECUTE FUNCTION public.muse_guard_literary_history(); CREATE TRIGGER assignment_history_guard BEFORE UPDATE OR DELETE ON oracle.muse_blind_assignment FOR EACH ROW EXECUTE FUNCTION public.muse_guard_literary_history();