Skip to content
This repository was archived by the owner on Apr 23, 2026. It is now read-only.

refactor(proxmox-client): 나머지 fetch/cmd 도 trait 에 흡수 (2/2) - #73

Merged
dalsoop merged 1 commit into
mainfrom
feat/proxmox-client-trait-2
Apr 20, 2026
Merged

refactor(proxmox-client): 나머지 fetch/cmd 도 trait 에 흡수 (2/2)#73
dalsoop merged 1 commit into
mainfrom
feat/proxmox-client-trait-2

Conversation

@dalsoop

@dalsoop dalsoop commented Apr 20, 2026

Copy link
Copy Markdown
Owner

Summary

PR #72 의 후속. 남아 있던 `match server.access` 경로들을 trait 메서드로 전부 이관.

Trait 확장

default impl 은 모두 "API-not-supported" (None / 빈 벡터), `SshProxmoxClient` 만 override:

  • `host_info` / `resources` / `docker` / `ports` / `snapshots`
  • `docker_logs_cmd` / `container_logs_cmd` / `docker_exec_cmd` — Option 반환. 기존 String 반환 public wrapper 는 `unwrap_or_default` 로 감쌈 (API 서버엔 빈 문자열)

파서 분리

향후 StubRunner 로 파서 단위 테스트를 붙일 수 있도록 각 fetch 내부를 순수 함수로 추출:

  • `parse_docker` / `parse_ports` / `parse_resources` / `parse_snapshots` / `parse_host_info`

정리

  • 기존 private `fetch_resources` / `fetch_snapshots` 함수 제거 (trait impl 로 이동)
  • 미사용이 된 `fetch_docker` / `fetch_ports` wrapper 제거 (dead-code 즉시 삭제)
  • `fetch_detail` 은 `client_for` 한 번 호출 후 4 메서드

결과

남은 `match AccessType` 은 `client_for` 한 곳 + `display_server` (UI 태그) 뿐.

Test plan

  • `cargo test --release -p tmux-config` — 58/58
  • `cargo clippy --release -p tmux-config -- -D warnings` — clean
  • pve 호스트 `pve-list` / `pve-ct pve` (43 rows) 회귀

🤖 Generated with Claude Code

PR 1/2 의 후속. 남아 있던 `match AccessType` 경로들을 trait 메서드로 전부 이관.

Trait 확장 (모두 default = API-not-supported, Ssh 만 override):
- host_info / resources / docker / ports / snapshots
- docker_logs_cmd / container_logs_cmd / docker_exec_cmd
  (기존 String 반환 public wrapper 는 Option 을 unwrap_or_default 로 감쌈)

추가로 순수 파서 함수 분리 (향후 StubRunner 기반 단위 테스트 대상):
- parse_docker / parse_ports / parse_resources / parse_snapshots / parse_host_info

정리:
- 기존 `fn fetch_resources` / `fn fetch_snapshots` private 함수 제거 (trait impl 로 이동)
- 호출 없던 wrapper `fetch_docker` / `fetch_ports` 제거 (dead-code 즉시 삭제 규약)
- `fetch_detail` 은 client 를 한 번 만들어 4 메서드 호출

결과:
- 남은 `match AccessType` 은 `client_for` 하나 + `display_server` (UI 태그) 뿐
- 호출부(cli/main) 변경 없음, CI 58/58 / clippy clean

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dalsoop
dalsoop merged commit 66a576a into main Apr 20, 2026
2 checks passed
@dalsoop
dalsoop deleted the feat/proxmox-client-trait-2 branch April 20, 2026 05:07
@dalsoop

dalsoop commented Apr 20, 2026

Copy link
Copy Markdown
Owner Author

Dalteam Review

  • crates/tmux-config/src/proxmox.rs:410,805-812 regresses fetch_host_info() for AccessType::Api. Before this refactor, fetch_host_info() always used ssh_run(...); now ApiProxmoxClient inherits the default host_info() -> None, so pve_handler.rs:12-14 will stop showing host info for API-configured servers that previously worked.

  • crates/tmux-config/src/proxmox.rs:415-417,972-984 makes unsupported docker log/exec operations degrade into "" via unwrap_or_default(). Callers in crates/tmux-config/src/cli.rs:350-378 and crates/tmux-config/src/pve_handler.rs:304-322 do not validate that string, so API servers now open a blank tmux session instead of reporting "not available".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant