chore(agc): 对齐退役注释、收敛 prompt bundle 生成器标签,并 rustfmt 修正

- `game_distribution_publish.rs`:`OwnerGameEntry` 的 doc 注释与 `localProjectId` 字段
  已按「仅测试读取」收敛成 `cfg(test)` 的现状对齐(生产按本地 manifest 的 `projectId` 匹配,
  只有 `parse_owner_game_entry` 的解析用例读它)。
- `build_support/runtime_prompt_bundle.rs`:`provider_fragment_entries` 第二个元素
  (`RUNTIME_PROMPT_PROVIDER_*_SECTION` 常量名)随退役 Runtime 的常量生成逻辑停发后已无消费者
  (三处调用点都忽略它),收敛为 `(manifest 路径键, section 键)` 二元组,行为不变。
- rustfmt:HEAD 上 `cargo fmt --all --check` 不通过(M1 的 `command_sandbox` 导入换行、
  `image_inspect.rs` 两处调用/断言换行),会让 husky `check:rustfmt` 失败;一并修正,无语义变化。

实测(`CARGO_TARGET_DIR=W:/tmp/agc-target-laneD`,features cocos/unity/godot-editor-execute):
- `cargo check`(bin)EXIT=0,领地 21 条(全为耦合项,未变);
- `cargo check --all-targets` EXIT=0,领地 harness 增量 336→335(-1 来自 M2 的 unused import);
- `cargo test --test runtime_prompt_bundle_build --test prompt_source_boundaries`:
  17 passed + 6 passed,0 failed(改了生成器,按 dev 运维文档必跑);
- `cargo fmt --all --check` 通过。
This commit is contained in:
2026-10-06 17:10:38 +08:00
parent 3a97ce6b13
commit 09f7a310cc
4 changed files with 16 additions and 24 deletions
@@ -337,7 +337,7 @@ pub fn compile_manifest(manifest_path: &Path) -> Result<CompiledPromptBundle, St
)?;
}
let mut provider_fragment_sections = BTreeSet::new();
for (name, _, section_id) in provider_fragment_entries(&manifest.provider_fragments) {
for (name, section_id) in provider_fragment_entries(&manifest.provider_fragments) {
validate_section_reference(section_id, &sections, name)?;
if !provider_fragment_sections.insert(section_id) {
return Err(format!("Provider fragment section 重复引用:{section_id}"));
@@ -370,7 +370,7 @@ pub fn compile_manifest(manifest_path: &Path) -> Result<CompiledPromptBundle, St
used_sections.extend(
provider_fragment_entries(&manifest.provider_fragments)
.into_iter()
.map(|(_, _, section_id)| section_id.clone()),
.map(|(_, section_id)| section_id.clone()),
);
for section_id in sections.keys() {
if !used_sections.contains(section_id) {
@@ -443,7 +443,7 @@ fn validate_section_ownership(manifest: &PromptBundleManifest) -> Result<(), Str
register("roleOverlays", section);
}
}
for (_, _, section) in provider_fragment_entries(&manifest.provider_fragments) {
for (_, section) in provider_fragment_entries(&manifest.provider_fragments) {
register("providerFragments", section);
}
@@ -463,48 +463,40 @@ fn validate_section_ownership(manifest: &PromptBundleManifest) -> Result<(), Str
Ok(())
}
fn provider_fragment_entries(
fragments: &ProviderFragments,
) -> [(&'static str, &'static str, &String); 8] {
/// 返回 `(manifest 路径键, section 键)`:常量名标签随退役 Runtime 的 `RUNTIME_PROMPT_*` 生成逻辑一并停发,
/// 只剩校验与所有权归属两处用途,因此不再携带常量名字符串。
fn provider_fragment_entries(fragments: &ProviderFragments) -> [(&'static str, &String); 8] {
[
(
"providerFragments.isolatedToolContract",
"RUNTIME_PROMPT_PROVIDER_ISOLATED_TOOL_CONTRACT_SECTION",
&fragments.isolated_tool_contract,
),
(
"providerFragments.autonomousRunProfile",
"RUNTIME_PROMPT_PROVIDER_AUTONOMOUS_RUN_PROFILE_SECTION",
&fragments.autonomous_run_profile,
),
(
"providerFragments.autonomousSupervisorManifest",
"RUNTIME_PROMPT_PROVIDER_AUTONOMOUS_SUPERVISOR_MANIFEST_SECTION",
&fragments.autonomous_supervisor_manifest,
),
(
"providerFragments.initialCollaborationRepair",
"RUNTIME_PROMPT_PROVIDER_INITIAL_COLLABORATION_REPAIR_SECTION",
&fragments.initial_collaboration_repair,
),
(
"providerFragments.autonomousInitialCollaborationRepair",
"RUNTIME_PROMPT_PROVIDER_AUTONOMOUS_INITIAL_COLLABORATION_REPAIR_SECTION",
&fragments.autonomous_initial_collaboration_repair,
),
(
"providerFragments.supervisorDeliveryConvergenceRepair",
"RUNTIME_PROMPT_PROVIDER_SUPERVISOR_DELIVERY_CONVERGENCE_REPAIR_SECTION",
&fragments.supervisor_delivery_convergence_repair,
),
(
"providerFragments.manifestDagWaitRepair",
"RUNTIME_PROMPT_PROVIDER_MANIFEST_DAG_WAIT_REPAIR_SECTION",
&fragments.manifest_dag_wait_repair,
),
(
"providerFragments.delegatedPlaytestRepair",
"RUNTIME_PROMPT_PROVIDER_DELEGATED_PLAYTEST_REPAIR_SECTION",
&fragments.delegated_playtest_repair,
),
]
@@ -8,8 +8,8 @@ use tokio::io::AsyncReadExt;
#[cfg(target_os = "linux")]
use crate::command_sandbox::{
command_sandbox_platform_metadata, prepare_command_sandbox_launch, stage_command_sandbox_launch,
CommandSandboxLaunch,
command_sandbox_platform_metadata, prepare_command_sandbox_launch,
stage_command_sandbox_launch, CommandSandboxLaunch,
};
#[cfg(target_os = "linux")]
use crate::command_sandbox_trampoline::{LaunchGate, TargetExecState, TargetTerminalState};
@@ -218,7 +218,8 @@ struct CreatedVersion {
/// 作者名下作品条目(`GET /my-games` 列表项与 `GET /my-games/{gameId}` 的 `game`)。
///
/// 只声明恢复绑定需要的字段:游戏身份、`localProjectId`、最近版本与公开修订号。
/// 只声明恢复绑定需要的字段:游戏身份、最近版本与公开修订号。`localProjectId` 只在测试态编译:
/// 生产按本地 manifest 的 `projectId` 匹配(见 `read_game_distribution_publication`),仅解析用例读它。
#[derive(Clone, Debug, Default, Deserialize)]
#[serde(rename_all = "camelCase")]
struct OwnerGameEntry {
@@ -84,11 +84,8 @@ pub(crate) fn load_local_project_image_preview_with_cancellation(
let absolute = resolve_local_project_path(root, &normalized)?;
validate_agent_runtime_inspection_ancestors(root, &absolute)?;
cancellation.check()?;
let image = read_agent_runtime_inspection_image_with_cancellation(
&absolute,
normalized,
cancellation,
)?;
let image =
read_agent_runtime_inspection_image_with_cancellation(&absolute, normalized, cancellation)?;
cancellation.check()?;
// 头部级 alpha 判据:只读签名与头部标志(PNG 还会按 chunk 头跳过数据体找 `tRNS`),
// 不做熵解码、不做逐像素扫描,成本不随像素数增长,因此大图与「AI 把棋盘格画进图里」
@@ -1001,7 +998,9 @@ mod tests {
root.path().join("assets/linked-parent"),
)
.expect("parent symlink");
assert!(load_local_project_image_preview(root.path(), "assets/linked-parent/image.png")
.is_err());
assert!(
load_local_project_image_preview(root.path(), "assets/linked-parent/image.png")
.is_err()
);
}
}