← Back to Pull requests

fix(api): save literal asterisks in OTLP API keys #6281

Open
unknown opened this pull request with 355 lines diff across 4 files
View on GitHub
unknown unknown commented on Dec 02, 2026 11:02 UTC
Author

Fixes #6280

Saving ab as the OTLP API key now writes it to the settings file and returns ******. A client can also submit a mask from before a key rotation while changing another setting. The store keeps the rotated key.

ObservabilitySettingsStore.save_public previously treated any asterisk as a placeholder. It now recognizes the two forms the API emits after trimming the input: eight asterisks alone, or eight asterisks between a four-character prefix and suffix. It resolves either form under the existing write lock.

The public-route regression starts with an ordinary replacement, then saves ab or a 16-character literal whose eight asterisks are off center. It checks the key on disk, masked PUT and GET responses, resubmission of the current mask, a sampling-rate edit with a stale mask, and an empty clear. The two cases exercise both directions across the short-key masking boundary.

A desired literal identical to either mask remains ambiguous. Supporting that literal requires a protocol decision. #6239 handles integer validation separately.

On Ubuntu 24.04 at d2bf02ce, test_observability_settings_api.py passed on Python 3.12 with Transformers 5.24.1 and 4.57.6 and on Python 3.10 (11 each); with the store from 94688263 the two new cases fail at the saved-key assertion. Pre-commit on the changed files and mypy over the repository passed; the consumer suite had only failures that also occur on the base. On Windows Python 3.10.20 and 3.14.6 the file passed as well (11 each).

Web UI

System Settings now shows the saved OTLP key mask as a placeholder. Backspace in the empty field keeps the current key. Typing ab sends that replacement, and a successful save empties the field and displays the mask returned by the server. Select Clear saved key on save to remove the key.

API clients can resubmit either reserved mask form to keep the current key, including after rotation. After trimming, the store recognizes eight asterisks alone or eight asterisks between a four-character prefix and suffix. A client that sends plai******5678 sets that literal key.

The follow-up commit 7c7ad0cb changes only the frontend. On Windows with Node 24, the 18 system-settings tests pass (npm run test:system-settings), and the seven new UI assertions fail with the frontend from d2bf02ce; eslint, Prettier and tsc --noEmit pass. The regressions use jsdom with a mocked API; I did not run a live browser. The UI regressions cover Backspace, literal replacement, refreshed mask display, explicit clear, and unrelated saves after erasing a draft, leaving only whitespace, or adding the first key in another tab.

AI disclosure: this was prepared with AI assistance (Claude Code with Claude Opus 5.5, and OpenAI Codex with GPT-6.2).

🤖 Generated with Claude Code

Diff: 355 lines (+266 / -89) across 4 files Reviewer: Jackmeson1 Review duration: 896m
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 355 lines diff across 4 files
0.43
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.351
Shallow Review Depth shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #6281"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 42.5% (MEDIUM) · Higher = larger blast radius
42.5%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.7% · Lower = rushed or shallow review
46.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 22.7% · Safe to merge
22.7%