Uh oh!
There was an error while loading. Please reload this page.
refactor(ui): lift useDelayedFlag/createDelayedFlag into @maka/ui - #4848
refactor(ui): lift useDelayedFlag/createDelayedFlag into @maka/ui#4848liuxiaocs7 wants to merge 1 commit into
Conversation
The side-conversation panel needed the main chat's rising-edge running-status timing (useDelayedFlag + the 200ms delay), but the workbar feature layer cannot import the renderer-legacy use-delayed-flag.ts / model-wait-state.ts (the architecture gate walls features off from legacy), so apache#4655 added a feature-local copy of useDelayedFlag and a `const RUNNING_STATUS_DELAY_MS = 200` to quote-companion-panel.tsx — two authorities for one delay, a literal that would drift, and no test coverage for the timing. Move the pure createDelayedFlag (+ DelayedFlag, DelayedFlagScheduler), the useDelayedFlag React binding, and RUNNING_STATUS_DELAY_MS into a new @maka/ui `delayed-flag` module. The main chat (use-shell-live-turn) and the side chat (quote-companion-panel) now import one implementation; the feature-local copy and the renderer-legacy use-delayed-flag.ts are removed. Adds fake-timer unit tests for createDelayedFlag (there were none), and drops the use-delayed-flag.ts closure from the renderer-architecture ledger (net debt reduction). Fixesapache#4844 Generated-by: Claude Code
liuxiaocs7
commented
Sep 5, 2026
Closing — blocked by the renderer-architecture monotonic-debt ratchet. The main chat's consumer Making it legal would require migrating a 4-file legacy closure — |
Summary
Split from the review of #4655 (P3) — tracked in #4844.
The side-conversation panel needed the main chat's rising-edge running-status timing (
useDelayedFlag+ the 200ms delay), but the workbar feature layer can't import the renderer-legacyuse-delayed-flag.ts/model-wait-state.ts(the renderer-architecture gate walls features off from legacy). So #4655 added a feature-local copy ofuseDelayedFlagand aconst RUNNING_STATUS_DELAY_MS = 200toquote-companion-panel.tsx— two authorities for one delay, a literal that would drift, and no timing tests.This lifts the shared pieces into a new
@maka/uidelayed-flagmodule:createDelayedFlag(+DelayedFlag,DelayedFlagScheduler) — moved out ofmodel-wait-state.ts.useDelayedFlagReact binding — moved out ofuse-delayed-flag.ts(deleted).RUNNING_STATUS_DELAY_MS— one shared delay.The main chat (
use-shell-live-turn) and the side chat (quote-companion-panel) now import one implementation; the feature-local copy is gone. Theuse-delayed-flag.tsclosure drops off the renderer-architecture ledger (net debt reduction).No behavior change — the timing implementation is identical, just relocated to a package both sides may import.
Fixes#4844
Verification
Local (all pass):
tscrenderer + main,@maka/uibuild — 0 errors.biome check— clean;knip(apps/desktop + packages/ui) — clean.check:architecture— renderer snapshot + monotonic-debt ratchet pass (debt down: 1 insertion / 21 deletions in the ledger).packages/ui/src/__tests__/delayed-flag.test.ts— 5 fake-timer cases (rising-edge delay, no-flash on a fast drop, immediate fall, single-arm re-entrancy, dispose cancels).createDelayedFlaghad no tests before.AI use
Tool(s) and scope: Claude Code — investigation, implementation, and local verification. The commit carries a
Generated-by: Claude Codetrailer.Checklist
Does this PR entail a change in behavior?
@maka/ui)