{ "contract": "purchase-spec-resolution-v1", "schema_version": 1, "description": "Admin、Client HTTP 与 Mock 共用的脱敏采购运行时规格解析向量。", "defaults": { "client_id": "CLIENT-CONTRACT", "task_type": "purchase", "task_version": 3, "pdd_goods_id": "PDD-CONTRACT-001", "selected_color": "测试黑", "attempt_id": "attempt-contract-001", "observed_at": "2026-08-17T08:00:00Z", "ai_confidence_threshold_bps": 9000 }, "cases": [ { "name": "rule_weight_unique", "task_id": "cg-contract-rule", "target_size": "60公斤", "candidates": ["100斤", "120斤"], "candidate_snapshot_hash": "4d5cd9f3c8edcc894ef7806df7bd445718ba674b134abd55733df293f25ba23c", "idempotency_key": "spec-resolution-v1:2c84cb3ec6a934384cfe62b8b143d5def0f4cafdc86b77538f8606478bd16ba3", "mode": "rule", "model": null, "expected": { "outcome": "matched", "source": "rule", "candidate_id": "c2", "confidence_bps": 10000, "model_calls": 0 } }, { "name": "rule_traditional_simplified", "task_id": "cg-contract-traditional", "target_size": "藍 色 / XL 碼", "candidates": ["蓝色/xl码"], "candidate_snapshot_hash": "5433787fa5bc7cae41939504a221bb59cee26639e683f89506e524b0bf318202", "idempotency_key": "spec-resolution-v1:f1c239574dcbf5c8bbb12a71f21dadf874d5d0b544e4fa18b957f896295801e4", "mode": "rule", "model": null, "expected": { "outcome": "matched", "source": "rule", "candidate_id": "c1", "confidence_bps": 10000, "model_calls": 0 } }, { "name": "rule_weight_range_unique", "task_id": "cg-contract-range", "target_size": "45-55公斤", "candidates": ["70-90斤", "90-110斤", "110-130斤"], "candidate_snapshot_hash": "1b81a16f0c1efcd457311e0f229859ad7df03453f9f9ee5946a9e78f353e95b6", "idempotency_key": "spec-resolution-v1:e70666cb6141d09059c4bf9de0e755185fc1b5bd72e93c3b399e1c46507f63b6", "mode": "rule", "model": null, "expected": { "outcome": "matched", "source": "rule", "candidate_id": "c2", "confidence_bps": 10000, "model_calls": 0 } }, { "name": "rule_overlap_uncertain", "task_id": "cg-contract-overlap", "target_size": "50-60公斤", "candidates": ["90-110斤", "110-130斤"], "candidate_snapshot_hash": "1f186fc40144039ccbaf8d3fbe2bf462cb9b24af101f0f6420fb4ca55dabab72", "idempotency_key": "spec-resolution-v1:a812466f92356dccaae11e59346408fcfa5c2bccdbfcd88991647bbce955f67e", "mode": "rule", "model": null, "expected": { "outcome": "uncertain", "source": "rule", "candidate_id": null, "confidence_bps": null, "model_calls": 0 } }, { "name": "ai_whitelist_match", "task_id": "cg-contract-ai-match", "target_size": "L码", "candidates": ["M码", "XL码"], "candidate_snapshot_hash": "f634515c8a7a0ebd688fd926520405051e12c622c87a4783a05936099ecfb2fa", "idempotency_key": "spec-resolution-v1:76722c891bf2c154ec7a129f8628404042305235084c2ea11ecc696383545030", "mode": "ai", "model": { "conclusion": "match", "candidate_id": "c2", "confidence_bps": 9300, "reason": "测试模型唯一选择" }, "expected": { "outcome": "matched", "source": "ai", "candidate_id": "c2", "confidence_bps": 9300, "model_calls": 1 } }, { "name": "ai_forged_candidate", "task_id": "cg-contract-ai-forged", "target_size": "L码", "candidates": ["M码", "XL码"], "candidate_snapshot_hash": "f634515c8a7a0ebd688fd926520405051e12c622c87a4783a05936099ecfb2fa", "idempotency_key": "spec-resolution-v1:ef9c252b3df772cca63bb296492f714a340a4c3e26fe504d97a79445a4c6e1b4", "mode": "ai", "model": { "conclusion": "match", "candidate_id": "c99", "confidence_bps": 9500, "reason": "测试伪造候选" }, "expected": { "outcome": "rejected", "source": "ai", "candidate_id": null, "confidence_bps": 9500, "model_calls": 1 } }, { "name": "ai_low_confidence", "task_id": "cg-contract-ai-low", "target_size": "L码", "candidates": ["M码", "XL码"], "candidate_snapshot_hash": "f634515c8a7a0ebd688fd926520405051e12c622c87a4783a05936099ecfb2fa", "idempotency_key": "spec-resolution-v1:cd8ef7bb122d5045434bd3f49e7641ac23a3f43be5bc002fed1363276e1c7142", "mode": "ai", "model": { "conclusion": "match", "candidate_id": "c2", "confidence_bps": 7000, "reason": "测试低置信度" }, "expected": { "outcome": "uncertain", "source": "ai", "candidate_id": null, "confidence_bps": 7000, "model_calls": 1 } }, { "name": "ai_missing_dimension", "task_id": "cg-contract-ai-missing", "target_size": "L码", "candidates": ["M码", "XL码"], "candidate_snapshot_hash": "f634515c8a7a0ebd688fd926520405051e12c622c87a4783a05936099ecfb2fa", "idempotency_key": "spec-resolution-v1:6fdc71c5d80cae48c76e8fb3f152539c0b063731e47e7c49d21ff0cc4acba0f6", "mode": "ai", "model": { "conclusion": "match", "candidate_id": "c2", "confidence_bps": 9500, "reason": "测试缺少维度", "missing_dimensions": ["尺码"] }, "expected": { "outcome": "uncertain", "source": "ai", "candidate_id": null, "confidence_bps": 9500, "model_calls": 1 } }, { "name": "ai_uncertain", "task_id": "cg-contract-ai-uncertain", "target_size": "L码", "candidates": ["M码", "XL码"], "candidate_snapshot_hash": "f634515c8a7a0ebd688fd926520405051e12c622c87a4783a05936099ecfb2fa", "idempotency_key": "spec-resolution-v1:7b531267d5ba16ed9d81a7d8d7e9e8e4553776bd35d3401e2b260609c6b022fb", "mode": "ai", "model": { "conclusion": "uncertain", "confidence_bps": 8500, "reason": "测试信息不足" }, "expected": { "outcome": "uncertain", "source": "ai", "candidate_id": null, "confidence_bps": 8500, "model_calls": 1 } }, { "name": "ai_conflict", "task_id": "cg-contract-ai-conflict", "target_size": "L码", "candidates": ["M码", "XL码"], "candidate_snapshot_hash": "f634515c8a7a0ebd688fd926520405051e12c622c87a4783a05936099ecfb2fa", "idempotency_key": "spec-resolution-v1:4d6581611767a1a56a305f1b769bb651be80d0113af1827c2fa8c66e72ea14b0", "mode": "ai", "model": { "conclusion": "conflict", "confidence_bps": 9500, "reason": "测试规格维度冲突", "conflict_dimensions": ["尺码"] }, "expected": { "outcome": "rejected", "source": "ai", "candidate_id": null, "confidence_bps": 9500, "model_calls": 1 } }, { "name": "ai_invalid_format", "task_id": "cg-contract-ai-invalid", "target_size": "L码", "candidates": ["M码", "XL码"], "candidate_snapshot_hash": "f634515c8a7a0ebd688fd926520405051e12c622c87a4783a05936099ecfb2fa", "idempotency_key": "spec-resolution-v1:5a9dcc28c6dc6f8d877a93932533ca5f64e6e5d10153acf7ddb63cb6e06428de", "mode": "ai", "model": { "conclusion": "other", "confidence_bps": 9200, "reason": "测试非法结论" }, "expected": { "outcome": "failed", "source": "ai", "candidate_id": null, "confidence_bps": null, "model_calls": 1 } }, { "name": "ai_timeout", "task_id": "cg-contract-ai-timeout", "target_size": "L码", "candidates": ["M码", "XL码"], "candidate_snapshot_hash": "f634515c8a7a0ebd688fd926520405051e12c622c87a4783a05936099ecfb2fa", "idempotency_key": "spec-resolution-v1:374abeb2ec0a0dec57f2ba9c2976b9598b977de19cc1bfe1af4b23bc768af912", "mode": "ai", "model": {"error": "timeout"}, "expected": { "outcome": "failed", "source": "ai", "candidate_id": null, "confidence_bps": null, "model_calls": 1 } } ], "error_cases": [ {"name": "invalid_schema", "base_case": "rule_weight_unique", "mutation": "schema_version_2", "expected_http_status": 400, "expected_error_code": "INVALID_SPEC_RESOLUTION_SCHEMA"}, {"name": "candidate_id_gap", "base_case": "rule_weight_unique", "mutation": "candidate_id_gap", "expected_http_status": 422, "expected_error_code": "INVALID_SPEC_RESOLUTION_REQUEST"}, {"name": "snapshot_hash_mismatch", "base_case": "rule_weight_unique", "mutation": "snapshot_hash_mismatch", "expected_http_status": 422, "expected_error_code": "SPEC_RESOLUTION_HASH_MISMATCH"}, {"name": "selected_color_not_claimed", "base_case": "rule_weight_unique", "mutation": "selected_color_not_claimed", "expected_http_status": 422, "expected_error_code": "INVALID_SPEC_RESOLUTION_REQUEST"}, {"name": "target_size_not_claimed", "base_case": "rule_weight_unique", "mutation": "target_size_not_claimed", "expected_http_status": 422, "expected_error_code": "INVALID_SPEC_RESOLUTION_REQUEST"}, {"name": "observed_at_without_timezone", "base_case": "rule_weight_unique", "mutation": "observed_at_without_timezone", "expected_http_status": 422, "expected_error_code": "INVALID_SPEC_RESOLUTION_REQUEST"}, {"name": "attempt_id_too_long", "base_case": "rule_weight_unique", "mutation": "attempt_id_too_long", "expected_http_status": 422, "expected_error_code": "INVALID_SPEC_RESOLUTION_REQUEST"}, {"name": "candidate_count_101", "base_case": "rule_weight_unique", "mutation": "candidate_count_101", "expected_http_status": 422, "expected_error_code": "INVALID_SPEC_RESOLUTION_REQUEST"}, {"name": "body_too_large", "base_case": "rule_weight_unique", "mutation": "body_too_large", "expected_http_status": 400, "expected_error_code": "INVALID_BODY"}, {"name": "task_not_found", "base_case": "rule_weight_unique", "mutation": "task_not_found", "expected_http_status": 404, "expected_error_code": "TASK_NOT_FOUND"}, {"name": "task_not_purchase", "base_case": "rule_weight_unique", "mutation": "task_not_purchase", "expected_http_status": 422, "expected_error_code": "TASK_NOT_PURCHASE"}, {"name": "task_version_conflict", "base_case": "rule_weight_unique", "mutation": "task_version_conflict", "expected_http_status": 409, "expected_error_code": "TASK_VERSION_CONFLICT"}, {"name": "pdd_goods_mismatch", "base_case": "rule_weight_unique", "mutation": "pdd_goods_mismatch", "expected_http_status": 422, "expected_error_code": "PDD_GOODS_MISMATCH"}, {"name": "task_not_claimed", "base_case": "rule_weight_unique", "mutation": "task_not_claimed", "expected_http_status": 403, "expected_error_code": "TASK_NOT_CLAIMED_BY_CLIENT"}, {"name": "idempotency_conflict", "base_case": "rule_weight_unique", "mutation": "idempotency_conflict", "expected_http_status": 409, "expected_error_code": "IDEMPOTENCY_CONFLICT"} ] }