Skip to content

feat(runtime): /discovery 单一归属 + /packages 统一管线(ADR-0076 D11 步骤②) - #3142

Merged
os-zhuang merged 1 commit into
mainfrom
claude/objectql-protocol-layering-s2sn67
Jul 17, 2026
Merged

feat(runtime): /discovery 单一归属 + /packages 统一管线(ADR-0076 D11 步骤②)#3142
os-zhuang merged 1 commit into
mainfrom
claude/objectql-protocol-layering-s2sn67

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

背景

OQ#9 审计(#2462, ADR-0076)确认 discoverypackages 是 REST server 与 dispatcher bridge 之间仅有的两处真双挂载,先注册者赢——客户端看到哪个实现取决于插件启动顺序。本 PR 落地 D11 worklist 步骤②「packages + discovery 单一归属」。

变更

  • core:新增公共 kernel.hasPlugin(name)——注册在任何 start() 之前同步完成,插件可在自身 start() 中做确定性的组合判断。
  • dispatcher bridge(discovery 单一归属):当 com.objectstack.rest.api 已注册时,让出 ${prefix}/discovery(REST 为确定性 owner);无 REST 的组合中保留兜底注册。/.well-known/objectstack 始终由 dispatcher 独有(无其他注册方)。
  • dispatcher bridge(packages 统一管线)/packages 全家族路由改走 dispatch()(与 analytics/i18n/automation/AI 一致),不再直连 handlePackages()——显式挂载与 cloud host 的 createHonoApp catch-all 两个入口共享同一条 per-request 管线(kernel 解析、身份解析、auth gate)。顺带修复:直连路径多处丢弃 req.query,文档化的 ?overwrite=true 安装标志在挂载路由上从未生效。
  • 测试:新增「REST 在场时让出 /api/v1/discovery、保留 /.well-known」回归用例;原有 discovery no-store / PATCH packages 用例不变仍绿。
  • ADR-0076 OQ#9:记录步骤②落地,并重新界定步骤①——跨仓核查发现"死分支"实为 cloud host 经 catch-all 的兜底织物(/share-links 是 per-env kernel 的设计主通道,cloud 两处注释明确记载;/notifications 在任何地方都没有其他 HTTP owner),kill 需等步骤③(per-domain handlers)取代 catch-all 之后。

验证

  • @objectstack/core 360、@objectstack/runtime 546、@objectstack/rest 298、@objectstack/http-conformance 41(双 adapter 集成门禁)全绿

Refs #2462(ADR-0076 D11)

🤖 Generated with Claude Code

https://claude.ai/code/session_01A1BtxNeUaGmvUYr8FwtUNu


Generated by Claude Code

…es (ADR-0076 D11 step 2)
OQ#9 flagged discovery and packages as the two genuinely double-mounted
domains between the REST server and the dispatcher bridge, with
first-registration-wins deciding which implementation a client saw.
- kernel: new public hasPlugin(name) — plugins can make composition-
dependent decisions deterministically during their own start().
- dispatcher bridge: cede ${prefix}/discovery to com.objectstack.rest.api
when that plugin is registered; keep it only as the fallback owner in
REST-less compositions. /.well-known/objectstack stays dispatcher-owned
(no other registrant).
- dispatcher bridge: the /packages route family now flows through
dispatch() (like analytics/i18n/automation/AI) instead of calling
handlePackages() directly, so the explicit mounts and the cloud hosts'
@objectstack/hono catch-all share one per-request pipeline (kernel
resolution, identity, auth gate). The direct path also dropped
req.query on several routes — the documented ?overwrite=true install
flag never reached the handler over the mounted routes.
- ADR-0076 OQ#9: record step 2 as shipped and re-scope step 1 with the
cross-repo finding — the 'dead' dispatch() branches are the cloud
hosts' fallback fabric via the createHonoApp catch-all (/share-links
is the designed primary surface for per-env kernels; /notifications
has no other HTTP owner), so killing them waits for per-domain
handlers (step 3).
Refs #2462
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A1BtxNeUaGmvUYr8FwtUNu
@vercel

vercelBot commented Jul 17, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
specBuildingBuildingPreview, CommentJul 17, 2026 1:07pm

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests size/m labels Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/core, @objectstack/runtime.

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

  • content/docs/ai/actions-as-tools.mdx(via @objectstack/core)
  • content/docs/ai/knowledge-rag.mdx(via @objectstack/core)
  • content/docs/ai/natural-language-queries.mdx(via @objectstack/core)
  • 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/automation/webhooks.mdx(via @objectstack/core)
  • content/docs/concepts/north-star.mdx(via packages/core, packages/runtime)
  • content/docs/data-modeling/drivers.mdx(via @objectstack/runtime)
  • content/docs/deployment/index.mdx(via @objectstack/runtime)
  • content/docs/deployment/migration-from-objectql.mdx(via @objectstack/core)
  • 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/kernel/contracts/index.mdx(via @objectstack/core)
  • content/docs/kernel/runtime-services/examples.mdx(via @objectstack/core)
  • content/docs/kernel/services-checklist.mdx(via @objectstack/core)
  • content/docs/kernel/services.mdx(via @objectstack/core)
  • content/docs/permissions/authentication.mdx(via @objectstack/core, @objectstack/runtime)
  • content/docs/permissions/authorization.mdx(via packages/core)
  • content/docs/plugins/anatomy.mdx(via @objectstack/core)
  • content/docs/plugins/development.mdx(via @objectstack/core)
  • content/docs/plugins/index.mdx(via @objectstack/core)
  • content/docs/plugins/packages.mdx(via @objectstack/core, @objectstack/runtime)
  • content/docs/protocol/kernel/config-resolution.mdx(via @objectstack/core)
  • content/docs/protocol/kernel/http-protocol.mdx(via @objectstack/runtime)
  • content/docs/protocol/kernel/index.mdx(via @objectstack/core, @objectstack/runtime)
  • content/docs/protocol/kernel/lifecycle.mdx(via @objectstack/core, @objectstack/runtime)
  • content/docs/protocol/kernel/plugin-spec.mdx(via @objectstack/core)
  • content/docs/releases/implementation-status.mdx(via @objectstack/core, @objectstack/runtime)
  • content/docs/releases/v15.mdx(via @objectstack/core)

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 marked this pull request as ready for review July 17, 2026 13:43
@os-zhuang
os-zhuang merged commit 09b18f5 into mainJul 17, 2026
15 of 16 checks passed
@os-zhuang
os-zhuang deleted the claude/objectql-protocol-layering-s2sn67 branch July 17, 2026 13:43
os-zhuang added a commit that referenced this pull request Jul 27, 2026
…1 step ③ PR-5 (#2462) (#3537)
The largest extraction so far: handlePackages (~470 lines) plus its two
EXCLUSIVE helpers assemblePackageManifest and applyPublishedSeeds
(~190 more) move to domains/packages.ts. resolveActiveOrganizationId
stays on the dispatcher (metadata-domain call sites share it) and is
exposed through deps instead.
DomainHandlerDeps grows: errorFromThrown (spec-validation issues carry
through as field-anchored 422s), resolveActiveOrganizationId,
announceKernelEvent (the metadata:reloaded publish announcement — the
domain keeps the changed-list check, the deps side owns the
trigger-existence check), and optional logger (seed-loader falls back
to console as before). The dynamic './seed-loader.js' import moved to
'../seed-loader.js' (the PR#2415 lesson: dynamic imports are the
extraction landmine — this time the import moved WITH the caller).
Step-② (#3142) single-pipeline behavior preserved; the '/packages'
bare-startsWith match is reproduced as-is.
Verified: seam suite 34 tests (4 new incl. the 409 duplicate-install
guard + ?overwrite=true), runtime 639 green, http-conformance 41 green,
dependent closure builds with DTS (--force).
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mtests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@os-zhuang@claude