Skip to content

feat(runtime): /share-links 域 handler 体抽出 — ADR-0076 D11 步骤③ PR-4 (#2462)#3533

Merged
os-zhuang merged 1 commit into
mainfrom
feat/d11-step3-extract-share-links
Jul 27, 2026
Merged

feat(runtime): /share-links 域 handler 体抽出 — ADR-0076 D11 步骤③ PR-4 (#2462)#3533
os-zhuang merged 1 commit into
mainfrom
feat/d11-step3-extract-share-links

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

动机(#2462 D11 步骤③,系列第四刀)

抽出 /share-links(ADR-0047 capability-token 分享面)。这是 cloud per-env kernel 的设计主面registerShareLinkRoutes: false,host dispatcher 在 kernel swap 后服务——步骤① re-scope 的关键发现),行为保真是本刀的全部意义。

改动

  • domains/share-links.ts:186 行体逐字搬迁(公共 resolve/messages 的 token 即授权语义、SYSTEM_CTX 取记录 + redactFields 剥除、管理路由鉴权分层全保留)。
  • DomainHandlerDeps 扩两个方法:
    • getRequestKernelService——从 per-request 已解析 kernel 读服务(非 defaultKernel、非 scoped-factory 路径):token 行与被分享记录必须和 shareLinks 服务绑定的 engine 同库。域侧 getEngine 保留原 try/fallback 形状。
    • routeNotFound——共享 404 envelope(dispatcher 内 4 处使用)。
  • dispatcher 薄委托保留;与域模块重复的 JSDoc 去重。
  • packages 域有意不在本刀:其全家桶约 680 行(含仅它使用的 applyPublishedSeeds/assemblePackageManifest)且刚被步骤② feat(runtime): /discovery 单一归属 + /packages 统一管线(ADR-0076 D11 步骤②) #3142 改过管线,单独成刀便于审阅。

验证

接缝套件 30 测试(新增 5:无服务 501 / segment 边界 / 匿名 UNAUTHENTICATED / 公共 token-resolve 含 redaction 剥除 / ROUTE_NOT_FOUND envelope);runtime 全量 635 绿;http-conformance 41 断言绿;下游闭包 --force 含 DTS 全绿。

关联 #2462(D11 步骤③ PR-4)。剩余域:/packages(下一刀)+ 大头(/automation /actions /auth /meta /data /mcp /ai)。

🤖 Generated with Claude Code

… D11 step ③ PR-4 (#2462)

The ADR-0047 capability-token surface moves to domains/share-links.ts.
This is cloud's designed PRIMARY surface for per-env kernels
(registerShareLinkRoutes:false; host dispatcher serves after kernel swap
— the #2462 step-① re-scope finding), so behavior preservation is the
whole game here.

- DomainHandlerDeps grows getRequestKernelService: reads off the
  per-request RESOLVED kernel (this.kernel), NOT the default kernel and
  NOT the scoped-factory path — the token row and shared record must
  live in the same store as the shareLinks service's engine. The
  domain-side getEngine keeps the original try/fallback shape.
- deps also grows routeNotFound (the shared 404 envelope, 4 call sites
  in the dispatcher).
- Dispatcher keeps a thin handleShareLinks delegate; duplicated JSDoc
  removed in favor of the domain module's copy.

Verified: seam suite 30 tests (5 new: 501 absent-service, segment
boundary, UNAUTHENTICATED, public token-resolve with redaction,
ROUTE_NOT_FOUND envelope), runtime 635 green, http-conformance 41
green, dependent closure builds with DTS (--force).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Building Building Preview, Comment Jul 27, 2026 2:52am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling size/l labels Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/runtime.

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

  • content/docs/api/index.mdx (via @objectstack/runtime)
  • content/docs/api/wire-format.mdx (via @objectstack/runtime)
  • content/docs/automation/hook-bodies.mdx (via @objectstack/runtime)
  • content/docs/concepts/north-star.mdx (via packages/runtime)
  • content/docs/data-modeling/drivers.mdx (via @objectstack/runtime)
  • content/docs/deployment/index.mdx (via @objectstack/runtime)
  • content/docs/deployment/production-readiness.mdx (via @objectstack/runtime)
  • content/docs/deployment/single-project-mode.mdx (via @objectstack/runtime)
  • content/docs/deployment/vercel.mdx (via @objectstack/runtime)
  • content/docs/getting-started/your-first-project.mdx (via @objectstack/runtime)
  • content/docs/permissions/authentication.mdx (via @objectstack/runtime)
  • content/docs/permissions/authorization.mdx (via packages/runtime)
  • content/docs/plugins/packages.mdx (via @objectstack/runtime)
  • content/docs/protocol/kernel/http-protocol.mdx (via @objectstack/runtime)
  • content/docs/protocol/kernel/index.mdx (via @objectstack/runtime)
  • content/docs/protocol/kernel/lifecycle.mdx (via @objectstack/runtime)
  • content/docs/releases/implementation-status.mdx (via @objectstack/runtime)

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.

@os-zhuang
os-zhuang merged commit cb8322e into main Jul 27, 2026
15 of 16 checks passed
@os-zhuang
os-zhuang deleted the feat/d11-step3-extract-share-links branch July 27, 2026 03:01
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/l tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant