Repository navigation
feat(api): negotiate compression, add ETag/304 and stale-while-revalidate purges / API 协商压缩,支持 ETag/304 与 stale-while-revalidate 失效 - #1546
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Oct 28, 2026
Merged
Patch [email protected] through root patchedDependencies. Unpatched, the self-hosted optimizer reads a local source image through a mocked request that reuses the browser socket. When the browser cancels the image, the read is dropped and every later request for that variant hangs until the server restarts. A unit test fails if a Next upgrade loses the patch, and the unit and E2E workflows now run when patches/ changes. 中文:通过根目录 patchedDependencies 为 [email protected] 打补丁。未打补丁时, 自托管图片优化器复用浏览器 socket 读取本地源图,浏览器取消请求后读取被丢弃, 同一尺寸的后续请求会一直挂起,直到服务重启。新增单元测试在升级 Next 丢失补丁 时失败,patches/ 变更也会触发单元测试与 E2E 工作流。
…mediately cachedJson now takes the request. It answers with brotli, gzip or plain JSON per Accept-Encoding, always sends Vary and a strong ETag, and returns 304 for a matching If-None-Match. Browsers reuse a response for 60 s. Route data, ISR page data (db-page) and CDN responses (db-cdn) carry separate tags, so an ingest expires route data at once and lets pages and the CDN refresh in the background. purgeAll, purgeCollectiveX and purgeOperatorX accept immediate, exposed through /api/v1/invalidate and the admin scripts. Fixture builds send no-store. The ingest and deploy workflows warm the dashboard APIs with a browser Accept-Encoding. The datasets route shares a per-slug cache helper. Docs, API reference text and catalog digests follow. 中文:cachedJson 改为接收请求对象,按 Accept-Encoding 返回 brotli、gzip 或 未压缩 JSON,并始终携带 Vary 与强 ETag,命中 If-None-Match 时返回 304;浏览器 复用响应 60 秒。路由数据、ISR 页面数据(db-page)与 CDN 响应(db-cdn)使用 独立标签,ingest 后路由数据立即失效,页面与 CDN 在后台刷新。purgeAll、 purgeCollectiveX、purgeOperatorX 支持 immediate,并通过 /api/v1/invalidate 与管理脚本提供。fixture 构建返回 no-store。ingest 与部署工作流以浏览器的 Accept-Encoding 预热仪表板 API。datasets 路由改用按 slug 共享的缓存。同步更新 文档、API 参考文案与路由目录摘要。
adibarra
force-pushed
the
fix/next-image-optimizer-hang
branch
from
October 29, 2026 02:06
153ffcf to
d78bbd5
Compare
adibarra
force-pushed
the
feat/api-response-caching
branch
from
October 29, 2026 02:06
e645ff3 to
3a1c60d
Compare
中文:将 master 合并到 feat/api-response-caching
中文:将 master 合并到 feat/api-response-caching
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b3fe7a0. Configure here.
After an ingest the CDN still serves the previous availability payload once, so the warmup missed the newest run date. It now sends Pragma/Cache-Control no-cache for that lookup. 中文:预热 dashboard 日期前重新验证 availability。数据导入后 CDN 仍会返回一次旧的 availability,导致预热遗漏最新日期;现在该请求会带上 Pragma/Cache-Control: no-cache。
中文:针对 master 重新运行 CI
hbarclay
added a commit
that referenced
this pull request
Oct 29, 2026
Keeps the intent of master's OperatorX changes in this PR's additions: - #1561 (one GPU control): no GPU multi-select; the controls row is Workload, Devices, Metric, Baseline, and the chart legends offer the GPUs with results at the selected split - #1562 (Roofline first): Model View's op dialog also shows Roofline before Metric vs size; the OperatorX e2e spec now expects Roofline to mount first and scrolls to Metric vs size, which mounts on approach - #1555 (analytics): the Devices selector and Model View's model, metric, precision, GPU, op and fold controls are tracked with canonical keys - #1546 (compression, ETag): the public data API passes the request to cachedJson - route catalog digests, views registry and skills reference merged Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch was successfully deployed
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.

Summary
Part 2 of the stack split from #1530. Review and merge in order. CI only runs on PRs that target
master, so each layer was verified locally; the combined change passed full CI on #1530.Stack (merge in order):
Dashboard API responses were gzip-only with
max-age=0and no ETag, so browsers downloaded multi-MB payloads on every visit. Every ingest also hard-expired all caches, which made the next visitor wait for a cold rebuild.cachedJson(request, …)picks br, gzip or identity fromAccept-Encoding. It always sendsVary: Accept-Encoding, sets a strong ETag, and answers a matchingIf-None-Matchwith 304. Browsers reuse responses for 60 s. CDNs-maxageis unchanged.db), ISR page data (db-page) and CDN responses (db-cdn) are tagged separately. An ingest expires route data immediately and marks page data and CDN responses stale, so visitors get the previous response once while fresh data loads.purgeAll,purgeCollectiveXandpurgeOperatorXacceptimmediate./api/v1/invalidate?immediate=trueandinvalidate-cache.ts --immediateexpose it, andapply-run-overrides/cache-refreshuse it for corrections. CollectiveX deletions purge immediately.Risks
E2E_FIXTURES=1) sendno-storeso Cypress intercepts see every request. E2E therefore doesn't exercise browser reuse; unit tests cover it.work-async-storage.external).Vary, and 304s were served from a CDN HIT. Still unverified: whether a gzip-only client can get a cached br variant, and whetherPragma: no-cacheforces revalidation.Validation details
Targeted Cypress on a fixtures build (Chrome): historical-trends 18/18, model-route-slugs 10/10, inference-chart 39/39, evaluation-chart 13/13.
packages/dbvitest passes. Lint, format, typecheck and the full unit suite pass on this layer.AI model disclosure
anthropic/claude-opus-5-5(runtime-exposed identifier for the coordinating agent).PR checklist
inferencex-skillschanges (no filters or views change)/zhsiblingdocs/chinese-copy.md(Chinese maintainer review pending)中文
本 PR 为从 #1530 拆分的 stack 中的第 2 部分,请按顺序审核与合并。CI 只在以
master为目标的 PR 上运行,因此每一层都在本地验证;整体改动已在 #1530 上通过完整 CI。Dashboard API 响应此前仅支持 gzip、
max-age=0且没有 ETag,浏览器每次访问都会重新下载数 MB 数据;每次数据导入还会强制清空所有缓存,下一位访问者需要等待冷启动重建。cachedJson(request, …)按Accept-Encoding选择 br、gzip 或 identity,始终返回Vary: Accept-Encoding,设置强 ETag,并对匹配的If-None-Match返回 304。浏览器复用 60 秒,CDNs-maxage不变。db)、ISR 页面数据(db-page)与 CDN 响应(db-cdn)分开打标签。数据导入时立即使路由数据过期,页面数据与 CDN 响应仅标记为过时,访问者在新数据加载期间先拿到旧响应。purgeAll、purgeCollectiveX、purgeOperatorX支持immediate,可通过/api/v1/invalidate?immediate=true与invalidate-cache.ts --immediate调用;apply-run-overrides与cache-refresh在数据更正时使用;CollectiveX 删除操作立即清除。风险
E2E_FIXTURES=1)返回no-store,以便 Cypress 拦截每个请求,因此 E2E 不覆盖浏览器缓存复用,由单元测试覆盖。work-async-storage.external)。Vary,以及 CDN 命中时返回 304;仍未确认仅支持 gzip 的客户端是否可能拿到缓存的 br 版本,以及Pragma: no-cache是否会强制重新验证。验证:fixture 构建上的定向 Cypress(Chrome):historical-trends 18/18、model-route-slugs 10/10、inference-chart 39/39、evaluation-chart 13/13;
packages/db单元测试通过。本层的 lint、格式、类型检查与完整单元测试均通过。AI 模型使用说明:协调 agent 使用
anthropic/claude-opus-5-5(运行环境提供的标识),负责审计、规划与整合改动、拆分 stack 以及撰写提交与 PR 文本;委派的子 agent 在同一环境中实现各部分、构建 stack 并运行验证,其确切模型标识无法获取,因此无法确认。Note
Medium Risk
Changes core CDN/server invalidation and response shaping for most public APIs; incorrect purge or encoding behavior could briefly serve stale benchmark data or break clients, though behavior is heavily unit-tested.
Overview
Dashboard API responses now go through
cachedJson(request, …), which negotiates brotli/gzip/identity fromAccept-Encoding, addsVary: Accept-Encoding, a strong ETag, and 304 on matchingIf-None-Match, and usesmax-age=60for browsers while keeping the one-day CDN TTL. CDN entries are taggeddb-cdnseparately from serverdband ISRdb-pagecaches; normal ingests expire route data immediately but only mark page/CDN tags stale so one more stale response can be served while refresh runs.?immediate=true(CLI--immediate, corrections, CollectiveX deletions) hard-expires every layer so retracted data is never served again.CI and ops wire this up: ingest runs
admin:cache:warmup --dashboard, deploy warmup checks out the repo and warms dashboard APIs plus more top pages with browserAccept-Encoding, and the warmup script reads full bodies and can target dashboard-only paths. Internal view routes usesourceRequest()(noAccept-Encoding) so in-process handler calls always get plain JSON;/api/v1/datasets/[slug]shares a per-slug cached reader with AgentX pages.Fixture mode sends
Cache-Control: no-store. Docs, API catalog digests, and targeted Cypress waits are updated for the new caching behavior.Reviewed by Cursor Bugbot for commit c139ce0. Bugbot is set up for automated code reviews on this repo. Configure here.