test(qa): dogfood 真实 boot 把 cacheTtl 的 private 一并钉住,不只钉 max-age (#5396) - #5411
Merged
Conversation
) showcase-declarative-endpoints.dogfood.test.ts 是整条 cacheTtl 链上唯一 观测真实 wire 的一层,而它此前只钉 /max-age=30/,漏掉了 `private` —— 链上唯一有安全含义的那一位。实测:把 computeCacheControl 临时改成 public 后,旧断言依然全绿。 改为整行钉 /^private, max-age=30$/(实测真实 wire 值就是这一整串, 无附加指令,故整行钉法不脆断)。仅此一条断言;运行时、showcase 声明、 以及 :213 那条「错误答案不得带缓存指令」的断言均未改动。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016FNvXhtSdnEGEfLEsMmvxh
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckNo hand-written docs reference the 0 changed package(s). ✅ |
baozhoutao
marked this pull request as ready for review
August 5, 2026 09:11
This was referenced Aug 5, 2026
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.
Fixes #5396
修了什么
packages/qa/dogfood/test/showcase-declarative-endpoints.dogfood.test.ts是整条cacheTtl链上唯一观测真实 wire 的一层,而它此前只钉半个头:漏掉的
private恰好是这条链上唯一有安全含义的那一位:任何一条 endpoint 响应都可能已按调用者被 RLS 裁剪,共享缓存绝不能存下来再发给别人(computeCacheControl的文档块成文,packages/runtime/src/endpoint-policy.ts:270)。改为整行钉住:
前提复核(Prime Directive「issue 是线索不是规格」)
在从
origin/main(4b61cf3be)新切的 worktree 上核对,issue 正文所述完全成立::202就是那条只钉max-age=30的断言,行号未漂移;private钉死点也都在(endpoint-policy.test.ts:312/327、api-endpoint-step.test.ts:351/524、dispatcher-plugin.endpoint-fallback.integration.test.ts:502),所以这确实是「唯一观测真实 wire 的那层比它下面几层松」,而不是一个没人守的洞 —— 观察类的定性也成立。实测的真实 wire 值(PM 口径:先测再选钉法)
PM 要求先确认真实 boot 的实际输出,若含合法附加指令导致整行钉法脆断则退回
toContain('private')。实测不需要退回:整行钉法直接绿,而一条带^...$锚的正则跑绿,本身就等价于「wire 上的值恰好是private, max-age=30这一整串」—— 无附加指令,无重排,policy 层到 socket 之间没有任何一层改写过它。故取 PM 首选的整行钉法。反向验证(方向事先声明,两条方向都测了)
预测:把 producer 的
private临时翻成public并重建@objectstack/runtime后,新断言翻红、旧断言保持绿 —— 后者正是这张单要消灭的那个盲区。实测与预测逐条一致:public(临时篡改)/max-age=30/private翻成public,这条唯一看得见 wire 的断言也不会响public(临时篡改)/^private, max-age=30$/private(已还原)/^private, max-age=30$/翻红时的实际报文,顺带把 wire 值第二次印了出来:
篡改仅存在于本地验证期间,
packages/runtime/src/endpoint-policy.ts已git checkout还原并重建 dist,最终 diff 只有测试文件一个(git status干净,grep确认 dist 回到private, max-age=)。边界(未越界)
it():断言本身 + 一段说明「为什么钉的是private这一位」的注释 + 用例名。:213(现:236)那条「错误答案不得带缓存指令」的断言。it()补了显式}, 60_000)(车道 TEST DISCIPLINE)。核对过:本文件此前只有beforeAll带120_000,各it()均无显式超时,故是补而非重复。本用例实测 26–67ms,超时纯属合并队列满载分片下的保险。同文件其余用例仍吃 vitest 默认超时 —— 属既有状况,不在本单文件面内,未顺手改。测试
均在容器共享 verify 锁下、
NODE_OPTIONS=--max-old-space-size=4096、--maxWorkers=2:changeset
纯测试改动,无用户可见行为变化 —— 按仓规走豁免路径,加
skip-changeset标签(与近日同类 test-only PR #5380 一致)。Generated by Claude Code