Skip to content

refactor(desktop): register Goals and WorkHub controller owners - #5214

Merged
Astro-Han merged 1 commit into
apache:mainfrom
chihumyum:test/goals-workhub-controller-owners
Sep 15, 2026
Merged

Astro-Han merged 1 commit into
apache:mainfrom
chihumyum:test/goals-workhub-controller-owners

Conversation

@chihumyum

Copy link
Copy Markdown
Contributor

Summary

Goals and WorkHub already call their controllers below AppShell, but neither call site is registered in controllerOwners. Register useGoalController with GoalProvider and useWorkHubController with WorkHubRoot, 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 WorkHubRoot privately, 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

  • Fresh npm ci with Node 24.19.0 and npm 11.19.0; build, typecheck, lint, format, and Desktop/UI Knip passed.
  • Architecture fixtures: 103/103. Architecture check against upstream/main passed; AppShell hook gate remains 40 hooks / 65 call sites.
  • Desktop suite: 2,498/2,498. The two new surface tests verify exclusive mounting, locale propagation without remounting, Toast context, one ready notification, and subscription cleanup. Removing the Toast provider makes the new test fail.
  • Temporary copies of the real source: for each controller, a second production caller and public export pass without registration and fail with it; removing either registration fails against the registered base (6/6 rejection checks). Restored source passes.
  • Windows test inventory, ASF headers, Astryx inventory, and git diff --check passed.
  • Rebased onto main 96f8e3f93; 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-diff is unchanged and merge-tree is clean.
  • Electron E2E was not run locally; hosted CI runs it.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

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: Codex trailer. Automated review is not independent human approval.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — the architecture gate now enforces the two existing controller owners; runtime product behavior is preserved.
  • No

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
@github-actions github-actions Bot added the effort/M Under 500 readable lines label Sep 12, 2026
@chihumyum

Copy link
Copy Markdown
Contributor Author

@Astro-Han Hi, can you check this out? Thanks

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Astro-Han
Astro-Han merged commit 3dcf5a1 into apache:main Sep 15, 2026
2 checks passed
Astro-Han pushed a commit that referenced this pull request Sep 15, 2026
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]>
@chihumyum
chihumyum deleted the test/goals-workhub-controller-owners branch September 17, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants