Skip to content

feat: add testtrack show to read a split's remote weights#72

Merged
rzane merged 7 commits into
Betterment:mainfrom
bestdan:bestdan/show-split-weights
Jun 26, 2026
Merged

feat: add testtrack show to read a split's remote weights#72
rzane merged 7 commits into
Betterment:mainfrom
bestdan:bestdan/show-split-weights

Conversation

@bestdan

@bestdan bestdan commented Jun 24, 2026

Copy link
Copy Markdown
Member

What

Adds a read-only testtrack show <split> command that prints the current variant weights of a split / feature gate from the remote TestTrack server, without modifying the local schema.

Why

Reading live weights previously required testtrack sync (which mutates the local schema), the admin UI, or a raw curl. show is a side-effect-free lookup so devs can check a feature gate's current weights directly.

Usage

TESTTRACK_CLI_URL=https://tt.example.com testtrack show my_app.my_feature_enabled
# my_app.my_feature_enabled
#   false  100%
#   true     0%

--json emits the raw weights map for scripting. Works against both a real server and a local testtrack server.

Notes

  • GETs api/v2/split_registry (no .json suffix) so it resolves against both the real Rails server and the bundled fakeserver (which registers the suffix-less route). Verified live against a demo environment.
  • Reuses the existing serializers.RemoteRegistry; no new dependencies.
  • Tests cover human/JSON formatting, sorted output, the not-found error, and the missing-TESTTRACK_CLI_URL path.

bestdan added 3 commits June 24, 2026 12:26
Reading live split weights previously required `sync` (which mutates the
local schema), the admin UI, or a raw curl. `show` is a read-only lookup
against the split registry so devs can check a feature gate's current
weights without side effects.
@bestdan bestdan marked this pull request as ready for review June 25, 2026 21:03
jonahollman
jonahollman previously approved these changes Jun 25, 2026

@jonahollman jonahollman 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.

Awww yeah. Looks solid!

@bestdan bestdan closed this Jun 25, 2026
@bestdan bestdan reopened this Jun 25, 2026
jonahollman
jonahollman previously approved these changes Jun 25, 2026

@jonahollman jonahollman 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.

👍

The new docs/ design-spec dir broke 'go test', which only excluded doc/.
@betterment-policy-bot-production betterment-policy-bot-production Bot dismissed stale reviews from jonahollman and jonahollman June 25, 2026 21:29

Invalidated by push of 6221186

jonahollman
jonahollman previously approved these changes Jun 25, 2026

@jonahollman jonahollman 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.

👍

Comment thread cmds/show_test.go Outdated
Comment on lines +49 to +51
if output != expected {
t.Errorf("expected:\n%q\ngot:\n%q", expected, output)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Other tests in this repository are using testify. Perhaps we could use it here too?

Adopt require to match the rest of the suite and add a width-alignment case.
@rzane rzane merged commit 05ade70 into Betterment:main Jun 26, 2026
5 checks passed
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.

3 participants