修复合并后的定向测试
移除不再符合 hydrate 锁语义的过时测试 同步视觉 Agent prompt 测试与当前资源合同
This commit is contained in:
+9
-33
@@ -1617,25 +1617,6 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
fn hold_project_lock_briefly(root: &Path, hold_millis: u64) -> std::thread::JoinHandle<()> {
|
||||
let lock_path = root.join(".agent/project.lock");
|
||||
let held = serde_json::json!({
|
||||
"commandId": "test.hold",
|
||||
"pid": std::process::id(),
|
||||
"createdAt": unix_timestamp(),
|
||||
"nonce": 0,
|
||||
});
|
||||
fs::write(
|
||||
&lock_path,
|
||||
serde_json::to_vec(&held).expect("serialize held lock"),
|
||||
)
|
||||
.expect("hold project lock");
|
||||
std::thread::spawn(move || {
|
||||
std::thread::sleep(std::time::Duration::from_millis(hold_millis));
|
||||
fs::remove_file(&lock_path).expect("release project lock");
|
||||
})
|
||||
}
|
||||
|
||||
fn v2_revision_session_fixture() -> (tempfile::TempDir, PathBuf, PlanningSessionV2) {
|
||||
let directory = tempfile::tempdir().expect("create v2 lock wait fixture");
|
||||
let root = directory.path().to_path_buf();
|
||||
@@ -1651,6 +1632,15 @@ mod tests {
|
||||
(directory, root, session)
|
||||
}
|
||||
|
||||
fn hold_project_lock_briefly(root: &Path, hold_millis: u64) -> std::thread::JoinHandle<()> {
|
||||
let lock_path = root.join(".agent/project.lock");
|
||||
fs::write(&lock_path, b"test lock").expect("hold project lock");
|
||||
std::thread::spawn(move || {
|
||||
std::thread::sleep(std::time::Duration::from_millis(hold_millis));
|
||||
fs::remove_file(&lock_path).expect("release project lock");
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn turn_start_rides_out_a_briefly_held_project_lock() {
|
||||
let (_dir, root, _session) = v2_revision_session_fixture();
|
||||
@@ -1753,18 +1743,4 @@ mod tests {
|
||||
assert_eq!(result.session.current_question, session.current_question);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hydrate_rides_out_a_briefly_held_project_lock() {
|
||||
let (_dir, root, session) = v2_revision_session_fixture();
|
||||
let holder = hold_project_lock_briefly(&root, 120);
|
||||
let hydrated = hydrate_planning_session_v2(
|
||||
root.to_string_lossy().to_string(),
|
||||
Some(session.session_id.clone()),
|
||||
)
|
||||
.expect("hydrate 必须等过瞬时锁争用")
|
||||
.expect("session");
|
||||
holder.join().expect("lock holder thread");
|
||||
assert_eq!(hydrated.session.session_id, session.session_id);
|
||||
assert_eq!(hydrated.session.status, "revision_requested");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,35 +499,7 @@ fn visual_specialist_prompts_require_real_registered_image_deliveries() {
|
||||
);
|
||||
let design_prompt =
|
||||
game_creator_agent_runtime_tool_plan_system_prompt_for_agent("design-foundation");
|
||||
for expected in [
|
||||
"文本策划只是中间结果",
|
||||
"canvas.asset_generate",
|
||||
"16:9",
|
||||
"2K",
|
||||
"assets/ui-prototype.png",
|
||||
"assetKind=ui-prototype",
|
||||
"asset.list",
|
||||
"image.inspect",
|
||||
"ui-prototype.v2",
|
||||
"informationHud",
|
||||
"gameplaySurface",
|
||||
"objectiveEntities",
|
||||
"failureRestartFlow",
|
||||
"responsiveLayout",
|
||||
"不得假设为塔防",
|
||||
"原创标题、实体、资源、目标名称与视觉语言",
|
||||
"assets/art-spec.png",
|
||||
"icon-spec",
|
||||
"referenceImageSrcs 第一项",
|
||||
"POST /api/external/v1/editor/images/generations(kind=ui-design)",
|
||||
"不得误用 POST /api/external/v1/editor/ui-designs/assets/extractions",
|
||||
"canvas.asset_generate 成功只表示候选图片已生成并登记,不等于视觉验收完成",
|
||||
"由 Runtime 在收束门内同时核对固定 owner 文档",
|
||||
"已有同路径画布资产时先核对登记",
|
||||
"检查已通过时不得重复生成或再次扣费",
|
||||
"纯场景图",
|
||||
"不得把计划写完当成 completed",
|
||||
] {
|
||||
for expected in ["根据当前玩法需求编写规格和界面建议", "canvas.asset_generate", "不要使用固定图片合同"] {
|
||||
assert!(
|
||||
design_prompt.contains(expected),
|
||||
"design visual prompt missing {expected}"
|
||||
@@ -537,14 +509,10 @@ fn visual_specialist_prompts_require_real_registered_image_deliveries() {
|
||||
let director_prompt =
|
||||
game_creator_agent_runtime_tool_plan_system_prompt_for_agent("art-director");
|
||||
for expected in [
|
||||
"assets/art-spec.png",
|
||||
"assetKind=icon-spec",
|
||||
"POST /api/external/v1/editor/images/generations(kind=spec)",
|
||||
"后续 UI 和透明图集共同引用",
|
||||
"不得用 generationInputs.artSpec JSON",
|
||||
"成功只表示固定候选已生成并登记,不等于视觉门已经通过",
|
||||
"由 Runtime 在收束时核对当前 revision",
|
||||
"缺少 resourceId 时不得提交最终回复",
|
||||
"确定原创视觉方向",
|
||||
"canvas.asset_generate",
|
||||
"根据项目实际需要选择",
|
||||
"不要假设固定图片名称、数量、素材类别或布局",
|
||||
] {
|
||||
assert!(
|
||||
director_prompt.contains(expected),
|
||||
@@ -554,28 +522,10 @@ fn visual_specialist_prompts_require_real_registered_image_deliveries() {
|
||||
|
||||
let art_prompt = game_creator_agent_runtime_tool_plan_system_prompt_for_agent("art-asset-plan");
|
||||
for expected in [
|
||||
"资产清单和美术计划只是中间结果",
|
||||
"canvas.asset_generate",
|
||||
"assets/manifest.art.json",
|
||||
"assets/art-spritesheet.png",
|
||||
"固定使用 1:1、1K",
|
||||
"assetKind=art-spritesheet",
|
||||
"用 asset.list 确认 assets/art-spec.png 已登记",
|
||||
"由 Runtime 形成 iconDescriptions",
|
||||
"权威 resourceId 作为 referenceId",
|
||||
"POST /api/external/v1/editor/icon-spritesheets/generations",
|
||||
"screenColor=auto",
|
||||
"不得回退普通生图",
|
||||
"回读 observation 与 asset.list",
|
||||
"真实 alpha",
|
||||
"warning.code=postprocess-failed-source-preserved",
|
||||
"不得登记、验收或自动重试",
|
||||
"仅 sliceWarning",
|
||||
"已有有效同路径资产时不得重复生成或扣费",
|
||||
"按项目实际需求规划和生成美术素材",
|
||||
"asset.list",
|
||||
"不得运行 game.static_smoke 或 preview.validate",
|
||||
"不得编辑 game/index.html",
|
||||
"透明证据不足时不得提交最终回复",
|
||||
"canvas.asset_generate",
|
||||
"不得套用固定图片包或固定 2x2",
|
||||
] {
|
||||
assert!(
|
||||
art_prompt.contains(expected),
|
||||
|
||||
Reference in New Issue
Block a user