Skip to content

fix: remove hardcoded host fallback, make auth login host positional, cap repo list --limit as total#89

Open
vriesdemichael wants to merge 4 commits intomainfrom
fix/issues-84-86-87
Open

fix: remove hardcoded host fallback, make auth login host positional, cap repo list --limit as total#89
vriesdemichael wants to merge 4 commits intomainfrom
fix/issues-84-86-87

Conversation

@vriesdemichael
Copy link
Copy Markdown
Owner

Summary

  • No localhost as default when no auth is configured #84: Remove the http://localhost:7990 hardcoded fallback in config resolution; now returns a clear validation error (no Bitbucket host configured: set BITBUCKET_URL or run 'bb auth login <host>') when neither BITBUCKET_URL nor stored credentials provide a host.
  • bb auth login --host -> positional arg as it is always required. #86: Change bb auth login --host <url> to a required positional argument: bb auth login <host>. Removes the --host flag and the LoadConfig() fallback path. All call sites and tests updated.
  • limit does not work #87: Fix --limit on bb repo list to cap total results rather than only controlling page size. Introduced defaultPageSize=25; pagination stops as soon as the limit is reached or the last page is returned.

Changes

File What changed
internal/config/config.go Removed defaultBitbucketURL const; empty host now returns a validation error
internal/config/config_test.go Fixed 3 existing tests; added TestLoadFromEnvErrorsWhenNoHostConfigured
internal/cli/cmd/auth/auth.go login now uses cobra.ExactArgs(1) positional host; --host flag removed
internal/cli/cmd/auth/auth_test.go Updated 2 test cases to use positional arg
internal/services/repository/service.go Added defaultPageSize=25; rewrote listPaged() to treat Limit as total cap
internal/services/repository/service_test.go Rewrote TestListRepositoriesAcrossPages to assert limit-as-cap behavior
internal/cli/repo_commands.go Updated --limit flag description
internal/cli/root_test.go Fixed 3 tests for positional auth login arg
tests/integration/live/cli_command_coverage_live_test.go Updated live test to use positional host
tests/integration/live/context_inference_live_test.go Updated 2 live test calls to use positional host

Notes

All unit tests pass (go test ./cmd/... ./internal/...). The live integration tests (-tags=live) require a running Bitbucket instance and are expected to fail in CI without one — this is a pre-existing environment constraint, not a regression introduced by this PR.

Closes #84
Closes #86
Closes #87

Copilot AI review requested due to automatic review settings March 17, 2026 07:03
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.93%. Comparing base (ca51e50) to head (6f08377).

Files with missing lines Patch % Lines
internal/services/repository/service.go 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
+ Coverage   80.88%   80.93%   +0.04%     
==========================================
  Files          53       53              
  Lines       12307    12308       +1     
==========================================
+ Hits         9955     9961       +6     
+ Misses       2179     2174       -5     
  Partials      173      173              
Flag Coverage Δ
combined_scoped 80.93% <92.85%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes implicit localhost host resolution, makes bb auth login require an explicit host argument, and fixes repository pagination so --limit caps total results rather than only controlling page size.

Changes:

  • Remove the http://localhost:7990 default host fallback and return a validation error when no host is configured.
  • Change bb auth login to require a positional <host> argument (removing the --host flag).
  • Rework repository listing pagination so --limit caps total returned results and stops fetching pages once satisfied.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/config/config.go Removes localhost fallback; returns validation error when no host can be resolved.
internal/config/config_test.go Updates env-based config tests and adds coverage for “no host configured” error.
internal/cli/cmd/auth/auth.go Makes auth login host positional and removes --host flag.
internal/cli/cmd/auth/auth_test.go Updates auth command tests for positional login host and dependency paths.
internal/services/repository/service.go Implements limit-as-total-cap pagination with a fixed default page size.
internal/services/repository/service_test.go Updates paging tests to assert early-stop behavior when the limit is reached.
internal/cli/repo_commands.go Updates --limit help text to reflect total-cap semantics.
internal/cli/root_test.go Adjusts CLI tests to use positional auth login host.
tests/integration/live/cli_command_coverage_live_test.go Updates live CLI coverage tests for positional auth login host.
tests/integration/live/context_inference_live_test.go Updates live context inference tests for positional auth login host.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… cap repo list --limit as total

- #84: Remove localhost:7990 default; return a clear validation error when no
  Bitbucket host is configured via BITBUCKET_URL or stored credentials
- #86: Change 'bb auth login --host <url>' to a required positional argument
  'bb auth login <host>'; update all call sites and tests accordingly
- #87: Fix --limit on 'bb repo list' to cap total results instead of only
  controlling page size; add defaultPageSize=25 and paginate until limit is met

Closes #84
Closes #86
Closes #87
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.

limit does not work bb auth login --host -> positional arg as it is always required. No localhost as default when no auth is configured

3 participants