Repository navigation
refactor(desktop): register Goals and WorkHub controller owners - #5214
Conversation
Register the existing feature-owned controller call sites and mount WorkHubRoot through the public feature entry in composition. Preserve surface selection, locale updates, and provider lifecycle with focused tests. Refs apache#4582 Generated-by: Codex
|
@Astro-Han Hi, can you check this out? Thanks |
Astro-Han
left a comment
There was a problem hiding this comment.
Approving at df7f30ee5. Verified against the contract, not just the diff: controllerOwners already gates who may call and export each controller, and both controllers have exactly one production caller on main, so registering them closes a real hole rather than adding ceremony. The workhub slot injection is forced, not decorative — once WorkHubRoot is a registered owner, workhub-surface-switch.tsx's private ./workhub-root.js import would violate "must consume WorkHubRoot through the public feature entry" (check-renderer-architecture.mjs:1940-1950). GoalProvider is already consumed through the public features/goals entry by app-shell, so registration alone is correct there. The new tests drive the real mount boundary — exclusive surface mounting, no remount across locale updates, provider presence, one ready notification, subscription cleanup. +20/−7 production is the minimal form. No findings.
中文版
已对照契约核实:两个 controller 在 main 上都只有一个生产调用方,注册堵住的是真实缺口。workhub slot 注入是被契约逼的——WorkHubRoot 一旦注册为 owner,workhub-surface-switch.tsx 的私有 ./workhub-root.js import 就违反「必须经公共入口消费」;GoalProvider 本就走公共入口,纯注册即可。新测试覆盖真实挂载边界(互斥挂载、locale 更新不重挂、provider 存在、cleanup)。+20/−7 为最小形态。无 findings。
AI assistance: I used Devin to trace the controller-owner checker rules and verify the diff; the assessment is mine.
The architecture gate on main rejected the WorkHub controller: #5214 registered WorkHubRoot as its owner while WorkHubContents still called it. Move the local highlight state and the controller into WorkHubRoot and provide the same highlight context around the existing UI. No behavior or migration impact. Fixes #5357. Generated-by: OpenAI Codex Signed-off-by: seekskyworld <[email protected]>
Summary
Goals and WorkHub already call their controllers below AppShell, but neither call site is registered in
controllerOwners. RegisteruseGoalControllerwithGoalProvideranduseWorkHubControllerwithWorkHubRoot, each with one production call, so the existing architecture gate rejects additional callers, public controller exports, and removal of the ownership contract.WorkHub's surface switch currently imports
WorkHubRootprivately, which the owner contract rejects. Composition now supplies<WorkHubRoot />through the public feature entry as the switch's WorkHub slot. Surface selection and the existing locale/Toast providers, appearance subscription, and ready notification retain their mount boundaries. The checker implementation and debt measurements are unchanged.Refs #4582
Verification
npm ciwith Node 24.19.0 and npm 11.19.0; build, typecheck, lint, format, and Desktop/UI Knip passed.upstream/mainpassed; AppShell hook gate remains 40 hooks / 65 call sites.git diff --checkpassed.main96f8e3f93; the upstream change touches only Runtime session trace projection. Its rebuilt tests, the focused Goals/WorkHub tests, and the architecture base check passed after rebase;range-diffis unchanged andmerge-treeis clean.AI use
Select exactly one:
Tool(s) and scope: OpenAI Codex implemented the registrations and composition adjustment, wrote tests, ran validation, and performed automated self-review. The commit carries a
Generated-by: Codextrailer. Automated review is not independent human approval.Checklist
Does this PR entail a change in behavior?