refactor(runtime)!: 退役 runtime 导出的 HttpServer 委派包装器 (#5122) - #6141
Merged
Conversation
…#5122) `HttpServer implements IHttpServer` forwarded only the contract's REQUIRED members, so `getPort` / `getRawApp` / `setFallbackHandler` all read as absent to the `typeof x === 'function'` probe the contract prescribes — a wrapped adapter lost every optional capability it actually provided. Since #5111 `setFallbackHandler` is the only entry path for declarative `apis:` endpoints, so wrapping a capable adapter would 404 every declared endpoint silently. `new HttpServer(` had zero occurrences repo-wide (examples included), so the 2026-08-06 maintainer ruling retires the class per the #4939 `ApiRegistry` precedent + ADR-0049's remove side, rather than growing a forwarding surface nobody composes. - delete packages/runtime/src/http-server.ts and its barrel export - pin the absence at runtime (http-server-retirement.test.ts) with anti-vacuity guards; a compile-time pin is inert here (tsconfig excludes **/*.test.ts, #4311/#4642) - changeset: @objectstack/runtime major, with the migration note and the #5111 fact recorded so the wrapper is not reinvented Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wbxm29qPKnLf44AbSxizqW
…ire-httpserver-wrapper
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 21 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
qq9340100
marked this pull request as ready for review
August 7, 2026 03:34
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 #5122
按 2026-08-06 维护者裁决退役
@objectstack/runtime导出的HttpServer委派包装器(#4939「从未被装配的件退役优于修」先例 + ADR-0049 remove 侧)。⛔ 不做条件转发,⛔ 不做「维持 + 文档标注」。前提复核(在最新
origin/main上)packages/runtime/src/http-server.ts的class HttpServer implements IHttpServer仍是只转发必选成员的形态(get/post/put/delete/patch/use/listen/close),getPort?/getRawApp?/setFallbackHandler?一个都不转发 —— 与 issue 描述一致。new HttpServer(全仓(含examples/)零命中。反查对照用同族邻居new HonoHttpServer(命中 20+ 处,证明搜索本身有效,不是空搜。packages/runtime/src/index.ts:48的 barrel 导出。没有测试构造过它(packages/runtime/src/下无http-server.test.ts),scripts/adr-anchors.json未锚定它,也没有任何 baseline/ledger 记名。改动
packages/runtime/src/http-server.ts。IHttpServer适配器实例为http.server(每个真实 host 本来就是这么做的),防止同型包装器被复刻。packages/runtime/src/http-server-retirement.test.ts—— 运行期缺席钉子(3 条),带反空转守卫。@objectstack/runtimemajor(public API 移除),正文含迁移表、以及「E7(#5040 执行器):翻转 —— publish 硬拒收窄为「不支持子集 + 命名空间门」,声明式端点随 v17 放行执行 #5111 之后setFallbackHandler是声明式apis:端点唯一通路」这一事实 —— 这句话存在的目的就是阻止未来有人再造一个丢弃可选成员的同型包装器。fix(runtime): 无setFallbackHandler的适配器改以warn宣告声明式端点不可达 (#5400) #5409 已落的 warn 宣告继续作为 runtime 侧兜底(它能点名 seam 缺席,但点不出吞掉 seam 的包装器,所以两者不重复)。为什么钉子是运行期探测而不是类型级
packages/runtime/tsconfig.json排除了**/*.test.ts,tsc --noEmit读的就是这份配置,vitest 又从不做类型检查(#4311)—— 这正是 #4642 记录的陷阱:类型级钉子在这里是空转的。所以用 namespace 探测 + 反空转守卫(barrel 导出数量下限 +Runtime在场),并额外钉住源文件不存在(防止它以「不导出的私有包装器」形态回来),该断言自己也带路径反空转守卫(邻居http-dispatcher.ts必须在)。barrel 用静态 namespace 导入而非用例内
await import():这个 barrel 冷启动要几秒,放进用例会撞 vitest 5s 默认超时 —— 那是 flake,不是发现(第一版就撞了)。反向验证(方向在运行前先行预测)
预测:把删掉的类文件与 barrel 导出同时还原,两条移除钉子应转红(它们读的是「在场」谓词,不是可以靠「什么都不产出」蒙混过关的计数),而第三条「邻居导出仍在」应保持绿——它是反空转搭档,不是移除钉子。
实测与预测一致:
随后已还原为移除态。
验证
合入
origin/main(含已合并的 #6122)后重跑:刻意未做
@objectstack/http-conformance的setFallbackHandler断言(ADR-0076 OQ#10):裁决写的是「随退役 PR 顺手或另拆」,实测不顺手 —— 参考适配器NodeHttpServer目前不实现该成员,所以想让断言有意义,要么先给第二个适配器补实现(那是功能 PR,不是移除 PR),要么写一条只跑 Hono 的条件用例(那对「跨适配器一致」什么也没证明)。已另拆为 [finding]@objectstack/http-conformance对IHttpServer.setFallbackHandler零断言 —— ADR-0076 OQ#10 的落点仍空着 #6143(finding,未入队)。docs/adr/0004-cloud-multi-kernel.md:76提到RestServer/HttpServer:那是一份已接受 ADR 的历史记录,退役不推翻它的决定,按 Prime Directive [WIP] Add Chinese version of the documentation #13 不在代码 PR 里改写 ADR 正文。packages/runtime/src/dispatcher-plugin.ts:与已合并的 fix(runtime,types)!:/analytics/query不再回显 RLS 策略字段名 —— 声明式 server-fault withhold 提升为两个边界共享 (#5811) #6122 面不相交,本 PR 未触碰(已把origin/main合入本分支,fix(runtime,types)!:/analytics/query不再回显 RLS 策略字段名 —— 声明式 server-fault withhold 提升为两个边界共享 (#5811) #6122 已在其中,零冲突)。content/docs/releases/:未触碰。🤖 Generated with Claude Code
https://claude.ai/code/session_01Wbxm29qPKnLf44AbSxizqW