test(cli): nyxid-cli 覆盖率 63.85%→65.49%(+43 测试)#859
Conversation
🤖 PR859 测试质量审核:通过TL;DR
详细说明本轮重点看新增测试是否只是凑行数、是否引入 sleep/delay pacing、是否新增 skip/manual、是否弱化既有断言,以及是否覆盖实际新增的行为面。这个 PR 的 diff 只在 5 个 CLI 源文件里追加测试,没有新增 production 逻辑;因此我把判断集中在测试是否对真实行为给出约束。 检查结果是通过: 📎 完整 codex 原始输出(存档备查)---
pr: 859
role: tests
verdict: approve
---
## Verdict
Approve: the PR only adds CLI tests, and the added coverage is behavior-oriented, deterministic, and passes the CLI test suite.
## Evidence
- `cli/src/commands/node_credential.rs:203` exercises node-name resolution plus the exact credential push endpoint/body via `wiremock`; `:251`, `:293`, and `:315` cover pending-list and cancel routing without adding sleeps or skips.
- `cli/src/commands/ssh.rs:665`, `:690`, `:699`, `:752`, and `:764` assert concrete URL, header, escaping, and principal-resolution outcomes rather than "does not throw" checks.
- `cli/src/commands/update_attestation.rs:673`, `:679`, `:689`, `:703`, `:720`, `:752`, `:805`, and `:816` cover parser success and failure behavior for JSON integer parsing, bundle decoding, certificate chain extraction, transparency entries, SCT length encoding, and Rekor key IDs.
- `cli/src/node/daemon.rs:983`, `:1102`, `:1110`, `:1123`, `:1146`, `:1174`, and `:1183` assert daemon label safety, systemd quoting, profile metadata round-trip/fallback behavior, explicit config precedence, and launchd target composition; HOME mutation is guarded by the existing env lock.
- `cli/src/node/oauth.rs:807`, `:849`, `:863`, `:893`, `:912`, `:919`, `:937`, `:964`, `:981`, `:1018`, and `:1047` validate OAuth parsing, reserved-param filtering, PKCE output, callback decoding, catalog fetch auth/status handling, and token-exchange request/response semantics with real request matching.
- Diff review found no added `#[ignore]`, manual/skip markers, assertion loosening, or test-side sleep/delay pacing. The only `tokio::time::sleep` hits are pre-existing production OAuth polling code at `cli/src/node/oauth.rs:230` and `:464`.
- There are no net-new production lines in the PR diff, so the coverage obligation is for the newly added tests themselves. `cargo test -p nyxid-cli` passes on the PR worktree: 927 unit tests and 1 integration test, 0 ignored.
⟦AI:AUTO-LOOP⟧
REVIEW_DONE:859:tests:approve⟦AI:AUTO-LOOP⟧ |
🤖 架构审查通过:PR 859 无架构阻塞TL;DR
详细说明本次三点 diff 只触及 我还按 architect checklist 做了新增行 grep:没有新增 Old/New 或 iteration refactor-history 源码注释,没有 📎 完整 codex 原始输出(存档备查)pr: 859
|
🤖 quality review: commentTL;DR
详细说明
📎 完整 codex 原始输出(存档备查)---
pr: 859
role: quality
verdict: comment
---
## Verdict
Comment: the test additions are focused and readable overall, but one new Clippy allow is misleading noise because the test is synchronous.
## Evidence
- `cli/src/node/daemon.rs:1124` adds `#[allow(clippy::await_holding_lock)]` to `daemon_config_metadata_round_trips_profile_config_dir`, but the function is a synchronous `#[test]` with no `.await`; the allow does not document a real lint suppression and makes the env-locking setup look more complex than it is.
## What would change your verdict (only if comment or reject)
Remove the unused `#[allow(clippy::await_holding_lock)]` from `daemon_config_metadata_round_trips_profile_config_dir`; the `HomeGuard` helper and env lock are otherwise clear and reachable.
⟦AI:AUTO-LOOP⟧
REVIEW_DONE:859:quality:comment⟦AI:AUTO-LOOP⟧ |
✅ 评审共识 — MERGE_WITH_COMMENTSarchitect ✅ approve · tests ✅ approve · quality 💬 comment(advisory,非阻塞)。本地独立验证 🤖 controller consensus card ⟦AI:AUTO-LOOP⟧ |
摘要 / Summary
提升
nyxid-cli单元测试行覆盖率:63.85% → 65.49%(+1.64pp,新增 43 个行为测试)。Refs #852, #850.覆盖
commands/{node_credential,update_attestation,ssh}、node/{oauth,daemon}的纯逻辑与可 mock(wiremock)路径。剩余未覆盖主要是集成测试范畴(live WS/PTY/process runtime、daemon 服务管理命令、device/browser 轮询循环、完整 Sigstore trust-root/证书/Rekor 验证),单测无法诚实覆盖——这是 CLI 单测可达上限的真实信号。无#[ignore]/skip/弱化断言。base =
auto/test-coverage;CI 阈值上调留待 #856。🤖 Auto-loop / codex-refactor-loop
⟦AI:AUTO-LOOP⟧