-
-
Notifications
You must be signed in to change notification settings - Fork 0
Remove tailnet option #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughRemoved the Tailnet configuration field and its CLI flags/env reference across the codebase and tsapi.Client initializations; added centralized dry-run error handling and messaging in instance creation; reordered local Tailscale status retrieval in status handling. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as User/UI
participant App as App (create)
participant Spinner as Spinner
participant EC2 as EC2 API
participant TSAPI as tsapi.Client
UI->>App: request create (dryRun?)
App->>Spinner: start spinner and createInstance
Spinner->>EC2: CreateInstance (DryRun if set)
EC2-->>Spinner: success (or DryRun success)
Spinner-->>App: createInstance returned
alt dryRun == true
App-->>App: return ErrDryRun
App->>UI: print "dry run successful" message
else
App->>TSAPI: initialize client (APIKey, BaseURL)
App->>TSAPI: register device / post-creation steps
App->>UI: normal completion
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes Changes are consistent removals of a config field/flag across many files (low individual complexity) plus several logic edits (dry-run handling and status retrieval reorder) that require focused review. Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tailout/create.go (1)
128-143: Consider consolidating dry-run error handling.The dry-run flow works but involves multiple layers:
- AWS SDK returns a
DryRunOperationerrorcreateInstancecatches it and returnsnilerror (lines 316-319)- The spinner action then checks the
dryRunflag and returnsErrDryRun(lines 128-130)- Finally,
ErrDryRunis caught and converted to a success message (lines 140-143)Consider having
createInstancereturnErrDryRundirectly when it detects the AWS dry-run error. This would eliminate the need to check thedryRunflag in the spinner action:In
createInstancefunction (around line 316-319):if runErr != nil { var dryRunErr *smithy.GenericAPIError if errors.As(runErr, &dryRunErr) && dryRunErr.Code == "DryRunOperation" { - return instance, nil + return instance, ErrDryRun } return instance, fmt.Errorf("failed to create EC2 instance: %w", runErr) }Then remove the dry-run check from the spinner action:
errSpin := s.Context(ctx).ActionWithErr(func(context.Context) error { instance, createErr := createInstance(ctx, cfg, runInput, s) if createErr != nil { return createErr } - if dryRun { - return ErrDryRun - } if instance.InstanceID == "" { return errors.New("no instance ID returned") }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
.github/workflows/ci.yaml(0 hunks)README.md(0 hunks)cmd/connect.go(0 hunks)cmd/create.go(0 hunks)cmd/init.go(0 hunks)cmd/status.go(0 hunks)cmd/stop.go(0 hunks)tailout/config/config.go(0 hunks)tailout/connect.go(0 hunks)tailout/create.go(3 hunks)tailout/disconnect.go(1 hunks)tailout/init.go(0 hunks)tailout/status.go(1 hunks)tailout/stop.go(0 hunks)tailout/ui.go(0 hunks)
💤 Files with no reviewable changes (12)
- README.md
- cmd/connect.go
- cmd/status.go
- tailout/config/config.go
- .github/workflows/ci.yaml
- tailout/ui.go
- tailout/stop.go
- tailout/init.go
- cmd/init.go
- cmd/stop.go
- tailout/connect.go
- cmd/create.go
🔇 Additional comments (4)
tailout/disconnect.go (1)
18-21: LGTM!The removal of the Tailnet field from the API client initialization is clean and aligns with the PR objective to remove the Tailnet option.
tailout/create.go (3)
27-30: LGTM!The addition of
ErrDryRunimproves error handling by providing a distinct error type for successful dry-run operations, allowing for more specific messaging and control flow.
44-47: LGTM!The removal of the Tailnet field from the API client initialization is consistent with the PR objective and aligns with similar changes across other files.
109-109: LGTM!The lowercase change improves consistency in user-facing error messages.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary by CodeRabbit
Refactor
Bug Fixes
New Features
Documentation