feat: prepare agen crates for publication

This commit is contained in:
2026-08-23 03:41:51 +09:00
parent aa8dd4f89e
commit d69c367285
206 changed files with 1316 additions and 1145 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ That rule shapes the crate split. The runtime can restart, attach, compact, or d
- `yoi` owns the product CLI and top-level command shape. It is the façade that wires profile selection, memory linting, and normal TUI launch.
- `worker` turns a `Engine` into a named runtime entity with scope, session persistence, protocol handling, tools, and Worker metadata integration.
- `llm-engine` owns model-facing turns: history append, retries, continuation, pruning/compaction mechanics, tool loops, and provider-independent callbacks.
- `agen` owns model-facing turns: history append, retries, continuation, pruning/compaction mechanics, tool loops, and provider-independent callbacks.
- `session-store` owns replayable append-only conversation/session logs.
- `pod-store` owns current Worker metadata keyed by Worker name.
- `protocol` defines the socket message boundary between clients and Workers.
+1 -1
View File
@@ -4,7 +4,7 @@ The Engine should be provider-independent. Provider-specific wire formats, auth
## Engine responsibility
`llm-engine` owns turn lifecycle:
`agen` owns turn lifecycle:
- committed history append
- tool loops
+1 -1
View File
@@ -26,7 +26,7 @@ A typed value still needs a **boundary** test when it is converted from untruste
Compile-time behavior may itself be a public API contract. Compile-pass or compile-fail tests are appropriate when downstream code must continue to compile or be rejected, including macro expansion, typestate transitions, public trait bounds, and unavailable methods in a restricted state. Such a test protects the shape of the public API; it does not re-run a compiler guarantee as a runtime assertion.
Yoi currently uses `trybuild` for compile-fail API-shape tests in `llm-engine`. Add new `trybuild` tests only when the compile-time accept/reject behavior is the product contract being protected. Keep fixtures minimal and name them after the API rule, not after the implementation helper that happens to trigger the compiler error.
Yoi currently uses `trybuild` for compile-fail API-shape tests in `agen`. Add new `trybuild` tests only when the compile-time accept/reject behavior is the product contract being protected. Keep fixtures minimal and name them after the API rule, not after the implementation helper that happens to trigger the compiler error.
## Test names
@@ -108,7 +108,7 @@ runtime state に segment 表示の不一致があった。
- `019e5c2f` の 892-entry history が、旧 segment history の何番目から retained されたものか特定する。
- 旧 segment の `LogEntry::LlmUsage { history_len, input_total_tokens, ... }` と retained cut の対応を確認する。
- `split_for_retained` を当時の history / usage records に対して再実行し、見積もりと実 persisted size の差を出す。
- `llm-worker` の prune threshold / protected area / min savings を確認し、pruning がこの乖離にどの程度寄与したかを確定する。
- `agen` の prune threshold / protected area / min savings を確認し、pruning がこの乖離にどの程度寄与したかを確定する。
- 空 turn が `run_completed finished` になった理由を追う。
## 注意
@@ -48,5 +48,5 @@ The corrupted `tool_result` was manually replaced with a synthetic repair record
## Related fixes made during investigation
- Added safer SSE parse diagnostics in `llm-worker` so future provider-stream failures include HTTP status and selected safe response headers.
- Added safer SSE parse diagnostics in `agen` so future provider-stream failures include HTTP status and selected safe response headers.
- Enabled local trace via `.yoi/override.local.toml` and manually set `record_event_trace = true` in the `yoi-orchestrator` metadata snapshot for future restores.
+1 -1
View File
@@ -95,7 +95,7 @@ The cleanup immediately before this audit removed 547 nonblank test LOC and 21 R
`cargo test --workspace --no-fail-fast` currently fails during compilation before the workspace suite can run.
The immediate failure is stale test code in `crates/llm-engine/tests/parallel_execution_test.rs`:
The immediate failure is stale test code in `crates/agen/tests/parallel_execution_test.rs`:
- tests pass `Vec<ToolOutput>` where production now requires `Vec<Segment>`;
- tests still construct `ToolOutput` with two arguments although the current constructor accepts one;
+2 -2
View File
@@ -11,8 +11,8 @@
- [client](client.md) — # テスト妥当性レビュー: client - 評価: 概ね良い
- [daemon](daemon.md) — # テスト妥当性レビュー: daemon - 評価: 混在
- [lint-common](lint-common.md) — # テスト妥当性レビュー: lint-common
- [llm-worker-macros](llm-worker-macros.md) — # テスト妥当性レビュー: llm-worker-macros - 評価: 混在
- [llm-worker](llm-worker.md) — # テスト妥当性レビュー: llm-worker - 評価: 概ね良い
- [agen-macros](agen-macros.md) — # テスト妥当性レビュー: agen-macros - 評価: 混在
- [agen](agen.md) — # テスト妥当性レビュー: agen - 評価: 概ね良い
- [manifest](manifest.md) — # テスト妥当性レビュー: manifest - 評価: 概ね良い
- [memory](memory.md) — # テスト妥当性レビュー: memory
- [pod](pod.md) — # テスト妥当性レビュー: pod - 評価: 混在
@@ -1,21 +1,21 @@
# テスト妥当性レビュー: llm-worker-macros
# テスト妥当性レビュー: agen-macros
- 評価: 混在
## 確認範囲
- 対象 crate: `crates/llm-worker-macros`
- 対象 crate: `crates/agen-macros`
- 読んだ主なファイル:
- `crates/llm-worker-macros/src/lib.rs`
- `crates/llm-worker-macros/Cargo.toml`
- `crates/llm-worker-macros/README.md`
- `crates/llm-worker/tests/tool_macro_test.rs`
- `crates/agen-macros/src/lib.rs`
- `crates/agen-macros/Cargo.toml`
- `crates/agen-macros/README.md`
- `crates/agen/tests/tool_macro_test.rs`
- 変更はしていない。
`llm-worker-macros` 自体にはローカル unit/integration test がなく、`cargo test -p llm-worker-macros` では実質的に挙動を検証していない。一方で、下流 crate の `llm-worker` 側に `#[tool_registry]` / `#[tool]` の実利用 integration test があり、主要な happy path と一部 error path は確認されている。
`agen-macros` 自体にはローカル unit/integration test がなく、`cargo test -p agen-macros` では実質的に挙動を検証していない。一方で、下流 crate の `agen` 側に `#[tool_registry]` / `#[tool]` の実利用 integration test があり、主要な happy path と一部 error path は確認されている。
## 現在のテストがよくカバーしていること
`crates/llm-worker/tests/tool_macro_test.rs` は、この proc macro が実際に `llm_worker::tool::Tool` と組み合わさって動くことを確認しており、単なる helper unit test より有用な面がある。
`crates/agen/tests/tool_macro_test.rs` は、この proc macro が実際に `agen::tool::Tool` と組み合わさって動くことを確認しており、単なる helper unit test より有用な面がある。
特に以下はよく押さえられている。
@@ -35,7 +35,7 @@
## 不足・疑問のあるテスト
- `llm-worker-macros` package 自身の test は 0 件。`cargo test -p llm-worker-macros` 単体では回帰検知力がほぼない。
- `agen-macros` package 自身の test は 0 件。`cargo test -p agen-macros` 単体では回帰検知力がほぼない。
- proc macro crate として重要な compile-pass / compile-fail matrix がない。現在は runtime integration test 中で使われる形だけが通っている。
- `#[description = "..."]` parameter attribute の挙動が未検証。実装は `#[schemars(description = ...)]` に変換するが、schema に description が出るか、parameter attribute として期待通り扱えるかをテストしていない。
- JSON Schema の検証が弱い。`properties` の存在だけを見ており、以下を確認していない。
@@ -46,7 +46,7 @@
- `#[description]` が schema に反映されること
- 不正引数 test が error variant や message を確認していない。`ToolError::InvalidArgument` であることまで見るべき。
- 引数なし tool は invalid JSON も `unwrap_or` で通す実装になっているが、この仕様が意図通りかを固定する test がない。現在の test は `{}` のみ。
- macro expansion が参照する外部 path/import の契約が未検証。生成コードは `serde`, `schemars`, `serde_json`, `async_trait`, `::llm_worker` に依存しているため、利用側 crate で何を明示 import/dependency すべきかを compile test で固定した方がよい。
- macro expansion が参照する外部 path/import の契約が未検証。生成コードは `serde`, `schemars`, `serde_json`, `async_trait`, `::agen` に依存しているため、利用側 crate で何を明示 import/dependency すべきかを compile test で固定した方がよい。
- unsupported input の扱いが未検証。
- destructuring pattern 引数
- `self` 以外の receiver 形
@@ -82,12 +82,12 @@
- wrong type。
- それぞれ `ToolError::InvalidArgument` になること。
- 引数なし tool の invalid input 仕様を明文化して test する。現在の「parse 失敗でも空 args として続行」はかなり permissive なので、意図した仕様なら固定し、意図しないなら変更前提の regression test を作る。
- `llm-worker-macros` crate 自身にも、少なくとも compile test harness を置くか、下流 `llm-worker` 側の macro tests がこの crate の実質テストであることを明示する。
- `agen-macros` crate 自身にも、少なくとも compile test harness を置くか、下流 `agen` 側の macro tests がこの crate の実質テストであることを明示する。
## 実行したコマンド
```sh
cd /home/hare/Projects/yoi && cargo test -p llm-worker-macros
cd /home/hare/Projects/yoi && cargo test -p agen-macros
```
結果:
@@ -98,12 +98,12 @@ cd /home/hare/Projects/yoi && cargo test -p llm-worker-macros
- この crate 単体の test 妥当性評価としては、挙動検証はほぼない。
```sh
cd /home/hare/Projects/yoi && cargo test -p llm-worker --test tool_macro_test
cd /home/hare/Projects/yoi && cargo test -p agen --test tool_macro_test
```
結果:
- 成功。
- `9 passed`
- `llm-worker` 側の integration test としては、macro の主要 runtime behavior をある程度検証できている。
- `agen` 側の integration test としては、macro の主要 runtime behavior をある程度検証できている。
@@ -1,14 +1,14 @@
# テスト妥当性レビュー: llm-worker
# テスト妥当性レビュー: agen
- 評価: 概ね良い
## 確認範囲
- Workspace root: `/home/hare/Projects/yoi`
- Crate/package: `crates/llm-worker` / `llm-worker`
- Crate/package: `crates/agen` / `agen`
- 読んだ範囲:
- `crates/llm-worker/Cargo.toml`
- `crates/llm-worker/src/**`
- `crates/llm-worker/tests/**`
- `crates/llm-worker/docs/{requirements,architecture}.md`
- `crates/agen/Cargo.toml`
- `crates/agen/src/**`
- `crates/agen/tests/**`
- `crates/agen/docs/{requirements,architecture}.md`
- ソースファイル、Ticket、設定ファイルは変更していない。
## 現在のテストがよくカバーしていること
@@ -69,12 +69,12 @@
- 実行不能な外部 call は `no_run`、擬似コードは明確に `text` fence などに分ける。
## 実行したコマンド
- `cargo test -p llm-worker`
- `cargo test -p agen`
- Result: passed.
- `cargo test -p llm-worker -- --list`
- `cargo test -p agen -- --list`
- Result: passed/listed.
- Executable tests listed: unit/integration/trybuild 全体で 237 件。
- Doc tests listed: 24 件、すべて ignored。
- `cargo test -p llm-worker --quiet`
- `cargo test -p agen --quiet`
- Result: passed.
+1 -1
View File
@@ -5,7 +5,7 @@
## 確認した範囲
- `crates/pod/Cargo.toml``crates/pod/README.md``crates/pod/src/lib.rs``crates/pod/tests/*.rs` の integration suite、テスト一覧、および選択した失敗中の prompt-resource assertion を確認した。
- `pod` crate の責務: `llm-worker` を中心とした Pod lifecycle/runtime authority、socket protocol serving、manifest/profile startup、スコープ付き built-in tools、session/pod-store persistence、spawned child Pod orchestration、prompt/resource assembly、compaction/extraction/consolidation、および runtime metadata integration。
- `pod` crate の責務: `agen` を中心とした Pod lifecycle/runtime authority、socket protocol serving、manifest/profile startup、スコープ付き built-in tools、session/pod-store persistence、spawned child Pod orchestration、prompt/resource assembly、compaction/extraction/consolidation、および runtime metadata integration。
- `cargo test -p pod -- --list` によるテスト一覧:
- 310 件の lib/unit tests。
- 9 件の integration test target、合計 106 件の integration tests。
@@ -55,7 +55,7 @@
- trace file が segment log と分離されること
- `read_entry_count`
- `lookup_session_of`
- `session_test.rs` は mock LLM + actual `llm_worker::Worker` を通して、単純応答・tool call・pause・restore・fork 系を実行している。単なる pure unit だけでなく、crate 境界上の使われ方もある程度守れている。
- `session_test.rs` は mock LLM + actual `agen::Worker` を通して、単純応答・tool call・pause・restore・fork 系を実行している。単なる pure unit だけでなく、crate 境界上の使われ方もある程度守れている。
- fork lineage について、fresh-session fork / in-session `fork_at` / live conflict `ensure_head_or_fork` / nested past fork まで触れているのは良いです。特に「source segment を mutate しない」方針をテストで固定できています。
## 不足・疑問のあるテスト