fix(api): reject oversized OpenTelemetry settings integers #6239
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 497 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.372
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6239"
general
weight: 0.35
Jackmeson1
Fixes #6238
What happens
An oversized OpenTelemetry settings update now returns a field-level JSON 422 before the store changes. GET continues to return the previous settings.
| Schedule delay | Before · PUT / following GET | After · PUT / following GET |
|---|---|---|
|
264 - 1| 200 / 200 | 200 / 200 ||
264| 500 / 500 | 422 / 200 |Cause
The six integer fields had a lower bound. The store could write and apply a value larger than orjson could encode in the settings response.
Change
Use the same inclusive
2**64 - 1limit in request validation, direct store saves, and startup environment parsing. The OpenAPI field descriptions give the exact limit because FastAPI rounds a numeric bound of this size. When a previously saved OpenTelemetry section contains an oversized integer, the store starts with its environment baseline and preserves the file. An oversized environment value uses that field’s existing default. During a rolling API upgrade, the replacement worker applies the same defaults to oversized integers in the legacy Host’s startup baseline, and hosted GET returns that baseline when the Host’s saved settings contain an oversized integer. Reads preserve the settings file, and oversized PUT requests still return422. During Supervisor replacement, apply the existing field defaults to oversized OpenTelemetry integers from a legacy Host while preserving the settings file and enforcing the size limit on new writes. The Supervisor receives only the legacy Host's effective section, so it repairs field by field instead of restoring the startup section.Tests
The regressions cover the accepted boundary, JSON field errors, disk and runtime state after rejection, subsequent GET, saved-file startup, environment fallback, and direct store writes.
On Windows Python 3.10.20 and 3.14.6 I ran the observability API, store, restart and system-settings test files on the original version of this change: 59 passed on each, and with production code from
49e3c981the 12 new cases failed at the expected assertions. After consolidating the tests, the two changed files pass on both versions (8 and 12 tests).On Ubuntu 24.04 at
0d5c305f, the changed tests passed on Python 3.12 with Transformers 5.24.1 and 4.57.6 and on Python 3.10 (20 each). Pre-commit on the changed files and mypy over the repository (1,243 files) passed. The consumer suite had only failures that also occur on the base. With production code from49e3c981, the new tests fail at the expected status assertions.The follow-up commit
30654bfaadds a regression for each legacy-Host case, using the settings store from49e3c981. On Windows Python 3.10.20 and 3.14.6, both failed at the expected assertions with production code from0d5c305fand pass with the fix. On Ubuntu 24.04 at30654bfa, the two changed test files passed on Python 3.12 with Transformers 5.24.1 and 4.57.6 and on Python 3.10 (22 each). With production code from0d5c305fthey fail. Pre-commit and mypy over the repository passed, and the consumer suite had only failures that also occur on the base.The second follow-up commit
0c7ff696adds a regression for each source of the Supervisor case (startup environment and saved settings), using the same legacy store; each runs a real Supervisor replacement and checks readiness and the unchanged settings file. On Windows Python 3.10.20 and 3.14.6 both failed on30654bfawith the delay-boundValueErrorbefore actor-pool creation and pass with the fix. On Ubuntu 24.04 at0c7ff696,test_supervisor_host.pypassed on Python 3.12 with Transformers 5.24.1 and 4.57.6 and on Python 3.10 (13 each); with production code from30654bfathe new cases fail. The consumer tests, pre-commit and mypy over the repository passed.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