Skip to content

dashboard: a guard's drop rate names the same scope in every process - #928

Open
michaellchung wants to merge 1 commit into
mainfrom
oc-z/breaker-drop-rate-tie
Open

michaellchung wants to merge 1 commit into
mainfrom
oc-z/breaker-drop-rate-tie

Conversation

@michaellchung

Copy link
Copy Markdown
Contributor

Summary

Product bug in the dashboard's breaker panel. Results depended on the process's hash seed.

BreakerState.drop_rates reports, for each data-dropping guard, the scope with the
worst drop ratio. It walked a set of (entry, scope) keys and kept the first scope
with the worst ratio. When two scopes have the same ratio, the scope it names follows
the set's iteration order. That order follows the string hashes, so it changes with
PYTHONHASHSEED. With the diloco fixture, breakers.layers[0].rows[2].acted.rate.scope
was island 0 in some processes and island 1 in others.

Fix

The keys are walked in sorted order. Of two scopes with the same ratio the first in
that order is named (island 0 before island 1). Ratios, counts and which entries
are reported are unchanged.

Impact

  • Dashboard only (yeto/dashboard/breakers.py). No training, launch or plan code. The
    customer gate below is identical to main.
  • Before, only a tie between scopes could differ between processes: the page served by
    yeto dashboard and an exported page of the same tapes could name different islands.
  • The scopes' rows, their order on the page (sorted by name) and the other set
    iterations in the panel do not depend on the hash seed (checked: the other set walk,
    in _rows, only fills a dict whose rows are sorted by name afterwards).

Verification

  • New test test_two_islands_with_the_same_drop_rate_name_the_same_island_under_any_hash_seed:
    two islands with the same drop ratio are reduced in 8 processes with
    PYTHONHASHSEED 0 to 7. On main they name {island 0, island 1}; with this change,
    always island 0.
  • The diloco fixture with PYTHONHASHSEED 0 to 3: island 0 every time.
  • tests/test_dashboard*.py and tests/test_breakers*.py: 1187 passed, 2 skipped.
  • Customer gate: the 52 goldens pass, and the examples/k31 dry-runs (run up --dry-run
    of both run configs with their preflight logs, and the pool --dry-run) are identical
    line by line to origin/main after normalization.

🤖 Generated with Claude Code

BreakerState.drop_rates walked a set of (entry, scope) keys and kept the first scope
with the worst ratio. Of two scopes with the same ratio, the one reported (the panel's
"island 0" or "island 1") followed the set's order, which follows the string hashes
and so PYTHONHASHSEED. The keys are now walked in sorted order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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