Skip to content

fix(export): 脚线几何由后端报出,前端不再自己按 0.92 算 - #524

Open
johnnyzhang-eng wants to merge 1 commit into
1024XEngineer:mainfrom
johnnyzhang-eng:fix/report-sequence-geometry
Open

fix(export): 脚线几何由后端报出,前端不再自己按 0.92 算#524
johnnyzhang-eng wants to merge 1 commit into
1024XEngineer:mainfrom
johnnyzhang-eng:fix/report-sequence-geometry

Conversation

@johnnyzhang-eng

Copy link
Copy Markdown
Contributor

Closes #522

问题

交付帧的脚线几何前后端各存一份 0.92。后端 postprocess/pack.py 的模块注释已经写明为什么它必须是单一常量 ——「抄一份数字过去就等于埋下『改了这里、那边阈值不动』的静默分歧」,而前端导出正是抄了一份,anchorfootY 都由它算,后端从不交出真值。

两份不同步的后果是角色不站在地上,而帧数、时长、成色全部正常,没有任何一道会红。导出契约里这两个字段是必填且带范围校验的(footY 必须落在画布内),是引擎播放要用的量,不是装饰。

方案

引擎新增 SequenceGeometry(画布尺寸、归一化锚点、脚线像素),值取自 _lastmile 调用对齐时的同一组实参与 postprocess.FOOT_LINE,不另立一份常量。服务端把它转录进任务结果的 geometry

前端结果类型加同名可选字段,DTO 层按结构严格校验(anchor 必须是 0-1、foot_y 必须落在画布内);导出改读它,缺失时明示回落到旧常量而不是静默给 0 —— 旧任务没有这一段,把「没给」读成「给了默认值」正是这条线要消掉的问题。

出参上它是 None 可选而不是带默认值:消费方要能区分「引擎没报」与「报了这个值」。

不包含

  • 不改画布尺寸,不改脚线数值本身
  • 不动位移轨(root_motion MVP 不做)与图集
  • 不改 character_data 存储:已发布动作仍走回落,那需要 CharacterAction 一起加字段,属 feat(render3d): 三渲二路线接入编排模块 #192 子项 1 的另一半

验收

后端用例断言的是 postprocess.FOOT_LINE 本身,不是字面量 0.92:

test_generated_action_reports_the_alignment_geometry_instead_of_a_constant

前端两条用例:一条给故意不等于 0.92 的几何(anchor.y = 0.8footY = 32),读出来必须是后端那份;一条不给几何,验回落值可测。删掉「优先用后端几何」那一步后前端用例失败:

Tests  1 failed | 7 passed (8)

后端 ruff check .lint-imports(2 kept, 0 broken)、pytest -q(1200 passed, 14 skipped)。前端 tsc -boxlintoxfmt --checkvitest(974 passed)。

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
windup Ready Ready Preview Aug 21, 2026 10:23am

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.00000% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
frontend/src/entities/generation/api.ts 5.26% 16 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已检查后端几何生成、任务持久化/SSE/API 读取链路,以及前端 DTO 校验和导出回落逻辑。几何在实时任务结果中能正确产生,但持久化任务重新读取时会丢失该字段,导致轮询或刷新后的导出仍静默回落到旧的 0.92;请先补齐反序列化链路。

验证:已按固定 base/head SHA 检查完整 diff;尝试运行后端定向 pytest,但当前环境未安装 pytest

# 落位几何随产物一起交出:消费方要把帧画到画布上、判角色有没有站在地上,
# 而这条线的比例是对齐那一步的实参。前端此前抄了一份 0.92 自己算 —— 两份
# 常数只要有一次不同步,角色就不站在地上,而没有任何一道会红。
if generated.geometry is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] 保留持久化任务中的 geometry

_produce_action 将 geometry 写入结果后,任务落库再由 task_repo._deserialize_result 还原 CharacterActionOutput 时并没有读取这个新字段,因此通过查询接口或断线后的轮询拿到的已完成任务会变成没有 geometry 的结果。前端随后会走本次改动中的旧值回落路径,实际导出仍按 0.92 计算,只有实时事件路径才使用后端报出的几何;请在反序列化时恢复 geometry(并覆盖持久化/重新读取场景)。

xyh202131
xyh202131 previously approved these changes Aug 21, 2026

@xyh202131 xyh202131 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

按请求批量审批当前提交。

@xyh202131
xyh202131 dismissed their stale review August 21, 2026 09:16

按请求撤销此前审批。

xyh202131
xyh202131 previously approved these changes Aug 21, 2026
引擎把对齐那一步的实参报进出参、服务端随结果交出;前端导出改读它,缺失时
明示回落而不静默给 0。

Closes 1024XEngineer#522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 交付帧脚线几何前后端各存一份 0.92,后端从不交出真值

2 participants