Skip to content

feat(tb-lf): add flag-cohort-stratified subcommand#19

Merged
trogulja merged 4 commits intomainfrom
feature/stratified-flag-cohort
Apr 19, 2026
Merged

feat(tb-lf): add flag-cohort-stratified subcommand#19
trogulja merged 4 commits intomainfrom
feature/stratified-flag-cohort

Conversation

@trogulja
Copy link
Copy Markdown
Collaborator

Summary

  • New tb-lf flag-cohort-stratified subcommand that consumes the stratified_flag_stats DevPortal endpoint (productiveio/devportal#254)
  • Shows per-cohort ON vs OFF metrics with flag diffs between cohorts
  • Extracts print_cohort to shared function (was inline in flag-cohort handler)

Usage

tb-lf flag-cohort-stratified aiAgentDiscoveryAgent --from 7d --to today
tb-lf flag-cohort-stratified aiAgentDiscoveryAgent --from 7d --to today --env default
tb-lf flag-cohort-stratified aiAgentDiscoveryAgent --from 7d --to today --max-cohorts 5
tb-lf flag-cohort-stratified aiAgentDiscoveryAgent --from 7d --to today --json

Features

  • --max-cohorts (default 3) — sorted by cohort size, largest first
  • --min-cohort-size (default 10) — minimum traces per cohort
  • --detail metrics|traces — metrics mode shows cost/latency/errors, traces mode shows trace IDs
  • Flag diff display between cohorts (green +flag / red -flag)
  • Delta cost % summary per cohort

Test plan

  • Builds clean (cargo build)
  • Clippy clean
  • Help text renders correctly
  • Manual test with production data (pending DevPortal deployment)

🤖 Generated with Claude Code

trogulja and others added 3 commits April 17, 2026 18:43
New CLI subcommand that consumes the stratified_flag_stats DevPortal
endpoint. Shows per-cohort ON vs OFF comparison with flag diffs between
cohorts, controlling for confounding from other feature flags.

- --max-cohorts param (default 3, sorted by size)
- --min-cohort-size param (default 10)
- --detail metrics|traces modes
- Flag diff display (green +flag / red -flag between cohorts)
- Delta cost summary per cohort
- Extracts print_cohort to shared function (was inline in flag-cohort)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Document simple vs stratified flag-cohort analysis, when to use each,
how to interpret stratified results (cohort diff, delta consistency,
interaction effects), and the recommended 4-step workflow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@trogulja trogulja marked this pull request as ready for review April 19, 2026 15:15
@trogulja trogulja merged commit 0da348b into main Apr 19, 2026
1 check passed
@trogulja trogulja deleted the feature/stratified-flag-cohort branch April 19, 2026 15:19
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