Uh oh!
There was an error while loading. Please reload this page.
refactor: reduce complexity in ramnode picker and cmdInteractive - #756
Conversation
la14-1
left a comment
There was a problem hiding this comment.
Self-review by complexity-hunter:
RamNode _pick_flavor refactor: Replaced 37 lines of hand-rolled interactive picker logic with a single call to interactive_pick from shared/common.sh. This follows the same pattern already used by Hetzner, netcup, and Hostinger. The _list_flavors function already outputs pipe-delimited lines with ID as the first field, which is exactly the format interactive_pick expects. The env var check (RAMNODE_FLAVOR), default value (1GB), and display behavior are all preserved by the shared helper.
cmdInteractive credential sorting: Extracted the inline credential partitioning and hint-building logic into a standalone prioritizeCloudsByCredentials function. This is a pure function that takes clouds + manifest and returns sorted clouds, hint overrides, and credential count. The function is exported for potential future unit testing. No behavioral changes — the interactive picker works identically.
Both changes verified with bash -n and bun test (all 572 command tests pass).
la14-1
commented
Feb 12, 2026
PR Review by pr-maintainer: Reviewed. Clean refactor extracting |
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Findings
No security issues found.
Both changes are pure refactors with identical runtime behavior:
ramnode/lib/common.sh: Replaces 37-line hand-rolled_pick_flavorwith a single call to the sharedinteractive_pickhelper. No new input handling, no shell injection vectors, env var fallback pattern preserved.cli/src/commands.ts: Extracts inline credential-sorting intoprioritizeCloudsByCredentials()pure function. No new external input paths, manifest description used only in local terminal display (no XSS risk).
Tests
- bash -n: PASS (ramnode/lib/common.sh)
- bun test: PASS (6062/6075, 13 pre-existing failures identical to main)
- curl|bash pattern: OK (source/eval fallback not modified)
- macOS compat: OK (no bash 3.x incompatible patterns introduced)
Automated security review by spawn security team
louisgv
commented
Feb 12, 2026
Merge Conflict NoticeThis PR was approved in the security review cycle, but now has merge conflicts (likely caused by other PRs merging first: #755, #757, #758). The PR has the Automated notice by spawn security review team |
- Replace RamNode's custom _pick_flavor (37 lines) with shared interactive_pick helper (1 line), eliminating duplicated picker logic - Extract credential sorting from cmdInteractive into reusable prioritizeCloudsByCredentials helper for testability and clarity Agent: complexity-hunter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
d5e3c88 to
7533165Comparela14-1
commented
Feb 12, 2026
Rebased onto latest main to resolve merge conflict. The conflict was trivial: Re-review summary (pr-maintainer):
|
la14-1
left a comment
There was a problem hiding this comment.
Reviewed by pr-maintainer: Clean refactoring - extracts prioritizeCloudsByCredentials from cmdInteractive for testability, delegates ramnode _pick_flavor to shared interactive_pick helper. Pure refactoring, no behavior changes. LGTM.
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Findings
No security issues found. This is a clean refactor:
prioritizeCloudsByCredentialsextraction: identical logic moved fromcmdInteractiveto a standalone typed function. No new inputs, no injection surfaces._pick_flavorsimplification: delegates to the sharedinteractive_pickhelper using the same pattern as Hetzner, netcup, and Hostinger. All arguments are string literals or function names.
Tests
- bash -n: PASS
- bun test: PASS (6375/6388, 13 pre-existing failures unrelated to this PR)
- curl|bash pattern: OK (no changes to source/eval fallback)
- macOS compat: OK (no bash 3.x incompatible constructs introduced)
Automated security review by spawn security team
Uh oh!
There was an error while loading. Please reload this page.
Summary
_pick_flavor(37 lines of hand-rolled picker logic) with a single call to the sharedinteractive_pickhelper, eliminating code duplication with Hetzner, netcup, and Hostinger which already use this patterncmdInteractiveinto a standaloneprioritizeCloudsByCredentialsfunction for better testability and readabilityNet reduction: 27 lines (-55 / +28)
Test plan
bash -n ramnode/lib/common.shpassesbun testpasses (6062/6075, 13 pre-existing failures unrelated to this change)🤖 Generated with Claude Code