Uh oh!
There was an error while loading. Please reload this page.
refactor(desktop): remove unused Usage preload bridge - #2038
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
Approve — verified in a local worktree; every claim in the description reproduces.
Verified
- No renderer / Storybook / E2E consumer of
window.maka.usageanywhere in the repo; the six removed types have no remaining references inbridge-contract.d.ts/preload.ts. settings.usageStatsstill powers the Usage page and remains protected by the exact-parity branch of the contract test.- All six
usage:*handlers stay registered inusage-ipc-main.ts; the retained-set assertion pins them. - Reproduced validation:
build:test, bothnode --testruns (3/3 pass),test:checks,lint,git diff --check, plus full desktoptypecheck(preload/main/renderer/storybook). - The full desktop suite has 8 failures, but the identical set fails on a
mainbaseline — pre-existing environment issue, unrelated to this PR.
Non-blocking comments
- Branch is 2 commits behind
main(base1705111c8vs61a0ca1f5); the diff applies cleanly, but please rebase before merge. usage:pricing:changedis still sent to the renderer with no listener (pre-existing — it never had one). When #2015/#2010 wires the Runtime Host Desktop adapter, either add the subscription or drop the send.- The retained-set assertion requires exact equality, so a future 7th Main-only channel will fail CI until the allowlist is extended in the same PR. A one-line comment on
RETAINED_MAIN_ONLY_CHANNELSpointing at #2015 would make that coordination explicit for the next author.
f1c18b7 to
0cc726eCompareme2seeks
commented
Aug 4, 2026
Thanks for the detailed review. I rebased onto current main and added the ownership note above For |
Astro-Han
commented
Aug 4, 2026
This overlaps with #2065, which has merged (af316fe). #2065 removed the same |
English
Summary
window.maka.usagepreload namespace and its renderer type contractsettings.usageStats, which still powers the current Usage pageWhy
The deleted namespace has no renderer, Storybook, or E2E consumer. Its pricing mutations also predate the Host revision/CAS contract, so keeping it would freeze the wrong renderer interface before #2010 has a real Pricing consumer.
The IPC surface test now names these six handlers as the only approved Main-only channels. It still requires exact Main/preload parity everywhere else and separately proves that every retained handler remains registered.
Validation
npm run build:testnode --test apps/desktop/dist/main/__tests__/ipc-surface-contract.test.js apps/desktop/dist/main/__tests__/usage-ipc-main.test.jsnpm --workspace @maka/desktop run test:checksnpm run lintnpm run format:checkgit diff --check origin/main...HEADPart of #1982. Pricing Settings is tracked in #2015 and remains coordinated with #2010.
简体中文
概要
window.maka.usagepreload namespace 及其 renderer 类型契约settings.usageStats原因
被删除的 namespace 在 renderer、Storybook 和 E2E 中都没有消费者。它的 pricing mutation 也早于 Host 的 revision/CAS 契约;在 #2010 出现真实 Pricing consumer 之前继续保留,会提前冻结错误的 renderer interface。
IPC surface test 现在把这六个 handler 明确列为唯一允许的 Main-only channels。除此之外仍保持 Main/preload 严格一一对应,并单独证明六个保留 handler 一项都不能缺失。
验证
npm run build:testnode --test apps/desktop/dist/main/__tests__/ipc-surface-contract.test.js apps/desktop/dist/main/__tests__/usage-ipc-main.test.jsnpm --workspace @maka/desktop run test:checksnpm run lintnpm run format:checkgit diff --check origin/main...HEAD属于 #1982 的一部分。Pricing Settings 由 #2015 跟踪,并继续与 #2010 协调。