Repository navigation
test(context): size settlement fixture from RPC limit - #7897
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent — gpt-6.1-sol / OpenAI; runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
精确 head:5c9c58d62020d3124fa52f9b31cc95ba16d0cb85;base:867615e2c3aa2a32516a71d46f11a20d6fcb3289。完整一文件 diff 为 +9/-3,未发现阻塞项;未查询或等待 CI。
动机 / Motivation
维护 shared RPC 与 quota settlement snapshot 回归的开发者和评审者。
旧 fixture 为2,550,303字节,虽然大于旧2MiB断言,却低于当前8MiB shared RPC。运行时合法接受它,原测试因此报 DID NOT RAISE;这会把错误 fixture 当成运行时回归。
fixture 改由 MAX_REQUEST_BYTES 推导。独立真实 RPC 中,新参数为8,388,919字节:普通请求拒绝,显式 local snapshot 返回完整预期 facts,其他 method 仍拒绝这个 opt-in。生产限制和实现未改。
本 PR 仅修正已有测试输入与长度断言,不改变 RPC/本地 snapshot 容量、权限、quota 或 settlement 行为;不启动模型/科学任务、不安装、不合并。组合资格、完整 CI 和安装采用均不在本轮独立资格内。
改动思路 / Approach
先以 base 已接受的 wire budget 判断“oversized”,再构造测试输入。旧的150,000次重复和2MiB断言来自已退役阈值;继续增大一个魔法数字仍会随 shared limit 漂移。直接复用 MAX_REQUEST_BYTES、按 UTF-8 unit 字节数推导刚越界的 fixture,保留同一测试后续的 complete snapshot 和 method refusal,已经足够。无需改生产 cap、增加一个 smoke、改协议或重写大测试文件。
规范:docs/reference/canonical-snapshot-pagination.md 的 Shared RPC byte budget,不可变 spec_revision:867615e2c3aa2a32516a71d46f11a20d6fcb3289。本轮映射 wire-fixture、snapshot-optin、method-scope,三项 implemented:ordinary frame 8MiB 与64MiB显式 snapshot 的 method/权限边界是原合同;这次仅让测试触达它。
具体改动 / Changes
关键代码讲解
test_settlement_read_snapshot_is_explicit_and_preserves_complete_facts引用共享常量,以 unit 的 UTF-8 字节数计算重复次数,并断言 request 参数已大于真实 cap。原 ordinary refusal、显式 snapshot 的完整 expected facts、unsupported method refusal 三组语义断言均保留。- 未修改的
_request_with_info对实际 NDJSON envelope 做8MiB检查;只有显式 opt-in 且 method 在 allowlist 中,才可通过受限私有文件传完整参数。参数本身已越界,加入 envelope 也不会变成合法小请求。 - 未修改的
readQuotaSettlement对这个 synthetic blocked-wait schema 走既有 facts projection,未写 active Goal;测试校验原 todo_id、source/schema、observed_at、due_at 与 resume_when,而非仅校验返回形状。
对主干的风险 / Risks
我在 immutable base 执行原目标测试,实际得到 DID NOT RAISE EffectRuntimeRejected。独立隔离 RPC 再核:旧参数 2,550,303 bytes 合法接受;新参数 8,388,919 bytes 相对 8,388,608-byte cap 被普通路径拒绝;显式 snapshot 返回完整预期 facts,runtime.ping 的 snapshot 仍拒绝,原 request fingerprint 未变。生产 diff 为空;这不是把旧失败追认为通过,也没有放宽限制。
PASS:当前目标与五组 lifecycle-facts case,加完整 replan_semantics_transport module,共 11 passed;standard premerge 5 direct + 3 canaries、Ruff 全过,无 skip/hold。检查了邻近 generic/replan snapshot coverage:各自保护不同 method,当前已有 quota 测试无需新增重复 smoke。已核同来源相关 PR,未见同形测试堆叠;共享账号不等于同一作者。这里不复核私有组合轨迹,不把组合通过当成本 PR 独立证据;完整8435行模块未整跑、完整 CI 与安装采用未验证。
我的整体评价 / Verdict
有界测试修复为 goal_achieved,生产语义与长期边界 preserved;开发者的回归判断 improved。复用现有常量已是合适的局部简化,无新增 owner、状态或权限。完整 diff 只改已有测试 fixture 的构造和断言,未修改任何产品页面、布局、控件或文案。产品安装采用、模型采用和长期效果未在本轮验证。保留历史失败与未知范围;批准不授合并、安装或模型/科学任务权限。
English verdict: APPROVE — 5c9c58d62020d3124fa52f9b31cc95ba16d0cb85 sizes the existing fixture from the unchanged shared RPC limit and preserves rejection, complete snapshot readback and method-scope coverage.
The settlement snapshot rejection test built an approximately 2.4 MiB request while the shared RPC limit is 8 MiB. It therefore failed on current main because the request was accepted.
Size the fixture from
MAX_REQUEST_BYTESand assert that its serialized request exceeds that limit. Preserve the existing oversized-request rejection, explicit large-local-snapshot success path, and unsupported-method rejection. Production limits and behavior are unchanged.Validation on this head:
This is a focused test correction. Independent review, CI and merge readiness remain separate.