Skip to content

refactor(account): inject update prompts for terms confirmation - #59

Closed
Lyer3c wants to merge 1 commit into
AsterCommunity:mainfrom
Lyer3c:refactor/account-update-prompts
Closed

Lyer3c wants to merge 1 commit into
AsterCommunity:mainfrom
Lyer3c:refactor/account-update-prompts

Conversation

@Lyer3c

@Lyer3c Lyer3c commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #56 (merged).

account update's interactive terms confirmation still called terminal::confirm_action directly, so the menu → confirmation path could only be exercised in a real terminal. This routes it through the same RegistrationPrompts boundary as the menu:

  • RegistrationPrompts gains confirm_action(details, question, confirmed); TerminalPrompts delegates to the existing terminal::confirm_action, so production behavior is unchanged.
  • update_with_transport takes interactive and the prompt boundary as parameters; terms_delegation takes TermsChange { target, confirmed } and prompts instead of calling the terminal.
  • Fake-prompt tests cover: the menu selects terms and --yes still requires a separate confirmation (confirmed=false), accepting enables, cancel/decline leave the record untouched, and explicit flags pass confirmed=true without entering the menu.
  • Parse coverage asserts both argument orders of the two terms flags conflict.

No production behavior change; the same terminal functions are called through TerminalPrompts.

Verification

  • cargo test -p aster_acme_cli --locked commands::account: 74 passed
  • cargo test --workspace --locked: 1048 passed, 0 failed (Windows native; Linux CI adds Unix-only tests)
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean
  • cargo fmt --all --check, cargo doc --workspace --no-deps --locked, python scripts/check-doc-links.py: clean

The Unix PTY script was not extended; the interactive confirmation path is now covered through injected prompts, not only a terminal. No public CA or staging account was used.

Notes

Route interactive scope selection, contact confirmation and the terms delegation prompt through RegistrationPrompts instead of constructing TerminalPrompts inside update_with_transport. Fake prompts now drive the menu-to-confirmation flow, including --yes not answering menu consent, decline/cancel leaving the record untouched, and explicit flags passing confirmed=true. Add both-order parse coverage for the two terms flags.
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e12a15d2-ef0b-4c2a-8f3c-f102cb3d51c7
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@astercommunity-automation astercommunity-automation Bot added CI: Running A pull request has required CI workflows that have not reached a terminal state Rust Pull requests that update Rust code Scope: CLI Command surface, interaction, rendering, daemon commands, and reload execution labels Nov 21, 2026
@astercommunity-automation

astercommunity-automation Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

PR readiness for 0431706f8113

Fact Value
Blocking conditions 1
Waiting conditions 0
Current unresolved threads 0
Current-head approvals 0
Stale latest reviews 0
  • BLOCK: codecov/patch: failure

This report is deterministic and updated for the current pull request head.

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.34686% with 37 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...aster_acme_cli/src/commands/account/interaction.rs 10.34% 26 Missing ⚠️
...es/aster_acme_cli/src/commands/account/mutation.rs 95.45% 11 Missing ⚠️

📢 Thoughts on this report? Let us know!

@astercommunity-automation astercommunity-automation Bot added CI: Passed All required CI workflows passed for the current pull request head and removed CI: Running A pull request has required CI workflows that have not reached a terminal state labels Nov 21, 2026
@astercommunity-automation

Copy link
Copy Markdown

CI diagnostics resolved for 0431706f8113

Workflow Result First failing job/step
CI PASS -

This comment is updated in place for the latest PR head.

@AptS-1547

Copy link
Copy Markdown
Member

?

@AptS-1547

Copy link
Copy Markdown
Member

感谢跟进!这个 PR 的方向感很好——把 #56 review 留下的覆盖边界继续收掉,方法论完全正确。但这次我们决定不合,核心理由如下:

与项目硬约束冲突

AGENTS.md 硬约束禁止增加纯透传 facade。本 PR 给 RegistrationPrompts 新增的 confirm_action 方法,唯一职责是转发到全局公共入口 terminal::confirm_action(PR 描述也写明 production behavior is unchanged)——这是为测试注入而新造的镜像层。对比 #56 的补丁:那次是把裸调用收编进已有的 RegistrationPrompts::select 抽象,没有新增边界;而 confirm_action 是全 CLI 共用的确认入口(account remove、rotate-key 等都在直接使用),为 account 一域单独复制一份平行抽象,方向与我们"规则回到所有者、不复制"的边界原则相反。

覆盖收益在低风险区

  • confirm_action 自身的分支逻辑(yes / JSON / 非 TTY 拒绝、取消映射)在 terminal.rs 已有完整的注入式测试;
  • terms 确认语义已有 terms_delegation_requires_confirmation_in_automation 单测和 PTY 场景锁定;
  • 本 PR 新增的覆盖集中在编排层"接线"的正确性——由编译器和上述既有测试间接保证,属于测试范围超出实际风险的部分。生产行为零变化也印证了这一点。

关于 review 记录里的"PTY 残留"

account-testing.md 里的"交互编排行仅在 PTY 层验收"是已知可接受状态,不是待办清单——我们不为低风险的终端接线扩展覆盖或抽象。如果未来某次改动让这条路径产生真实行为复杂度,届时再评估。

真正值得投入的方向是 #58(组合 scope 时丢弃前序 report 的模型问题):先让 AccountReport 支持多 scope 结果,再谈放开 terms 与 contacts/profile 的互斥。这个模型工作有真实用户可观察的影响,欢迎继续参与。

@AptS-1547 AptS-1547 closed this Nov 21, 2026
@astercommunity-automation astercommunity-automation Bot removed the CI: Passed All required CI workflows passed for the current pull request head label Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rust Pull requests that update Rust code Scope: CLI Command surface, interaction, rendering, daemon commands, and reload execution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants