写入侧产出 canonical kind,读取侧读时重派生自愈存量分类
- 写入侧:infer_canvas_export_asset_kind 直接返回 canonical kind(animation → character-animation、ui → ui-design、asset → image),不再让别名表替写入侧兜底 - 写入侧补防御性归一,并新增 canvas_export_asset_kind_is_always_canonical 逐分支钉死返回值为 canonical、且不再写回 ui / animation / asset - 读取侧:gameCreationAppAssetCategory 加收窄覆盖规则——落盘 category 为 unclassified 且 kind 能派生出明确非 unclassified 分类时采用派生值 - 该规则不写迁移脚本、永久自愈:真机 57 条 ui 资产待归类从 58 降到 1,UI 交互从 2 升到 59,仅剩 code 类 game-entry 在待归类(分类表设计口径) - 收窄条件把覆盖窗口压到最小:落盘值本身是明确分类时仍信任落盘值(保留用户在分类与标签面板手动设置的权威性) - kind 派生结果本身即 unclassified 的 image / video / code / publication-material 不受影响,补断言钉住 - resourceCardPreviewRealManifest 由「记录缺陷」改为「守住修复」:断言归位后的 58 → 1 分布与 57 条 ui 全部落 UI 交互 - PRD 与 pitfalls 补记分类取值优先级、读时自愈规则、唯一盲区(手动把可明确分类的资产设为待归类会被覆盖)及写入侧 canonical 化
This commit is contained in:
@@ -604,14 +604,35 @@ export function gameCreationAppAssetCategoryForKind(
|
||||
];
|
||||
}
|
||||
|
||||
/** 历史 manifest 缺少 category 时按 kind 派生;未知分类值同样退回 kind 派生。 */
|
||||
/**
|
||||
* manifest 资产的最终功能分类。
|
||||
*
|
||||
* 优先级:落盘 `category`(用户可在「分类与标签」面板手动设置,是权威值)→ 按 `kind` 派生。
|
||||
* 历史 manifest 缺少 category、或 category 非法时都退回 kind 派生。
|
||||
*
|
||||
* **例外(唯一的覆盖窗口)**:落盘值是 `unclassified`,而该资产 `kind` 能派生出明确的
|
||||
* 非 `unclassified` 分类时,采用派生值。这条规则用于自愈「历史上被系统错误写成
|
||||
* unclassified」的存量数据——典型例子是 `kind:"ui"` 的 UI 资产曾因 kind 不在 canonical
|
||||
* 目录而落到 `image → unclassified`,修复别名后并不会自动归位,因为落盘值已固化。
|
||||
*
|
||||
* 盲区:用户**手动**把一个 kind 已能明确分类的资产设成「待归类」时,该手动值会被这条
|
||||
* 规则覆盖。这是有意接受的取舍——「手动设为待归类」本身意图边缘,且 kind 已经表达了分类;
|
||||
* 而反过来漏掉这条规则,所有历史误判都无法自愈。
|
||||
* kind 派生结果本身就是 `unclassified` 的(如 `image` / `video` / `code`)不受影响,
|
||||
* 仍然信任落盘值。
|
||||
*/
|
||||
export function gameCreationAppAssetCategory(
|
||||
asset: Pick<GameCreationAppAssetManifestEntry, 'kind' | 'category'>,
|
||||
): GameCreationAppAssetCategory {
|
||||
return (
|
||||
normalizeGameCreationAppAssetCategory(asset.category) ??
|
||||
gameCreationAppAssetCategoryForKind(asset.kind)
|
||||
);
|
||||
const persisted = normalizeGameCreationAppAssetCategory(asset.category);
|
||||
const derivedFromKind = gameCreationAppAssetCategoryForKind(asset.kind);
|
||||
if (persisted === null) {
|
||||
return derivedFromKind;
|
||||
}
|
||||
if (persisted === 'unclassified' && derivedFromKind !== 'unclassified') {
|
||||
return derivedFromKind;
|
||||
}
|
||||
return persisted;
|
||||
}
|
||||
|
||||
export function gameCreationAppAssetTags(
|
||||
|
||||
Reference in New Issue
Block a user