Skip to content

fix(service): auto-resolve environmentID in network and port-forward#187

Merged
yuaanlin merged 1 commit intomainfrom
fix/auto-resolve-env-id
Mar 17, 2026
Merged

fix(service): auto-resolve environmentID in network and port-forward#187
yuaanlin merged 1 commit intomainfrom
fix/auto-resolve-env-id

Conversation

@yuaanlin
Copy link
Member

@yuaanlin yuaanlin commented Mar 17, 2026

Summary

  • service network and service port-forward both required --env-id in non-interactive mode
  • Every project has exactly one environment (environments are deprecated), so we can auto-resolve it from the service ID
  • Uses existing util.ResolveEnvironmentIDByServiceID that other commands already use (expose, restart, etc.)

Before

zeabur service network --id SERVICE_ID -i=false
# Only shows dnsName, no port forwarding info

zeabur service port-forward --id SERVICE_ID -i=false
# ERROR: environment id is required

After

zeabur service network --id SERVICE_ID -i=false
# Shows dnsName + port forwarding mode + forwarded host:port

zeabur service port-forward --id SERVICE_ID -i=false
# Shows port forwarding status with forwarded endpoints

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Environment ID is now automatically resolved from the service ID when not explicitly provided, improving the user experience by reducing manual configuration requirements and streamlining the setup process.

…commands

Both commands required --env-id flag in non-interactive mode, but every
project has exactly one environment. Use ResolveEnvironmentIDByServiceID
to auto-resolve when --env-id is not provided.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Both the network and port-forward service command files now auto-resolve the environmentID from the serviceID when environmentID is not provided, instead of treating it as a missing required parameter.

Changes

Cohort / File(s) Summary
Auto-resolve environmentID
internal/cmd/service/network/network.go, internal/cmd/service/port-forward/port_forward.go
Both files now implement automatic resolution of environmentID using util.ResolveEnvironmentIDByServiceID when the environmentID is not provided, replacing the previous requirement or error-returning behavior for missing environmentID.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(service): auto-resolve environmentID in network and port-forward' accurately describes the main change: auto-resolution of environmentID across two service commands.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/auto-resolve-env-id
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@yuaanlin yuaanlin merged commit ade1a3d into main Mar 17, 2026
4 of 5 checks passed
@yuaanlin yuaanlin deleted the fix/auto-resolve-env-id branch March 17, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant