fix(plugin-sharing): tenancy slot 查找改用契约类型 SharingTenancyProbe —— 止血 main 上红着的 check:slot-lookup (#6100) - #6104
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 8 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 01:42
qq9340100
pushed a commit
that referenced
this pull request
Aug 7, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M7UwH25Unfi73UHim7ajY
This was referenced Aug 7, 2026
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 #6100
背景:main 上的共享损伤
PR #6067(
Fixes #5859,merge commitf226605,01:13Z 落地)在sharing-plugin.ts新增了一处tenancyslot 查找,写法是把结果擦除到any。check:slot-lookup棘轮因此在 main 上判红:该门禁跑在 ESLint job(
Lint & Type Check的 step 9,pnpm check:slot-lookup)内,所以每一个后续 PR 的 merge ref 都会带上这条红 —— 属于共享损伤,需要止血。改动(立单人的首选方案 1,最小 diff)
把那一处的类型擦除换成 该 slot 在本包里的契约类型:
SharingTenancyProbe。SharingServiceOptions.tenancy声明为() =>SharingTenancyProbe | null | undefined(sharing-service.ts)。换句话说,any擦掉的正是这个回调自己承诺的类型;补上后编译器才真的在这一行检查它。SecurityPluginreads)」—— 正是 fix(plugin-sharing): hierarchy resolver 按权威字段拿到调用方活动组织 (#5859) #6067 注释里承诺的「两层永不分歧」:SecurityPlugin读 Layer 0 wall 用的是{ posture?: TenancyPosture; isolationActive?: boolean }(security-plugin.ts),SharingTenancyProbe就是同一形状的具名版本。'tenancy'槽位的是 plugin-auth 的TenancyService(auth-plugin.ts的ctx.registerService('tenancy', tenancy)),它声明了readonly posture: TenancyPosture与readonly isolationActive: boolean,对SharingTenancyProbe结构可赋值。TenancyService,是为了不让 plugin-sharing 依赖 plugin-auth —— 开源版没有 plugin-auth 时这个 slot 本来就查不到,探针形状是刻意保持无适配器的。diff 只有两行:call site 的类型参数 + 同一条既有 import 语句里补一个
type名字。⛔ 未动SLOT_LOOKUP_UNSWEPT/scripts/check-slot-lookup-ratchet.mjs,⛔ 未 revert #6067。反向验证(方向事先预测:红 → 绿)
在同一个 worktree 里,先在未改动的
origin/main(acb10f66a)上跑,拿到上面那条红(exit 1);打上本 PR 的两行后再跑:总数 144 → 143,该文件回到基线里 grandfather 的 10 —— 棘轮没有被放宽,只是把新增的那一处扫掉了。
其它验证
pnpm --filter @objectstack/plugin-sharing typecheck→tsc --noEmit通过(exit 0)。这一条同时是「类型确实成立」的证据:如果SharingTenancyProbe与该 slot 的实际用法不符,这里就会红。pnpm --filter @objectstack/plugin-sharing test→ 13 files / 359 tests 全通过。npx eslint --no-inline-config packages/plugins/plugin-sharing/src/sharing-plugin.ts→ exit 0。node scripts/check-nul-bytes.mjs→ OK。changeset
本 PR 不带 changeset:改动是纯编译期的类型标注,TypeScript 擦除后运行时字节完全相同,既没有行为变化也没有新的发布面(
SharingTenancyProbe本来就是sharing-service.ts导出的类型)。按仓库约定它「declares no release of its own」,应走skip-changeset标签这一路 —— 该标签由 PM 座位在验收时施加(本座位按派发指令不自贴标签)。🤖 Generated with Claude Code
Generated by Claude Code