From df06ee003a4d24ce48c493f6807db1395c93b229 Mon Sep 17 00:00:00 2001 From: Linghong Date: Wed, 23 Sep 2026 14:52:14 +0000 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E7=B4=A7=E6=B5=8B=E8=AF=95=E4=B8=8E?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=BC=96=E8=AF=91=E8=BE=B9=E7=95=8C=E5=B9=B6?= =?UTF-8?q?=E6=B8=85=E7=90=86=E5=86=97=E4=BD=99=E6=B5=8B=E8=AF=95=E5=8C=85?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将十五条重导出诊断对应的测试出口限定编译范围并删除无消费者导出 将Provider交接故障注入结果及传递分支限定为测试编译 删除计数快照和旧回复流ready包装,保留有效测试断言 将项目目录句柄方法限定为Unix平台 更新二十条警告的处理记录,注明未重新编译验证数量 --- .../src-tauri/src/agent/generation.rs | 14 ++++---- .../src-tauri/src/agent/runtime_actions.rs | 14 ++++---- .../runtime_actions/context_compaction.rs | 6 +++- .../runtime_actions/provider_final_reply.rs | 2 ++ .../runtime_actions/provider_tool_plan.rs | 2 ++ .../agent/runtime_actions/response_stream.rs | 13 -------- .../runtime_actions/response_stream_tests.rs | 21 ++---------- .../src-tauri/src/agent/runtime_driver.rs | 24 ++++++++------ .../src/agent/runtime_driver/main_loop.rs | 2 ++ .../src/agent/runtime_driver/task_queue.rs | 1 + .../src-tauri/src/agent/runtime_protocol.rs | 18 +++++++---- .../src/agent/runtime_protocol/models.rs | 5 +++ .../src-tauri/src/analytics/store.rs | 19 ----------- .../src-tauri/src/analytics/store_tests.rs | 4 +-- .../src-tauri/src/browser.rs | 1 + .../src-tauri/src/browser/playtest/mod.rs | 18 +++++++---- .../src-tauri/src/runner/state.rs | 1 + .../src-tauri/src/tool_plan_handoff.rs | 7 ++-- ...解决】主要构建入口编译警告清单-2026-09-23.md | 32 ++++++++++++++++++- 19 files changed, 107 insertions(+), 97 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/generation.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/generation.rs index f4be82c32..c5642cca8 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/generation.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/generation.rs @@ -13,6 +13,8 @@ mod run_lifecycle; mod tests; mod trace; +#[cfg(test)] +pub(crate) use canvas_generation::submit_external_generation_request; pub(in crate::agent) use canvas_generation::{ admit_platform_art_generation_at, commit_prepared_platform_art_asset_at, commit_prepared_platform_art_asset_strict_slices_at, generate_admitted_platform_art_asset_at, @@ -26,14 +28,10 @@ pub(in crate::agent) use canvas_generation::{ validate_platform_art_png_bytes_with_limits, AdmittedPlatformArtGeneration, }; pub(crate) use canvas_generation::{ - classify_external_generation_initial_response, external_canvas_placeholder, - external_editor_json_request, external_editor_response_data, external_generation_poll_after_ms, - external_generation_result_has_download_reference, - external_generation_submit_rejection_is_definitive, - platform_art_generation_error_needs_reconciliation, prepare_external_canvas_generation_context, - resolve_canvas_resource_download_with_access, submit_external_generation_request, - wait_for_external_generation_result_with_access, ExternalCanvasGenerationContext, - ExternalGenerationInitialResponse, + external_canvas_placeholder, external_editor_json_request, external_editor_response_data, + external_generation_poll_after_ms, platform_art_generation_error_needs_reconciliation, + prepare_external_canvas_generation_context, resolve_canvas_resource_download_with_access, + ExternalCanvasGenerationContext, }; pub(in crate::agent) use draft_validation::validate_closed_game_script_blocks; pub(crate) use external_generation_state::{ diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions.rs index a8140eb40..a8d5d0854 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions.rs @@ -58,9 +58,10 @@ pub(crate) use action_audit::{ append_agent_runtime_action_receipt_with_project_revision_before, append_agent_runtime_tool_call_record, AgentRuntimeToolPolicyBlock, }; +#[cfg(test)] +pub(crate) use action_execution::execute_game_creator_agent_runtime_tool_action_with_action_id; pub(crate) use action_execution::{ execute_game_creator_agent_runtime_tool_action, - execute_game_creator_agent_runtime_tool_action_with_action_id, execute_game_creator_agent_runtime_tool_action_with_pending_action, }; pub(crate) use action_projection::mark_game_creator_agent_runtime_auto_action_executing_if_current; @@ -73,10 +74,11 @@ pub(crate) use autonomous_policy::{ validate_agent_runtime_autonomous_source_payload, AgentRuntimeAutonomousSourcePayloadStats, }; pub(crate) use context_compaction::compact_game_creator_agent_runtime_session_at; +#[cfg(test)] +pub(crate) use parallel_ledger::game_creator_agent_runtime_parallel_read_batch_path; pub(crate) use parallel_ledger::{ agent_runtime_confirmation_path_component, agent_runtime_parallel_read_batch_len, agent_runtime_tool_allowed_for_agent, agent_runtime_tool_is_parallel_safe_read, - game_creator_agent_runtime_parallel_read_batch_path, game_creator_agent_runtime_pending_tool_action_path, game_creator_agent_runtime_provider_action_batch_path, }; @@ -97,20 +99,20 @@ pub(crate) use project_gates::{ acquire_game_creator_agent_provider_plan_project_write_lock_with_wait, acquire_game_creator_agent_runtime_project_write_lock_with_wait, advance_agent_runtime_project_revision_locked, - agent_runtime_observation_advances_project_revision, agent_runtime_tool_requires_pending_revision_gate, begin_agent_runtime_project_verification_locked, clear_agent_runtime_failed_playtest_at, finish_agent_runtime_project_verification_locked, invalidate_agent_runtime_project_verification_after_preview_failure_at, is_agent_runtime_project_mutation_observation, isolated_join_completion_blocker_at, prepare_agent_runtime_project_mutation_locked, process_session_completion_blocker_at, - project_verification_completion_blocker, project_verification_completion_blocker_at, - static_delegate_completion_blocker_at, structured_plan_completion_blocker, - validate_agent_runtime_pending_verification_gate_before, + project_verification_completion_blocker_at, static_delegate_completion_blocker_at, + structured_plan_completion_blocker, validate_agent_runtime_pending_verification_gate_before, }; #[cfg(test)] pub(crate) use project_gates::{ + agent_runtime_observation_advances_project_revision, ensure_current_autonomous_ready_child_mutation_at_locked, + project_verification_completion_blocker, supervisor_collaboration_policy_completion_blocker_for_test_at, supervisor_orchestrator_mutation_block_after_dispatch_for_test, }; diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/context_compaction.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/context_compaction.rs index 33788355e..8e4005452 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/context_compaction.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/context_compaction.rs @@ -123,6 +123,7 @@ pub(in crate::agent) async fn compact_game_creator_agent_runtime_context_at( AgentRuntimePersistedProviderRequestOutcome::Waiting(record) => { return Ok(AgentRuntimeContextCompactionOutcome::Waiting(record)); } + #[cfg(test)] AgentRuntimePersistedProviderRequestOutcome::HandoffPrepared => { return Ok(AgentRuntimeContextCompactionOutcome::HandoffPrepared); } @@ -341,8 +342,11 @@ pub(crate) async fn compact_game_creator_agent_runtime_session_at( AgentRuntimeContextCompactionOutcome::Completed(None) => { return Err("手动上下文压缩被新的控制指令中断".to_string()); } + #[cfg(test)] + AgentRuntimeContextCompactionOutcome::HandoffPrepared => { + return Err("手动上下文压缩不应进入后台 Provider 重试等待".to_string()); + } AgentRuntimeContextCompactionOutcome::Waiting(_) - | AgentRuntimeContextCompactionOutcome::HandoffPrepared | AgentRuntimeContextCompactionOutcome::Superseded => { return Err("手动上下文压缩不应进入后台 Provider 重试等待".to_string()); } diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_final_reply.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_final_reply.rs index dccc07ae8..4985e8f2d 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_final_reply.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_final_reply.rs @@ -69,6 +69,7 @@ pub(in crate::agent) async fn request_game_creator_agent_background_final_reply_ AgentRuntimeContextCompactionOutcome::Waiting(record) => { return Ok(RequestedAgentRuntimeFinalReplyOutcome::Waiting(record)); } + #[cfg(test)] AgentRuntimeContextCompactionOutcome::HandoffPrepared => { return Ok(RequestedAgentRuntimeFinalReplyOutcome::HandoffPrepared); } @@ -278,6 +279,7 @@ pub(in crate::agent) async fn request_game_creator_agent_background_final_reply_ AgentRuntimePersistedProviderRequestOutcome::Waiting(record) => { return Ok(RequestedAgentRuntimeFinalReplyOutcome::Waiting(record)); } + #[cfg(test)] AgentRuntimePersistedProviderRequestOutcome::HandoffPrepared => { return Ok(RequestedAgentRuntimeFinalReplyOutcome::HandoffPrepared); } diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_tool_plan.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_tool_plan.rs index 08cfc9841..7d158612d 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_tool_plan.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_tool_plan.rs @@ -268,6 +268,7 @@ pub(in crate::agent) async fn request_game_creator_agent_background_tool_plan_at AgentRuntimeContextCompactionOutcome::Waiting(record) => { return Ok(RequestedAgentRuntimeToolPlanOutcome::Waiting(record)); } + #[cfg(test)] AgentRuntimeContextCompactionOutcome::HandoffPrepared => { return Ok(RequestedAgentRuntimeToolPlanOutcome::HandoffPrepared); } @@ -423,6 +424,7 @@ pub(in crate::agent) async fn request_game_creator_agent_background_tool_plan_at AgentRuntimePersistedProviderRequestOutcome::Waiting(record) => { return Ok(RequestedAgentRuntimeToolPlanOutcome::Waiting(record)); } + #[cfg(test)] AgentRuntimePersistedProviderRequestOutcome::HandoffPrepared => { return Ok(RequestedAgentRuntimeToolPlanOutcome::HandoffPrepared); } diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/response_stream.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/response_stream.rs index 823db66b3..82421ac5c 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/response_stream.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/response_stream.rs @@ -219,19 +219,6 @@ impl AgentRuntimeResponseStreamPublisher { } } - pub(super) fn ready(&mut self, response: &str, finish_reason: Option<&str>) { - if response.trim().is_empty() - || response.chars().count() > AGENT_RUNTIME_RESPONSE_STREAM_MAX_CHARS - { - self.finish_with_status(AGENT_RUNTIME_RESPONSE_STREAM_STATUS_FAILED); - return; - } - self.stream.accumulated_text = response.to_string(); - self.stream.finish_reason = - normalize_agent_runtime_response_stream_finish_reason(finish_reason); - self.finish_with_status(AGENT_RUNTIME_RESPONSE_STREAM_STATUS_READY); - } - pub(super) fn failed(&mut self) { self.finish_with_status(AGENT_RUNTIME_RESPONSE_STREAM_STATUS_FAILED); } diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/response_stream_tests.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/response_stream_tests.rs index 16777f4fa..1ab620e5d 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/response_stream_tests.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/response_stream_tests.rs @@ -211,16 +211,6 @@ fn response_stream_publisher_persists_monotonic_visible_deltas() { assert_eq!(second.sequence, 2); assert_eq!(second.accumulated_text, "你好,这是总控回复。"); assert!(!second.accumulated_text.contains("内部推理")); - - publisher.ready("你好,这是总控回复。", Some("stop")); - let ready = - read_game_creator_agent_runtime_response_stream_at(root, &state.agent_id, &state.run_id) - .expect("read ready response stream") - .expect("ready response stream exists"); - assert_eq!(ready.status, AGENT_RUNTIME_RESPONSE_STREAM_STATUS_READY); - assert_eq!(ready.sequence, 3); - assert_eq!(ready.accumulated_text, "你好,这是总控回复。"); - assert_eq!(ready.finish_reason.as_deref(), Some("stop")); } #[test] @@ -240,7 +230,7 @@ fn response_stream_retry_restart_preserves_identity_and_advances_sequence() { .expect("failed response stream attempt exists"); assert_eq!(failed.status, AGENT_RUNTIME_RESPONSE_STREAM_STATUS_FAILED); - let mut retry = AgentRuntimeResponseStreamPublisher::start(root, &snapshot, response_revision); + let retry = AgentRuntimeResponseStreamPublisher::start(root, &snapshot, response_revision); let restarted = read_game_creator_agent_runtime_response_stream_at(root, &state.agent_id, &state.run_id) .expect("read restarted response stream attempt") @@ -254,14 +244,7 @@ fn response_stream_retry_restart_preserves_identity_and_advances_sequence() { assert!(restarted.sequence > failed.sequence); assert!(restarted.accumulated_text.is_empty()); - retry.ready("重试后的最终回复", Some("stop")); - let ready = - read_game_creator_agent_runtime_response_stream_at(root, &state.agent_id, &state.run_id) - .expect("read retried ready response stream") - .expect("retried ready response stream exists"); - assert_eq!(ready.status, AGENT_RUNTIME_RESPONSE_STREAM_STATUS_READY); - assert!(ready.sequence > restarted.sequence); - assert_eq!(ready.accumulated_text, "重试后的最终回复"); + drop(retry); } #[test] diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver.rs index 35ae78a3d..9fe5f6889 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver.rs @@ -302,9 +302,11 @@ pub(crate) use entrypoints::{ pub(crate) use finalization::resume_game_creator_agent_finalization_for_test_at; pub(crate) use finalization::AgentRuntimePendingActionResume; #[cfg(test)] -pub(crate) use interaction::acquire_game_creator_agent_runtime_user_input_answer_locks_for_test; pub(crate) use interaction::{ + acquire_game_creator_agent_runtime_user_input_answer_locks_for_test, agent_runtime_tool_requires_repository_context_fingerprint_gate, +}; +pub(crate) use interaction::{ answer_game_creator_agent_runtime_user_input_at, confirm_game_creator_agent_runtime_task_at, pending_repository_context_drift_observation, reject_game_creator_agent_runtime_task_at, }; @@ -325,14 +327,9 @@ pub(crate) use pending_execution::{ pub(crate) use pending_recovery::resume_game_creator_agent_pending_tool_action_at; #[cfg(test)] pub(crate) use pending_recovery::resume_game_creator_agent_provider_action_batch_for_test_at; -pub(crate) use provider_recovery::{ - autonomous_manifest_parent_wake_error_is_transient, - schedule_waiting_autonomous_manifest_parent_wake_after_lane_release, - schedule_waiting_static_delegate_parent_wake_after_lane_release, - static_delegate_parent_wake_error_is_transient, -}; #[cfg(test)] pub(crate) use provider_recovery::{ + autonomous_manifest_parent_wake_error_is_transient, drive_waiting_autonomous_manifest_parent_wake_budget_for_test, ensure_static_delegate_user_input_wait_at, ensure_waiting_provider_retry_records_for_test, mark_autonomous_manifest_parent_wake_needs_reconciliation_for_test, @@ -340,6 +337,11 @@ pub(crate) use provider_recovery::{ probe_static_delegate_parent_wake_singleflight_coalescing, repair_autonomous_manifest_parent_wake_reconciliation_projection_for_test, }; +pub(crate) use provider_recovery::{ + schedule_waiting_autonomous_manifest_parent_wake_after_lane_release, + schedule_waiting_static_delegate_parent_wake_after_lane_release, + static_delegate_parent_wake_error_is_transient, +}; pub(crate) use recovery_scan::{ cleanup_game_creator_agent_runtime_completed_finalizations_at, has_recoverable_game_creator_agent_background_tasks_at, @@ -357,18 +359,20 @@ pub(crate) use task_queue::{ spawn_next_game_creator_agent_background_task_drain_with_lock, spawn_started_game_creator_agent_background_task_drain_with_lock, }; -#[cfg(test)] -pub(crate) use task_start::start_game_creator_agent_background_task_with_session_lane_hook_at; pub(crate) use task_start::{ autonomous_game_build_root_task_is_active, current_autonomous_game_build_root_task_at, notify_external_agent_runner_after_background_task_enqueue, project_autonomous_manifest_ready_task_terminal_at, schedule_autonomous_game_build_ready_tasks_at, schedule_game_creator_agent_ready_tasks_at, start_game_creator_agent_background_task_at, - start_game_creator_agent_background_task_for_session_at, start_game_creator_agent_goal_task_in_session_lane_at, start_game_creator_supervisor_background_task_for_session_at, }; +#[cfg(test)] +pub(crate) use task_start::{ + start_game_creator_agent_background_task_for_session_at, + start_game_creator_agent_background_task_with_session_lane_hook_at, +}; pub(crate) const AGENT_RUNTIME_BACKGROUND_LOOP_LIMIT: usize = 6; pub(crate) const AGENT_RUNTIME_BACKGROUND_TOOL_ACTION_LIMIT: usize = 3; diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs index aef291787..2a85b26fe 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs @@ -931,6 +931,7 @@ async fn run_game_creator_agent_background_task_pass_without_deadline( } return AgentBackgroundTaskOutcome::WaitingForProviderRetry; } + #[cfg(test)] Ok(RequestedAgentRuntimeToolPlanOutcome::HandoffPrepared) => { return AgentBackgroundTaskOutcome::WaitingForProviderHandoff; } @@ -3432,6 +3433,7 @@ async fn run_game_creator_agent_background_task_pass_without_deadline( } return AgentBackgroundTaskOutcome::WaitingForProviderRetry; } + #[cfg(test)] Ok(RequestedAgentRuntimeFinalReplyOutcome::HandoffPrepared) => { return AgentBackgroundTaskOutcome::WaitingForProviderHandoff; } diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/task_queue.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/task_queue.rs index 5b3fc70a8..a00694790 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/task_queue.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/task_queue.rs @@ -473,6 +473,7 @@ pub(crate) async fn run_game_creator_agent_background_task_with_context( ); return AgentBackgroundTaskOutcome::WaitingForProviderRetry; } + #[cfg(test)] AgentBackgroundTaskOutcome::WaitingForProviderHandoff => { return AgentBackgroundTaskOutcome::WaitingForProviderHandoff; } diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_protocol.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_protocol.rs index 28542c42d..b889baafd 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_protocol.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_protocol.rs @@ -43,9 +43,10 @@ pub(crate) use context_bundle::{ read_game_creator_agent_runtime_context_bundle, read_game_creator_agent_runtime_context_bundle_for_idle_compaction, }; +#[cfg(test)] +pub(crate) use context_window::agent_runtime_context_window_applies; pub(crate) use context_window::{ - agent_runtime_context_window_applies, sanitize_agent_runtime_context_observation, - AgentRuntimeContextCheckpoint, + sanitize_agent_runtime_context_observation, AgentRuntimeContextCheckpoint, }; #[allow(unused_imports)] pub(crate) use finalization::{ @@ -73,11 +74,11 @@ pub(crate) use provider_retry::{ game_creator_agent_runtime_provider_request_id, game_creator_agent_runtime_transient_retry_backoff_ms, }; +#[cfg(test)] pub(crate) use real_e2e_checkpoint::AgentRuntimeRealE2eAckPublishPhase; -pub(crate) use response_stream::{ - game_creator_agent_runtime_response_stream_path, - read_game_creator_agent_runtime_response_stream_at, -}; +#[cfg(test)] +pub(crate) use response_stream::game_creator_agent_runtime_response_stream_path; +pub(crate) use response_stream::read_game_creator_agent_runtime_response_stream_at; pub(crate) use run_configuration::{ agent_runtime_run_profile_identity_at, bind_game_creator_agent_runtime_run_profile_at, game_creator_agent_runtime_provider_transient_retry_policy_at, @@ -88,11 +89,14 @@ pub(crate) use run_configuration::{ game_creator_agent_runtime_project_revision_path, game_creator_agent_runtime_run_profile_binding_path, }; +#[cfg(test)] pub(crate) use steering::{ acquire_game_creator_agent_runtime_steer_project_write_lock_with_wait, + game_creator_agent_runtime_steer_ledger_path, +}; +pub(crate) use steering::{ consume_game_creator_agent_runtime_steers, game_creator_agent_runtime_provider_request_count_for_roots, - game_creator_agent_runtime_steer_ledger_path, interrupt_game_creator_agent_runtime_provider_request_at, interrupt_game_creator_agent_runtime_provider_requests_for_roots, register_game_creator_agent_runtime_provider_request, diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_protocol/models.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_protocol/models.rs index dbc0c4ffa..571fb79f7 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_protocol/models.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_protocol/models.rs @@ -6,6 +6,7 @@ pub(crate) enum AgentBackgroundTaskOutcome { WaitingForConfirmation, WaitingForUserInput, WaitingForProviderRetry, + #[cfg(test)] WaitingForProviderHandoff, WaitingForIsolatedJoin, WaitingForDelegateReceipts, @@ -21,6 +22,7 @@ pub(crate) enum AgentBackgroundTaskOutcome { pub(in crate::agent) enum AgentRuntimePersistedProviderRequestOutcome { Response(Option), Waiting(AgentRuntimeProviderRetryRecord), + #[cfg(test)] HandoffPrepared, Superseded, } @@ -28,6 +30,7 @@ pub(in crate::agent) enum AgentRuntimePersistedProviderRequestOutcome { pub(in crate::agent) enum AgentRuntimeContextCompactionOutcome { Completed(Option), Waiting(AgentRuntimeProviderRetryRecord), + #[cfg(test)] HandoffPrepared, Superseded, } @@ -35,6 +38,7 @@ pub(in crate::agent) enum AgentRuntimeContextCompactionOutcome { pub(in crate::agent) enum RequestedAgentRuntimeToolPlanOutcome { Ready(Option), Waiting(AgentRuntimeProviderRetryRecord), + #[cfg(test)] HandoffPrepared, Superseded, } @@ -42,6 +46,7 @@ pub(in crate::agent) enum RequestedAgentRuntimeToolPlanOutcome { pub(in crate::agent) enum RequestedAgentRuntimeFinalReplyOutcome { Ready(Option), Waiting(AgentRuntimeProviderRetryRecord), + #[cfg(test)] HandoffPrepared, Superseded, } diff --git a/apps/ai-game-creator-shell/src-tauri/src/analytics/store.rs b/apps/ai-game-creator-shell/src-tauri/src/analytics/store.rs index f9bb615be..3aa951715 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/analytics/store.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/analytics/store.rs @@ -20,15 +20,6 @@ const QUEUE_CAPACITY: usize = 1024; const MAX_META_BYTES: usize = 256 * 1024; const MAX_LIVE_OBSERVATIONS: usize = 16_384; -#[derive(Clone, Copy, Debug, Default)] -pub(crate) struct StoreCounters { - pub accepted: u64, - pub dropped: u64, - pub duplicate: u64, - pub corrupt_batches: u64, - pub io_errors: u64, -} - #[derive(Default)] struct Counters { queued_bytes: AtomicU64, @@ -282,16 +273,6 @@ impl AnalyticsWriter { pub(crate) fn flush(&self) -> bool { self.sender.try_send(Command::Flush).is_ok() } - - pub(crate) fn counters(&self) -> StoreCounters { - StoreCounters { - accepted: self.counters.accepted.load(Ordering::Relaxed), - dropped: self.counters.dropped.load(Ordering::Relaxed), - duplicate: self.counters.duplicate.load(Ordering::Relaxed), - corrupt_batches: self.counters.corrupt_batches.load(Ordering::Relaxed), - io_errors: self.counters.io_errors.load(Ordering::Relaxed), - } - } } struct LimitedSize(usize); diff --git a/apps/ai-game-creator-shell/src-tauri/src/analytics/store_tests.rs b/apps/ai-game-creator-shell/src-tauri/src/analytics/store_tests.rs index 61b830f31..219949cc9 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/analytics/store_tests.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/analytics/store_tests.rs @@ -349,7 +349,7 @@ fn full_or_disconnected_channel_never_waits_and_counts_drops() { assert!(before.elapsed() < Duration::from_secs(1)); drop(receiver); assert!(!writer.try_record(route("A"), event(&session, "A"), "closed".into())); - assert_eq!(writer.counters().dropped, 2); + assert_eq!(writer.counters.dropped.load(Ordering::Relaxed), 2); } #[test] @@ -1177,7 +1177,7 @@ fn direct_pending_capacity_evicts_oldest_without_settlement_fallback() { assert!(!drain_goal_writer(config.path(), &context, &writer) .iter() .any(|e| e.agent_run_id.is_some())); - assert!(writer.counters().dropped >= 1); + assert!(writer.counters.dropped.load(Ordering::Relaxed) >= 1); run::settle(Some((context.clone(), writer.clone())), &ids[16], false); assert_eq!( drain_goal_writer(config.path(), &context, &writer) diff --git a/apps/ai-game-creator-shell/src-tauri/src/browser.rs b/apps/ai-game-creator-shell/src-tauri/src/browser.rs index 23e15d4ac..049db1122 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/browser.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/browser.rs @@ -8,6 +8,7 @@ mod playtest; mod process; mod sweep; +#[cfg(test)] pub use discovery::discover_chrome_or_edge; #[allow(unused_imports)] pub use model::{ diff --git a/apps/ai-game-creator-shell/src-tauri/src/browser/playtest/mod.rs b/apps/ai-game-creator-shell/src-tauri/src/browser/playtest/mod.rs index 9d7461675..df4619c02 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/browser/playtest/mod.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/browser/playtest/mod.rs @@ -14,17 +14,21 @@ mod generic; mod lane_defense; pub(super) mod runner; +#[cfg(test)] pub(super) use generic::{ - finish_generic_stability_observation, generic_action_sequence_probe_fingerprint_material, - generic_non_loss_progression_phase_is_valid, generic_primary_action_phase_is_valid, - generic_restart_phase_is_valid, generic_start_phase_is_valid, - validate_generic_stability_sample, GENERIC_PLAYTEST_ACTION_CAUSALITY_FINGERPRINT, - GENERIC_PLAYTEST_MAX_FINAL_SAMPLE_GAP, GENERIC_PLAYTEST_POST_ACTION_MIN_STABILITY_SAMPLES, - GENERIC_PLAYTEST_POST_ACTION_WINDOW, GENERIC_PLAYTEST_RESTART_MIN_STABILITY_SAMPLES, - GENERIC_PLAYTEST_RESTART_STABILITY_WINDOW, + finish_generic_stability_observation, generic_non_loss_progression_phase_is_valid, + generic_primary_action_phase_is_valid, generic_restart_phase_is_valid, + generic_start_phase_is_valid, validate_generic_stability_sample, +}; +pub(super) use generic::{ + generic_action_sequence_probe_fingerprint_material, + GENERIC_PLAYTEST_ACTION_CAUSALITY_FINGERPRINT, GENERIC_PLAYTEST_MAX_FINAL_SAMPLE_GAP, + GENERIC_PLAYTEST_POST_ACTION_MIN_STABILITY_SAMPLES, GENERIC_PLAYTEST_POST_ACTION_WINDOW, + GENERIC_PLAYTEST_RESTART_MIN_STABILITY_SAMPLES, GENERIC_PLAYTEST_RESTART_STABILITY_WINDOW, GENERIC_PLAYTEST_START_OPPORTUNITY_MIN_STABILITY_SAMPLES, GENERIC_PLAYTEST_START_OPPORTUNITY_WINDOW, }; +#[cfg(test)] pub(super) use lane_defense::{lane_enemy_state_changes, LaneBattleProgress}; pub(super) const PLAYABLE_GAME_STATE_SCHEMA_VERSION: &str = "playable-web-game-state.v1"; diff --git a/apps/ai-game-creator-shell/src-tauri/src/runner/state.rs b/apps/ai-game-creator-shell/src-tauri/src/runner/state.rs index 7dda8ab43..5991626b1 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/runner/state.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/runner/state.rs @@ -245,6 +245,7 @@ pub(super) struct ExternalAgentRunnerProjectOwnerStorage { } impl ExternalAgentRunnerProjectOwnerStorage { + #[cfg(unix)] pub(super) fn runtime_directory(&self) -> &File { self.directory_handles .last() diff --git a/apps/ai-game-creator-shell/src-tauri/src/tool_plan_handoff.rs b/apps/ai-game-creator-shell/src-tauri/src/tool_plan_handoff.rs index f70993012..25cddefa5 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/tool_plan_handoff.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/tool_plan_handoff.rs @@ -31,10 +31,9 @@ pub(crate) use ledger::{ ensure_capacity_for_request_at, is_later_repair_identity, lookup_at, read_for_run_at, remove_at, write_at, }; -pub(crate) use model::{ - AgentRuntimeToolPlanHandoffEntry, AgentRuntimeToolPlanHandoffLedger, - AgentRuntimeToolPlanHandoffLookup, TOOL_PLAN_HANDOFF_SCHEMA_VERSION, -}; +pub(crate) use model::{AgentRuntimeToolPlanHandoffEntry, AgentRuntimeToolPlanHandoffLookup}; +#[cfg(test)] +pub(crate) use model::{AgentRuntimeToolPlanHandoffLedger, TOOL_PLAN_HANDOFF_SCHEMA_VERSION}; pub(crate) fn absolute_path_validation_error( label: &str, diff --git a/docs/project-memory/todos/【待解决】主要构建入口编译警告清单-2026-09-23.md b/docs/project-memory/todos/【待解决】主要构建入口编译警告清单-2026-09-23.md index 6a9c80389..1fa1c5d9e 100644 --- a/docs/project-memory/todos/【待解决】主要构建入口编译警告清单-2026-09-23.md +++ b/docs/project-memory/todos/【待解决】主要构建入口编译警告清单-2026-09-23.md @@ -7,7 +7,7 @@ ## 1. 基线与范围 -首次诊断的基线提交为 `016356e509f11a1a638ce45ed51b9e40ef3e36a2`,诊断时工作树干净。环境为 Windows x64、Rust `1.98.1`、Node `v24.15.0`、npm `12.0.2`。第 2~6 节和附录保留首次诊断快照;后续处理状态及契约核查见第 7~14 节,不能将附录的全部条目视为仍未解决。 +首次诊断的基线提交为 `016356e509f11a1a638ce45ed51b9e40ef3e36a2`,诊断时工作树干净。环境为 Windows x64、Rust `1.98.1`、Node `v24.15.0`、npm `12.0.2`。第 2~6 节和附录保留首次诊断快照;后续处理状态及契约核查见第 7~16 节,不能将附录的全部条目视为仍未解决。 AGC Rust 使用默认 features、dev profile;237 是本轮编译器诊断数,不代表 237 个独立根因,也不是所有平台、features 和 test targets 的总数。另有 5 条不带常规源码 span 的 ts-rs 宏提示,不计入 237。 @@ -556,6 +556,36 @@ W076 只将 Pending(String) 收窄为 Pending;三处生产返回前继续记 - `node apps/ai-game-creator-shell/scripts/check-config.mjs` 通过(含 3 个 vendor 源码许可测试);修改文件的 Rust 格式检查、`npm run check:encoding`、`npm run check:doc-index` 和 `git diff --check` 通过。 - 未运行全量 Rust 测试、Linux/macOS 构建、正式 editor features、release 打包或 GUI 端到端流程;Linux 文件锁测试仅保留源码,未在本轮 Windows 环境执行。 +## 15. 测试重导出的编译边界清理(2026-09-23) + +本批只处理第 10 节 20 条编译边界候选中的 15 条重导出诊断:N001、W175、W177、W178、W180、W182、W183、W185、W186、W187、W189、W193、W194、W195、W201。用户要求不跑全量编译,本批只作导出范围调整和静态验证。 + +- 测试实际消费的重导出加 `#[cfg(test)]`,保持测试原有访问路径;生产仍使用的同组导出、底层函数和类型定义保留。不扩大模块可见性,不增加 allow,不修改业务实现或测试断言。 +- W175 按符号拆分:`submit_external_generation_request` 保留测试导出,供 Direct tool bridge 的原测试使用;其余 5 个无外层消费者的导出(初始响应分类、下载引用检查、提交拒绝分类、结果轮询、初始响应类型)删除。对应定义及模块内生产/测试调用均保留。 +- W180 只收紧剩余的 revision 推进和验证完成门禁两个测试导出;前批已删除的旧取锁入口不恢复。 +- W061 的 publisher `ready()`、W075 的测试故障注入分支、W092/W093 的计数观测、W154 的 Unix 目录句柄均未改动。尤其 W061 不能仅因测试调用就判定保留:需核定它是否属于退出生产的旧终态实现,再决定专属断言去留。 + +验证:核对引用与差异,确认改动只涉及 7 个 Rust 模块的 use 声明和 cfg;修改文件的 `rustfmt --check --edition 2021 --config skip_children=true`、`npm run check:encoding`、`npm run check:doc-index`、`git diff --check` 通过。没有执行 Cargo check/build/test、全量编译或 Rust 用例,不用静态核查替代编译验证。 + +最近一次实测仍为第 14 节的 **50 条**;本批覆盖其中 15 条 unused_imports,若没有其他变化,预期剩余 35 条,**该数量尚未重新编译确认**。 + +## 16. 剩余测试用途与 Unix 边界项清理(2026-09-23) + +本批处理第 10 节编译边界候选中的剩余 5 条:W061、W075、W092、W093、W154。第 15 节的 15 条与本节合计覆盖原 20 条;仍按用户要求不跑全量编译。 + +| 编号 | 实施结论 | +| --- | --- | +| W075 | 保留 Provider 成功交接后的测试故障注入。`AgentRuntimePersistedProviderRequestOutcome::HandoffPrepared`、后续压缩/工具计划/最终回复结果中的同名变体,以及 `WaitingForProviderHandoff` 和对应传递/匹配分支,限定为 `#[cfg(test)]`。既有交接后恢复、不重发请求、只提交一次结果的测试保留,正式持久交接与恢复实现不变。 | +| W092/W093 | 删除 `StoreCounters` 和 `counters()` 快照包装。两处既有测试直接读取同一 `writer.counters.dropped` 原子计数,保持 Relaxed 读取和原断言;生产计数器与更新逻辑保留,不新增辅助函数。 | +| W061 | 删除没有生产调用的 publisher `ready()`。仅移除两个既有测试末尾针对该方法的 ready 调用和断言,保留内容过滤、递增序号、重试身份和起始时间断言;未向现役入口迁移旧测试。正式 ready writer、ready→committed 及异常恢复测试继续保留。 | +| W154 | `runtime_directory()` 加 `#[cfg(unix)]`。Unix `openat`、重命名和同步路径仍使用原目录句柄;锁、目录句柄生命周期和文件操作实现不变。 | + +**纠正初审**:第 10 节将后续同名 `HandoffPrepared` 视为生产活跃分支的判断不准确。完整追踪后,唯一源头是 `cfg(test)` 的交接暂停注入,后续构造仅转传该结果。生产源码中存在匹配语句不等于生产可达;本节结论替代该初审判断。 + +验证:逐处核对故障注入变体的构造/匹配、删除符号和 Unix 调用边界;修改文件 rustfmt、编码、文档索引及 `git diff --check` 通过。未执行 Cargo check/build/test、Rust 用例或跨平台编译;本批不新增测试。 + +最近一次实测仍为第 14 节的 **50 条**。第 15~16 节共处理其中 20 条,预期剩余 **30 条**,尚未重新编译确认;不能将预期数作为实测结果。 + ## 附录:237 条编译器诊断位置 以下是诊断的人工可读整理,不保存原始构建日志、本机路径或 target 缓存路径。位置相对 `apps/ai-game-creator-shell/src-tauri/`;行号只对应本节基线,修改后以符号搜索及重新编译为准。每条保留一个主要 span,编号用于本清单内跟踪,不表示独立业务缺陷。生成产物项须回到 `build_support/runtime_prompt_bundle.rs` 处理。