Skip to content

feat(symbols): derive the upload endpoint from --base-uri - #773

Merged
abelonogov-ld merged 3 commits into
mainfrom
andrey/symbols-backend-url-from-base-uri
Aug 5, 2026
Merged

feat(symbols): derive the upload endpoint from --base-uri#773
abelonogov-ld merged 3 commits into
mainfrom
andrey/symbols-backend-url-from-base-uri

Conversation

@abelonogov-ld

@abelonogov-ld abelonogov-ld commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Uploading symbols to anything other than production took two flags that had to agree: --base-uri to name the instance, and --backend-url to name that same instance's observability API. Staging looked like this:

ldcli symbols upload --type android --project my-project \
  --base-uri https://ld-stg.launchdarkly.com \
  --backend-url https://pri.observability.ld-stg.launchdarkly.com \
  --access-token api-...

The second flag is derivable from the first. Every instance publishes its observability API under a host named for the instance, which is exactly how the production default in this file was already built, so --backend-url now defaults to the API of whichever instance --base-uri names and the command above loses a line.

Only LaunchDarkly's own hosts are derived from. A base URI aimed at a local stack or a proxy says nothing about where its observability API listens, so those keep today's production default, and --backend-url still overrides everything — which is how local development already points at http://localhost:8082/private.

Behavior for the default base URI is unchanged: app.launchdarkly.com derives the same pri.observability.app.launchdarkly.com the constant held. The flag's registered default moves from that constant to empty so the derivation can run; --help now names the production URL in the description instead.

Test plan

  • go test ./cmd/symbols/ — new TestDefaultBackendURLFor covers production, staging, a regional host, trailing slashes and whitespace, and the cases that fall back to the default (local stack, a host that merely ends in the domain name, unset, unparseable)
  • go build ./...
  • Uploaded Android symbols to staging with only --base-uri https://ld-stg.launchdarkly.com. A staging access token authenticated, which it could not have against the production default, so the derivation reached the staging API. The mapping was keyed by the pg_map_id R8 recorded and the dedup handshake reported the index already stored there, so the handshake round-tripped but the object PUT did not re-run

Made with Cursor

Uploading to any instance other than production took two flags that had to
agree: --base-uri to name the instance, and --backend-url to name that same
instance's observability API. The second is derivable from the first, since
every instance publishes the API under a host named for it, which is how the
production default was already built.

--backend-url now defaults to the API of whichever instance --base-uri names,
so staging is one flag. Only LaunchDarkly's own hosts are derived from: a base
URI aimed at a local stack says nothing about where its observability API
listens, so those keep the production default and --backend-url still overrides.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld
abelonogov-ld requested a review from Vadman97 August 5, 2026 01:59
@abelonogov-ld
abelonogov-ld enabled auto-merge (squash) August 5, 2026 02:14

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1dec099. Configure here.

Comment thread cmd/symbols/upload.go

if backendUrl == "" {
backendUrl = defaultBackendUrl
backendUrl = defaultBackendURLFor(viper.GetString(cliflags.BaseURIFlag))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Silent backend default change

Medium Severity

When --backend-url is unset, uploads now derive the observability endpoint from --base-uri for LaunchDarkly hosts, changing the previous production default for non-prod instances with no transitional stderr notice. That violates the rule that user-facing CLI default changes need a warning for at least one release cycle.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by learned rule: Breaking CLI default changes require transitional stderr warnings

Reviewed by Cursor Bugbot for commit 1dec099. Configure here.

defaultBackendURLFor landed inside getSymbolUploadUrls' doc comment, which
left that function undocumented and opened the new one with three paragraphs
about upload URLs and dedup retries.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld
abelonogov-ld merged commit f8ee593 into main Aug 5, 2026
8 checks passed
@abelonogov-ld
abelonogov-ld deleted the andrey/symbols-backend-url-from-base-uri branch August 5, 2026 19:26
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.

2 participants