Skip to content

research(ui): fix BCD calibration peer dual-axis resize contract (#29) - #333

Merged
JavaZeroo merged 3 commits into
mainfrom
agent/bcd-k3/record-hidden-retention-2e7373117ea0
Nov 11, 2026
Merged

JavaZeroo merged 3 commits into
mainfrom
agent/bcd-k3/record-hidden-retention-2e7373117ea0

Conversation

@JavaZeroo-Bot

Copy link
Copy Markdown
Collaborator

诊断

research/ui/resize_bcd_calibration.py 的校准 peer 继承 resize_state_reference.BoundPeer 的只缩宽固定行数守卫(resize_state_reference.py:85):初始冻结后任何 NAWS 行数必须等于 24。校准计划固定 80×24 -> 60×12 -> 60×12 -> 80×24,phase1 目标 60×12 到达时 _on_naws 在 _phase_ready(1) 之前抛出 Resize changed row count,导致 frozen_grid 仍 [80,24]、phase1 未完成。2026-11-09 失败证据(peer.json:naws_history=[[80,24],[60,12]]、resize_armed=1、error=Resize changed row count)与该静态结论精确吻合。确认 NAWS 到达不等于完成可用校准;该错误是控制器测试合同错误,不能归因 WindTerm 缺陷。

修复(不改 resize_state_reference.py 只缩宽合同)

  • resize_bcd_calibration.py:覆盖 _on_naws 为校准专用合同——尺寸变化仅允许计划序列 80×24 -> 60×12 -> 80×24;phase1/3 是尺寸变化事件,必须在 request/armed 后出现新的目标 NAWS(禁止旧事件冒充,_phase_ready 边界检查全部保留);phase2 是同尺寸观测 checkpoint(988×509/60×12),无 resize 动作、不要求新 NAWS,同尺寸重复只记录,未预期尺寸变化即失败。
  • 新记录字段:initial_grid、expected_size_change_sequence、naws_size_changes、phase_ready_events、phase2_observed_naws、phase2_new_naws_required=false、frozen_grid_history,并在 audit_mechanics 增加对应校验(只增不删,旧断言全保留)。
  • resize_bcd_address_reference.py(v2 夹具)复用同一错误守卫,按授权一并修复:仅增加同一 _on_naws 覆盖与 naws_size_changes 记录;窗口、网格、相位正文、文档白名单与字面验收不变。具体差异见提交说明。
  • JS 控制器无需改动(phase2 本就无 resize 请求;stableGrid 与新合同兼容)。

离线验证(无 socket、无原版运行时)

  • 新增 research/ui/test_resize_bcd_calibration.py(已注册 CTest):双轴流程在有/无 checkpoint 同尺寸重复 NAWS 下均 4/4 phase 完成;stale-ready / unarmed-change / wrong-grid / wrong-request 均按预期失败;audit 对 naws_size_changes/phase_ready_events/phase2_observed_naws 篡改拒绝。
  • v2 夹具内联模拟:四阶段 NAWS/DSR/ack 流完成,frozen [[80,24],[60,12],[60,12],[80,24]]。
  • 既有 test_resize_bcd_address_reference、test_resize_state_reference、test_export_resize_state_reference 共 26 项全部通过。
python -m unittest research.ui.test_resize_bcd_calibration -v   # 4 OK
python -m unittest research.ui.test_resize_bcd_address_reference research.ui.test_resize_state_reference research.ui.test_export_resize_state_reference   # 26 OK

边界

🤖 Generated with Kimi K3 (ai-gateway/kimi-k3)

JavaZeroo-Bot and others added 3 commits November 12, 2026 01:18
The calibration peer inherited the baseline BoundPeer width-only guard,
which raised "Resize changed row count" when the fixed 80x24 -> 60x12
resize NAWS arrived, so phase 1 never completed and the 2026-11-09
calibration stopped after phase 0 with frozen_grid still [80,24].

Override the NAWS gate inside the calibration probe only; the baseline
width-only contract stays unchanged. The calibration contract allows
exactly the plan size-change sequence 80x24 -> 60x12 -> 80x24: phases
1/3 are resize events and each armed resize must be acknowledged by a
new post-request NAWS at the target grid (stale or same-size events
never count); phase 2 is a same-size observation checkpoint with no
resize action and no new NAWS required, duplicate same-size events are
recorded only, and any unexpected size change fails. Expectations come
from the fixed plan constants, never from observed ranges.

Record initial_grid, expected_size_change_sequence, naws_size_changes,
phase_ready_events, phase2_observed_naws and
phase2_new_naws_required=false, and audit them; the four fixed
windows/grids and all prior assertions stay unchanged. Offline peer
simulation covers the dual-axis flow with and without a checkpoint
duplicate plus stale-ready, unarmed-change, wrong-grid and wrong-request
rejections, and the mechanics audit tamper checks.

This does not close #27 or #29, does not choose A/B/C, and does not
change product behavior.

Co-authored-by: JavaZeroo <71128095+JavaZeroo@users.noreply.github.com>
The v1 B/C/D pre-write probe reused the same baseline BoundPeer row-count
guard as the calibration peer, so its fixed 80x24 -> 60x12 -> 60x12 ->
80x24 resize would hit the same "Resize changed row count" failure at
phase 1 (static conclusion from the shared inheritance; the old v1 run
never reached that point).

Apply the identical calibration NAWS contract override inside this probe:
size changes must follow the plan sequence 80x24 -> 60x12 -> 80x24, armed
resizes need a new post-request target-grid NAWS, the phase-2 checkpoint
requires no new NAWS and records same-size duplicates only, and any
unexpected size change fails. Specific differences from the calibration
probe: only the _on_naws override and its naws_size_changes recording are
added here; the windows, grids, phase bodies, document allowlist and the
literal mechanics acceptance are unchanged, and no calibration-only audit
fields are required. An offline socket-free simulation of the four-phase
NAWS/DSR/ack flow now completes with frozen grids
[[80,24],[60,12],[60,12],[80,24]].

This does not close #27 or #29, does not choose A/B/C, and does not
change product behavior; the old v1 plan, attempt marker and raw evidence
stay untouched.

Co-authored-by: JavaZeroo <71128095+JavaZeroo@users.noreply.github.com>
Ledger for the single authorized calibration retry after the dual-axis
peer contract fix: identity/environment checks stay read-only and bounded,
the fixed source deploys only to a new staging copy (src-0 and the old
plan/attempt/raw stay untouched), the display change is recorded and
restored, and the frozen new plan runs once with first-failure stop. The
v2 formal retry remains gated on a fully successful calibration.

This does not close #27 or #29 and does not choose A/B/C.

Co-authored-by: JavaZeroo <71128095+JavaZeroo@users.noreply.github.com>
@JavaZeroo
JavaZeroo merged commit 859e595 into main Nov 11, 2026
8 checks passed
JavaZeroo-Bot added a commit that referenced this pull request Nov 12, 2026
…ecord-hidden-retention-2e7373117ea0

Union both sides: keep the bounded autoscroll Qt target/CTest entry and
the #324 system paste, #333 BCD fixtures, #330/#331 packaging and
#328 eight-session capabilities with their assertions.

Co-authored-by: JavaZeroo <71128095+JavaZeroo@users.noreply.github.com>
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.

2 participants