Console: edit the warm pool's targets on a worker's Warm pool tab
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- frontend
調査の方向性
Start with ui/src/screens/fleet/worker-page.tsx, ui/src/model/actions.ts, and the existing Warm pool tests in ui/src/screens/fleet/fleet.test.tsx; read ui/AGENTS.md for the Actions and Reads guidance. Then trace the warm-pool query and write handling in ui/src/state/queries.ts and ui/src/state/actions.ts. Done when the worker-only panels safely update targets and learned kinds, refresh state correctly, and the browser test in e2e/console/workers.spec.ts covers the flow.
索引モデルが issue の本文から書いたものです。
説明
Part of #1137.
Scope
After this PR an operator on a worker's console warms the pool up and down from the worker page's Warm pool tab. They step a kind's count, drop a runtime row, choose whether the pool learns, and forget a learned kind. Everything goes through #1144's routes. On a gateway, or while the console does not know the daemon's mode, the tab stays as it is today: read-only.
In short
The Warm pool tab gains two panels above the figures, in worker mode only. Targets lists the effective list from GET /v1/warm-pool: each kind with a − and + stepper, its origin, and on a runtime row Use config (it replaced configured targets) or Remove (it did not). Below the rows is a Learn kinds from leases choice. Learned kinds lists each kind the pool learned with its peak and Forget. Every step, Use config, Remove or Learn choice sends one PUT /v1/warm-pool/targets with the stored runtime list changed by that one thing and runtime.learn kept. Forget asks first, then sends one DELETE /v1/warm-pool/learned. The figures table stays read-only; its Origin column can now read runtime.
flowchart LR
T[Warm pool tab, worker mode] --> R["GET /v1/warm-pool (new read)"]
R --> P[Targets and Learned kinds panels, new]
P -->|− + / Use config / Remove / Learn| U[PUT /v1/warm-pool/targets]
P -->|Forget, after a confirm| D[DELETE /v1/warm-pool/learned]
U --> S[Toast]
D --> S
E[warm-pool.targets-changed] --> K["marks ['warm-pool'] and the workers stale"]
style P stroke-width:3px
style U stroke-width:3px
style D stroke-width:3px
style K stroke-width:3px
Words, exactly (<kind> is the Kind spelling in #1137's Shared values; <n>, <m> are counts):
| Where | Text |
|---|---|
| Targets panel title | Targets |
| its columns | Kind, Count, Origin |
| stepper buttons | − and +, labelled Keep one fewer <kind> and Keep one more <kind> |
| Origin cell | configured, runtime, or runtime; config says <m> |
| row buttons | Use config on a runtime row with configuredCount, Remove on one without |
| Learn choice legend | Learn kinds from leases, shown; choices Config (<on|off>) from the answer's learn.configured, On, Off; Config chosen when learn.origin is configured, else the runtime value |
| empty | No targets. |
| Learned kinds panel title | Learned kinds, columns Kind, Peak; empty None learned. |
| row button | Forget |
| success toast, a count of 1 or more | Keeping <n> <kind> warm |
| success toast, a count of 0 | Keeping no <kind> warm, description Its idle devices shut down now. |
| success toast, Use config | <kind> follows config.json again |
| success toast, Remove | Stopped keeping <kind> warm |
| success toast, Learn | Learning: on, Learning: off, or Learning follows config.json: <on|off> |
| error toast title, any PUT | Couldn't change the warm pool, with the daemon's message below |
| Forget confirm title | Forget <kind>? |
| its body | The pool stops keeping it warm, and the idle rules shut its idle devices down and delete them. Its next lease teaches it again., then, when the match also covers other learned kinds, It also forgets <kind>, <kind>. |
| its buttons | Keep, Forget (busy: Forgetting…) |
| its success toast | Forgot <kind>; Forgot <kind> and <n> more when forgotten lists more; <kind> was already forgotten when it is empty |
| its error toast title | Couldn't forget <kind> |
The count a step sends is #1137's "Count a client raises from": max(count, learnedCount) ± 1, between 0 and 256; learnedCount is 0 on a runtime row. − is disabled when that base is 0, and + when it is 256 or more; a merged configured row may sum above 256, and − on it then sends 256. Every control of both panels shares one in-flight key, warm-pool, so all are disabled while any warm-pool write is out. A PUT's answer is the whole warm.list answer: it cancels any ['warm-pool'] read in flight and replaces the data at once, so the next click builds on it and a late poll cannot bring the old list back. Forget's answer does not, so after it the console marks ['warm-pool'] stale and reads it again.
Forget sends platform, model, osVersion, mode, and imageTag when the kind has one. With no image tag warm.forget also forgets the kind's tagged kinds (src/core/warm-pool/learned.ts:186-198), so the confirm names each learned kind the match covers, read from the Learned kinds rows.
| Row | count, learnedCount |
+ sends | − sends |
|---|---|---|---|
configured ios iPhone 17 26.0 |
2, 0 | runtime row 3 | runtime row 1 |
configured ios iPhone 16 18.5 |
1, 3 | 4 | 2 |
runtime android Pixel 8 |
0, 0 (a runtime row) | 1 | disabled |
runtime android Pixel 8 |
256, 0 | disabled | 255 |
If this goes wrong, an operator sees a step that sends a stale or reordered list (another change undone), or a control on a gateway's tab.
Technical spec
Facts
Commit ce8fea85.
| # | Fact | Source |
|---|---|---|
| F1 | The Warm pool tab is a "Warm pool" panel with Pool and Reserved running slots facts and a read-only figures table (Model, Runtime, Mode, Origin, Wanted, Ready, Booting, Short), then "Installs in progress" | ui/src/screens/fleet/worker-page.tsx:381-425 |
| F2 | The tab's data is each worker's warmPool from GET /v1/workers, shaped by warmTabOf and warmRow |
ui/src/state/workers.ts:139, ui/src/model/worker-page.ts:575-610 |
| F3 | The figures row's origin is a string shown as given |
ui/src/model/worker-page.ts:551, :581 |
| F4 | ItemAction ids are a closed union; method is "DELETE" | "POST"; an action may carry a confirm, a body, an outcome toast from the answer, and a failure title |
ui/src/model/actions.ts:26-50 |
| F5 | workerActions offers nothing unless the mode is gateway; the mode is "gateway" | "worker", anything else unknown |
ui/src/model/actions.ts:234-240, ui/src/data/mode.ts:4, :43 |
| F6 | useActions().run skips an item key in flight, sends api.write(method, path, {body, timeoutMs}), shows the success or outcome toast, and on an error shows the daemon's message under the failure title with Retry |
ui/src/state/actions.ts:72-108 |
| F7 | api.write and send take only DELETE and POST; the body is sent as JSON; the default limit is 10 s |
ui/src/data/api.ts:1, :29, :106, :190-196 |
| F8 | routeKey('/v1/warm-pool') is ['warm-pool']; a key polls only if TIMES names it (workers every 15 s) |
ui/src/state/queries.ts:41-50, :66-68, :88-90 |
| F9 | staleKeys maps an event name to the keys it marks; an unlisted name marks nothing; warm-pool.target-missed is unlisted |
ui/src/model/stale-keys.ts:17-44 |
| F10 | ChoiceChips is a radio group with a legend and one chosen value |
ui/src/ds/choice.tsx:11-36 |
| F11 | The confirm host takes a title, a body, a confirm and a busy label | ui/src/ds/confirm-dialog.tsx:8-17 |
| F12 | The tab's tests render the page's markup from a view | ui/src/screens/fleet/fleet.test.tsx:282, :324-389 |
| F13 | The browser lane opens the Warm pool tab | e2e/console/workers.spec.ts:954 |
| F14 | The console's worker page is described on the website | website/src/content/docs/docs/worker/console.mdx:115 |
| F15 | warm.forget treats a field left out as matching every kind, and an image tag left out also matches tagged kinds; it emits no event |
src/core/warm-pool/learned.ts:186-198, src/core/warm-pool/converger.ts:190-199 |
| F16 | ChoiceChips hides its legend and has no disabled prop |
ui/src/ds/choice.tsx:12-22 |
| F17 | The in-flight flag clears when the answer arrives; an event's re-read lands at least 300 ms later | ui/src/state/actions.ts:100-101, ui/src/state/queries.ts:29-31 |
Modules touched
Searches: WarmTab, warmTabOf, warmPoolRows, ItemAction, "DELETE" | "POST", staleKeys, TIMES, Warm pool in ui/src/, e2e/console/ and website/.
ui/src/model/actions.ts: idsset-warm-targetsandforget-warm-kind;methodgains"PUT";warmTargetActions(list, mode)(new) builds each row's −, +, Use config or Remove, and the Learn choices;learnedKindActions(kind, mode)(new) builds Forget. Both answer[]unless the mode isworker.ui/src/model/worker-page.ts:warmTargetsOf(answer)(new) shapes the Targets and Learned kinds rows.ui/src/data/api.ts:writeandsendtake"PUT".ui/src/state/workers.ts(or a newui/src/state/warm.ts): readsGET /v1/warm-poolonly in worker mode.ui/src/state/queries.ts:'warm-pool'inTIMES, 15 s likeworkers.ui/src/model/stale-keys.ts:warm-pool.targets-changedmarks['warm-pool']and the workers (['workers'],['inbox'], as every workers mark does).ui/src/state/actions.ts: a PUT's answer sets the['warm-pool']data; a Forget marks it stale after its answer.ui/src/ds/choice.tsx: a shown legend and adisabledprop (F16).e2e/console/workers.spec.ts: the Done when test.ui/src/screens/fleet/worker-page.tsx: the two panels.ui/AGENTS.md(Actions, Reads),website/src/content/docs/docs/worker/console.mdx.
flowchart LR
SC[screens/fleet/worker-page *] --> ST[state: warm read *]
SC --> AC[state/actions run]
ST --> Q[state/queries *]
SC --> MA[model/actions *]
SC --> MW[model/worker-page *]
AC --> API[data/api *]
LV[live stream] --> SK[model/stale-keys *]
sequenceDiagram
participant O as Operator
participant C as Console
participant D as Daemon (worker)
O->>C: + on ios iPhone 17 26.0
C->>D: PUT /v1/warm-pool/targets {targets: runtime + changed row, learn: runtime.learn}
alt 200
D-->>C: warm.list answer
C-->>O: toast Keeping 3 ios iPhone 17 26.0 warm
D--)C: event warm-pool.targets-changed
C->>D: GET /v1/warm-pool, GET /v1/workers (stale)
else 400, 501 or no answer
D-->>C: error
C-->>O: error toast Couldn't change the warm pool, the message, Retry
end
Contract and event changes
none: the console reads #1143's warm.list answer and sends its warm.set input through #1144's routes; it adds no contract shape.
Other code on the same state
Searches: writers of the runtime list (warm.set: #1144's CLI and this tab), readers of ['warm-pool'] (this tab only), the workers' warmPool figures (warmTabOf).
| Component | Both act | Wins |
|---|---|---|
A CLI warm set or another console between this tab's read and its PUT |
this tab sends the list it last read with its one change | the later PUT; the event marks this tab stale and it reads the list again |
| Two clicks before the first answer | the second is disabled while the write is in flight (F6) | the first |
The figures table (['workers']) |
changes after the pool's pass, read again on the event | — |
Failure modes
| Call | Outcome | What happens | Limit, counted from |
|---|---|---|---|
GET /v1/warm-pool |
ok | the panels show | 10 s, from the read |
GET /v1/warm-pool |
error or no answer | the panels show the page's refusal text in place of the rows; the figures still show | 10 s, from the read |
PUT /v1/warm-pool/targets |
200 | success toast | 10 s, from the click |
PUT |
400, 501 | error toast with the daemon's message and Retry | 10 s |
PUT |
no answer | error toast The daemon did not answer. (F6) |
10 s |
DELETE /v1/warm-pool/learned |
200 | Forgot <kind>, or … was already forgotten |
10 s |
DELETE |
error | Couldn't forget <kind> with the message |
10 s |
The console writes no state of its own.
The read failure has no Tests line of its own: it is the page's refusal, as every read on the page (useRouteQuery).
Rules in play
- ADR 0037 §3, "One list of actions per kind of item": the target row's controls come from
warmTargetActions, Forget fromlearnedKindActions. - ADR 0037 §4, the console reads the daemon's mode and "never guesses": nothing is offered and
GET /v1/warm-poolis not read unless the mode isworker. - ADR 0037 §5: success toasts leave, error toasts carry the daemon's message.
- ADR 0044, "the console reads what its page shows, and events mark it stale":
['warm-pool']is read only on this tab and marked bywarm-pool.targets-changed. - ADR 0056 §5–6: the raise base, the stored runtime order, worker only.
- Documentation rule 9:
worker/console.mdxdescribes the panels.
Tests
Seam: the tab's model and markup (ui/src/screens/fleet/fleet.test.tsx, ui/src/model/actions.test.ts), useActions().run (ui/src/state/actions.test.tsx), staleKeys through the query client (ui/src/state/queries.test.ts).
- An operator opens the Warm pool tab on a worker and sees the targets with a count stepper, Use config or Remove on runtime rows, a Learn choice and Forget on learned kinds: mode
worker/gateway/ unknown; a configured, a runtime and a replaced row; count 0 disables −, 256 disables +; a learned kind. - An operator steps a count, uses config, removes a row or picks Learn, and sees one
PUT /v1/warm-pool/targetswith the whole runtime list changed by that one thing, then a toast: + on a configured row adds a runtime row; + on a row whose learned peak is above its count raises from the peak; − on a runtime row; − to 0 (Keeping no …,Its idle devices shut down now.); Use config drops the row; Remove drops a runtime-only row (Stopped keeping …); Learn off, On, and Config (dropslearn; toast from the answer); a runtimelearnkept on a count change; three + in a row send 3, 4, 5, each from the last answer; + on a second row keeps the first row's change; every control disabled while a PUT is out; 400 and 501 show the daemon's message. - An operator runs Forget on a learned kind and sees a confirm naming it, then one
DELETE /v1/warm-pool/learnedand a toast: confirmed, then['warm-pool']read again; cancelled sends nothing; an Android kind with an image tag passes it; an untagged kind whose match covers a tagged one names both in the confirm and the toast; nothing forgotten. warm-pool.targets-changedmarks the warm-pool list and the workers stale: the event;warm-pool.target-missedmarks nothing, as today.
Done when
pnpm exec vitest run --project unit ui/src/model ui/src/state ui/src/screens/fleetpasses, each Tests line a test there.pnpm test:console --project=chromium e2e/console/workers.spec.tspasses with one more test: on a worker, + on a target sends onePUT /v1/warm-pool/targetsand a toast shows.website/src/content/docs/docs/worker/console.mdxdescribes the Targets and Learned kinds panels and says they show only on a worker.
Out of scope
- Add device… (#1146).
- A stepper on a learned kind.
- Any warm control on a gateway's console.
Depends on
- #1144
- #1133
- #1135
Written by an agent.
- 主要言語
- TypeScript
- スター
- 705
- フォーク
- 40
- 平均マージ
- 12時間 9分
- マージ済み PR(30日)
- 376
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
callstackincubator/simlock のほかの issue
-
request:new
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
callstackincubator/simlock#1806 ·
メンテナーはふだん 1 日以内に返信
-
bug:new
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
callstackincubator/simlock#1780 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
task:draft
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
callstackincubator/simlock#1441 ·
メンテナーはふだん 1 日以内に返信
-
bug:new
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
callstackincubator/simlock#1805 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug:new
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
callstackincubator/simlock#1804 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
callstackincubator/simlock の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Update project links after the repository renames対応中かも @JonathanTSilva が今日担当しました。 オープンai-generated priority: p2 size: xs type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
JonathanTSilva/jts-website#119 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
promplate/code-review#158 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Docs] CONTRIBUTING points the Backend Remake milestone at a branch that does not exist対応中かも @franpts2 が今日担当しました。 オープンdocs
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 3 日以内に返信