runtime: normalize filesystem options

This commit is contained in:
2026-07-13 19:06:26 +09:00
parent b82407816e
commit 6b91d83fe2
4 changed files with 249 additions and 106 deletions
+33
View File
@@ -0,0 +1,33 @@
---
title: 'Normalize worker runtime filesystem options'
state: 'done'
created_at: '2026-07-13T10:02:48Z'
updated_at: '2026-07-13T10:04:09Z'
assignee: null
queued_by: 'yoi ticket'
queued_at: '2026-07-13T10:04:08Z'
---
## 背景
`worker-runtime-rest-server` の filesystem option は、`fs-store` feature によって使える永続化境界として見えるべきである。現在の `--worker-store-dir` / `--worker-metadata-dir` / `--worker-runtime-base-dir` は内部実装の分割を直接露出しており、`--store memory` も「store backend」ではなく「永続 store を使わない ephemeral mode」を表している。
`fs-store` feature 付き build では filesystem-backed store が default で動き、明示的に永続化を切る場合だけ `--no-store` とする。
## 要件
- `--fs-root` は filesystem-backed storage 全体の top-level root とする。
- `--fs-worker-dir` を追加し、Worker session / metadata / controller runtime / workdirless Worker root をまとめて導出する。
- `--fs-runtime-dir` を追加し、Runtime catalog / Worker list / execution mapping / events の保存先にする。
- `--workdir-target` を追加し、Workdir materialization target を指定できるようにする。
- `--store <fs>` は future backend switching 用に残し、`memory` は受け付けない。
-`--store memory``--no-store` に置き換える。
-`--worker-store-dir` / `--worker-metadata-dir` / `--worker-runtime-base-dir` は削除する。
## 受け入れ条件
- `--help` に新しい option 名が表示され、旧 worker path option は表示されない。
- `--store memory` は reject され、`--no-store` は Runtime catalog persistence を無効化する。
- `--fs-root <dir>` だけで `<dir>/runtime``<dir>/worker``<dir>/workdirs` が default 派生される。
- Worker Runtime server は新 option で起動できる。
- worker-runtime / workspace-server の関連テストと Nix build が通る。
+82
View File
@@ -0,0 +1,82 @@
<!-- event: create author: "yoi ticket" at: 2026-07-13T10:02:48Z -->
## 作成
LocalTicketBackend によって作成されました。
---
<!-- event: intake_summary author: hare at: 2026-07-13T10:04:08Z -->
## Intake summary
Marked ready by `yoi ticket state`.
---
<!-- event: state_changed author: "yoi ticket" at: 2026-07-13T10:04:08Z from: planning to: ready reason: cli_state field: state -->
## State changed
Marked ready by `yoi ticket state`.
---
<!-- event: state_changed author: "yoi ticket" at: 2026-07-13T10:04:08Z from: ready to: queued reason: queued field: state -->
## State changed
Ticket を `yoi ticket` が queued にしました。
---
<!-- event: state_changed author: "yoi ticket" at: 2026-07-13T10:04:08Z from: queued to: inprogress reason: cli_state field: state -->
## State changed
State changed to `inprogress`.
---
<!-- event: implementation_report author: hare at: 2026-07-13T10:04:08Z -->
## Implementation report
Implemented filesystem option cleanup for `worker-runtime-rest-server`.
- Kept `--store <fs>` as the only accepted store selector value.
- Added `--no-store` to represent the old ephemeral memory Runtime catalog mode.
- Changed `--fs-root` to mean the top-level filesystem-backed storage root.
- Added `--fs-worker-dir` for Worker storage, defaulting to `<fs-root>/worker`.
- Added `--fs-runtime-dir` for Runtime catalog storage, defaulting to `<fs-root>/runtime`.
- Added `--workdir-target` for Workdir materialization, defaulting to `<fs-root>/workdirs`.
- Removed the old `--worker-store-dir`, `--worker-metadata-dir`, and `--worker-runtime-base-dir` CLI options.
- Worker session store, Worker metadata store, Worker controller runtime base, and workdirless Worker root are now derived from `--fs-worker-dir`.
Validation:
- `cargo fmt --check`
- `git diff --check`
- `cargo check -q`
- `cargo check -q -p worker-runtime --features fs-store,ws-server`
- `cargo test -q -p worker-runtime --features fs-store,ws-server`
- `cargo test -q -p yoi-workspace-server`
- `cargo run -q -p worker-runtime --features ws-server,fs-store --bin worker-runtime-rest-server -- --help`
- `cargo run -q -p worker-runtime --features ws-server,fs-store --bin worker-runtime-rest-server -- --store memory` rejects the old memory store selector
- `cargo run -q -p worker-runtime --features ws-server,fs-store --bin worker-runtime-rest-server -- --worker-store-dir /tmp/x` rejects the removed worker path option
- Started `worker-runtime-rest-server` with `--fs-root /tmp/yoi-runtime-fs-options-test` and verified `/v1/runtime` responds with `backend: fs_store` while using the derived runtime directory.
- `nix build .#yoi --no-link`
---
<!-- event: state_changed author: "yoi ticket" at: 2026-07-13T10:04:09Z from: inprogress to: done reason: cli_state field: state -->
## State changed
State changed to `done`.
---