Repository navigation
fix: hexgen_multi_seed 第④行缩进归位到量测块内,--gen 只生成不再崩(Fixes dsh-bounty #1960) - #1127
Closed
zhtty67-rgb wants to merge 1 commit into
Closed
zhtty67-rgb wants to merge 1 commit into
zhtty67-rgb wants to merge 1 commit into
Conversation
zhtty67-rgb
force-pushed
the
fix/issue1960
branch
from
October 29, 2026 11:10
87bb60a to
618b62b
Compare
FuRongJun-1999
added a commit
that referenced
this pull request
Oct 29, 2026
…1127 fix(gen): hexgen_multi_seed --gen 只生成模式缩进归位(lingshu bounty #1960,镜像 #1127 净增量)
Owner
已修复并合并(维护侧实测)确认属实(最新 main 合并前原样复现: 合并后 main( 致谢与署名:修法与守卫的净增量来自 @zhtty67-rgb 的 PR #1127(原样保留);#1127 未直接合并的原因是其分支基线 9a47775 先于维护侧 #1138/#1143/#1146/#1153/#1154 系(直接合并会回退已合工作,净 diff -1948 行),已按净增量摘取重放。 感谢报告——「已渲染成果全丢」的严重度定级(渲染成果不可再生)准确。 |
Owner
|
净增量已镜像合并(PR #1157,fbf3d62)——本 PR 关闭以避免与已落地内容重复。感谢贡献。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
缺陷
lingshu/gen/hexgen_multi_seed.py:405(--gen只生成模式)抛UnboundLocalError,且 JSON 报告一字节不写 —— 已渲染成果全丢。锚定:
FuRongJun-1999/lingshu@45b8359(复基点),修复 rebase 到5b0bf2a。缺陷报告:FuRongJun-1999/dsh-bounty#1960
根因
81f68ccc(fix(gen): F23-25 empty_rate 零样本记 None)在把第 ④ 行打印改为容忍er is None时,把该行缩进从 8 格改成了 4 格:该行引用的
s(rep["summary"],:397)与er(:404)只在if a.measure or do_both:块内赋值,于是:--gen(模块 docstring 第 30 行承诺可单跑的入口):s从未绑定 ⇒UnboundLocalError,进程非零退出;写报告在 :406-409,位于崩溃点之后 ⇒ 报告不存在。--measure/ 无参:s已赋值能跑过,但该行脱离了量测块,无条件执行 —— 语义上不再是「量测结果的第 ④ 项」(本次一并归位)。81f68ccc同时新增的tests/test_issue942_f23_25_empty_rate_null.py只做源码字符串匹配("无样本" in src)+ 把打印式复制一份再断言,从不调用main(),故对缩进层级零判别力。修复(最小)
只改 1 行缩进,把 :405 挪回
if a.measure or do_both:块内。无新语义、docstring 契约未动、无无关重构:守卫测试
新增
tests/test_issue1960_multi_seed_gen_only.py(3 条用例)。与既有同族守卫不同,本件真跑main(),不做源码字符串匹配:test_gen_only_writes_report_and_does_not_measure--gen正常返回、--out报告已写出且含generation/rows、不含量测段;summarize被调用即判红test_gen_only_does_not_print_measure_lines预初始化成{}只消错、行仍留在块外」的假修复test_measure_mode_still_prints_line_four--measure必须照旧打印④ 空读件 0/0(无样本)—— 挡住「整行删掉迁就崩溃」的假修复环境隔离:只替换
gen(需本地 Qwen-Image-2.1 权重 + torch)与量测三件(load_multi/measure/summarize,需标定语料)这两处环境依赖;argparse、分支判定、print、os.makedirs、json 写报告全走原样实现 —— 缺陷正落在这条原样链上。测试输出(真实执行)
修复前(HEAD
45b8359,红):崩溃点、异常类型与 issue 报告逐字一致;
生成:新增 2/2 张已打印,证明渲染阶段已完成、损失发生在写报告之前。修复后(本分支,绿):
同族回归面(修复后):
环境:Windows 11 + Git Bash,Python 3.14.9,pytest 9.1.1(本机 venv 直跑;仓内
.venv不存在,故用既有环境注入PYTHONPATH提供 pytest/numpy/Pillow,未联网安装、未改仓内依赖声明)。追加提交(CI gate 修复):同步 intake 登记指纹
首版 PR 的
gateCI 红了 3 个 job(py3.12 / py3.12·依赖下界 / py3.13),失败断言是:根因属实且是本次改动的直接后果:
docs/intake/body-export-v0.1/_export_manifest.json登记了hexgen_multi_seed.py的 sha256 前缀,而本次修复动了该文件的字节(81f68ccc当时也是「改代码 + 同步登记」成对提交,见其 diff 的单行指纹更新)。因此按仓内既有约定补一个
只改一行的登记提交
87bb60a:指纹算法与工具一致(LF 归一后 sha256 取前 16 位):
改前(本分支
539f8fc单独检出到临时 worktree 实测):改后(本分支 HEAD
87bb60a):合并回归面(修复 + 守卫 + 指纹三件一起):
hexgen全族(加指纹修复后重跑):未做 / 不承诺
pytest tests/(599 个测试件,规模外)。但已按 CI 报红定位并修复了唯一与本改动相关的失败面;其余 job 侧失败请以本 PR 最新的 gate 结果为准(见 checks)。
tests/test_issue942_f23_25_empty_rate_null.py(该件只钉 empty_rate 的 null 语义,职责不同;本次另立新件补 control-flow 面)。
Fixes FuRongJun-1999/dsh-bounty#1960