Skip to content

test(dogfood): 把 temporal 这条线固化成端到端门禁;docs 审计范围传错时立即报错 - #4077

Merged
os-zhuang merged 2 commits into
mainfrom
claude/sqlite-datetime-filter-empty-hradlv
Jul 30, 2026
Merged

os-zhuang merged 2 commits into
mainfrom
claude/sqlite-datetime-filter-empty-hradlv

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

temporal 线的两项收尾,针对同一个弱点:静默的失败没人会发现。

1. temporal-storage-e2e.dogfood.test.ts

把真正抓到 #3912 / #3928 / #3994 / #4033 的四项验证变成常设门禁。

这几个 bug 有个共同签名,正是单测结构性抓不到的:driver、strategy、读路径各自内部自洽,各层自己的测试全绿;不一致的是「一个值在层与层之间物理上到底是什么」。症状因此都很安静 —— 列表里有这条记录、图上画出了柱子,只有筛选/排序/标签那一面是错的。所以断言全部走真实 HTTP 读写路径:

  • 日期窗口返回窗口内的行([17.0.0-rc.0] SQLite datetime window filters return empty: filter comparands coerced to epoch-ms while writes store ISO TEXT #3912 最初的报障就是 dashboard dateRange 返空),且 23:30Z / 00:30Z 保持 UTC 日历日 —— 这两个时刻会被 naive 写路径往相反方向移动,因此无论宿主时区如何,任一方向的偏移都会被抓到
  • 时间列排序双向正确,且两个方向必须不同(否则一个被静默忽略的排序参数也能蒙混过关 —— 这轮我真的被它骗过一次)
  • Field.time 全部可接受输入形态收敛到同一个存储墙钟,等值过滤不会因写入者的拼法而分裂
  • timeDimensions 分桶带着标签返回

对抗性验证:把 #4033 的 projectedDimensions() 回退后,只有 analytics 那条变红、其余 7 条仍绿 —— 证明这个门测的确实是它声称的那道缝,不是恰好通过。

一处刻意的取舍:不发送 epoch 毫秒给 time 字段。校验层对此返回 400 invalid_time,这是对的 —— driver 的 epoch 处理是给内部绑定 Date 的写入方兜底,不是给 API 客户端的。这条边界本身也一并固化,免得 driver 的宽容被误当成合法的 wire 形态。

2. .claude/workflows/docs-accuracy-audit.js

范围回落不再吞掉调用方的错误。

原来 args.docs ?: ALL_HANDWRITTEN 同时覆盖了「审全部」和「你参数传错了」两种情况。Workflow 工具原样传递 args,所以传成 JSON 字符串时 args.docs 为 undefined,一个 12 篇的请求被静默放大成全部 147 篇、烧掉约 294 个 agent,而输出里没有任何一句提示范围被忽略了。

现在:不传 args 仍是合法的全量审计;传了但 args.docs 不可用则抛错;两种情况都会 log() 出最终范围。

六种输入形态逐一验证(隔离验证,没有真跑 workflow —— 那正是要防的那支舰队):

输入 行为
不传 ✅ 146 篇(全量)
{docs:[a,b]} ✅ 2 篇
JSON 字符串(我踩的坑) ❌ 抛错
{docs:"a.mdx"} ❌ 抛错
{docs:[]} ❌ 抛错
{focus:...} 无 docs ✅ 146 篇

验证

🤖 Generated with Claude Code

https://claude.ai/code/session_01TPxNwPnjcn599ujXpU3ibJ


Generated by Claude Code

…on a mis-scoped docs audit

Two follow-ups from the temporal line, both aimed at the same weakness: a
failure that is silent is a failure nobody finds.

1. temporal-storage-e2e.dogfood.test.ts — the four verifications that actually
   caught #3912/#3928/#3994/#4033, turned into a gate. Every one of those bugs
   passed its own layer's unit tests: the driver, the strategy and the read
   path were each internally consistent, and what disagreed was what a value
   physically IS between them. The symptoms were correspondingly quiet — the
   list showed the row, the chart drew the bar, only the filtered/sorted/
   labelled view was wrong. So the assertions run through the real HTTP write
   and read path:
     - a date window returns the rows inside it (the original #3912 report was
       a dashboard dateRange returning empty), and 23:30Z / 00:30Z keep their
       UTC calendar day — two instants a naive write path shifts in opposite
       directions, so either direction is caught regardless of host zone;
     - a temporal column sorts chronologically both ways, and the two
       directions must differ (a silently-ignored sort would otherwise pass);
     - every accepted Field.time input shape converges on one stored wall
       clock, and an equality filter cannot be split by the writer's spelling;
     - a timeDimensions bucket reaches the caller with its label.
   Verified adversarially: reverting #4033's projectedDimensions() turns the
   analytics case red and nothing else, so the gate tests the seam it claims.

   The suite deliberately does NOT send epoch milliseconds for a time field.
   The record validator answers that with 400 invalid_time and should — the
   driver's epoch handling defends an in-process writer binding a Date, not an
   API client. That boundary is now pinned too, so the driver's leniency is
   never mistaken for an accepted wire shape.

2. .claude/workflows/docs-accuracy-audit.js — the scope fallback no longer
   swallows a caller mistake. `args.docs ?: ALL_HANDWRITTEN` covered both
   "audit everything" and "your args were malformed", and the Workflow tool
   delivers args verbatim: passing a JSON-encoded string left args.docs
   undefined, silently widened a 12-doc request to all 147, and burned ~294
   agents with nothing in the output saying the scope had been ignored.
   Omitting args entirely still means a full audit; supplying an unusable
   args.docs now throws, and the resolved scope is logged either way.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TPxNwPnjcn599ujXpU3ibJ
@vercel

vercel Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectstack Ignored Ignored Jul 30, 2026 8:43am

Request Review

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Jul 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): packages/qa.

2 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/permissions/authorization.mdx (via packages/qa)
  • content/docs/permissions/delegated-administration.mdx (via packages/qa)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

…not the field-level literal

`check-error-code-casing` (ADR-0112 D1) flagged the lowercase 'invalid_time'
in a comparison position. The literal is a legitimate D6 field-addressed
validator code, so an EXEMPT_FILES entry would have been sanctioned — but the
assertion is strictly better without it: the standard SCREAMING envelope code
plus the offending field name IS the boundary contract, and pinning the
field-level code adds no assurance while costing an exemption the next reader
has to interpret.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TPxNwPnjcn599ujXpU3ibJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants