feat(freshness): all-role telemetry-threshold read surface so the multiplier is live (#183)#215
Merged
Conversation
…tiplier is live (#183) Closes the #210-review follow-up: the per-point stale multiplier is now read at runtime by every role, so an admin editing it actually changes stale classification (it was previously a fixed constant to avoid a false affordance). Backend - Re-add `telemetry.staleIntervalMultiplier` to the editable SettingsRegistry (now that it is read at runtime). - `ISystemSettingsService.GetTelemetryThresholdsAsync` returns the effective `{ staleThresholdSeconds, staleIntervalMultiplier }` (default + admin override). - New `GET /api/telemetry/config` (`TelemetryConfigController`, `[AuthorizeFilter]` = authenticated, any role) returns only those two numbers — no other settings leak through the non-admin surface. Editing stays admin-only on `/api/system/settings`. Frontend - `lib/telemetry/repository.ts` `getTelemetryConfig()` fetches the surface (session-cached, falls back to the defaults on failure so freshness never breaks). Bespoke fetch as the endpoint is not yet in aspida (regen is a follow-up). - Home loaders and the point-detail freshness badge (`TelemetryHotData`) now use the fetched threshold + multiplier instead of the frontend constants. Tests - Service: thresholds fall back to registry defaults, and an admin override of the multiplier is served. - Frontend: `getTelemetryConfig` parses/caches/falls back, and — the regression the review asked for — the same interval+age flips stale→fresh when the served multiplier goes 3→5, through the actual fetch → config → threshold → classify path. Docs: `docs/oss-sla-freshness.md` §6 updated — the multiplier is now runtime-live. Signed-off-by: Claude <noreply@anthropic.com>
21 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #183 の残り + #210 レビューのフォローアップを実装。per-point の鮮度倍率を runtime で全ロールが読むようにし、管理者の変更が実際に stale 判定へ反映されるようにします(従来は false affordance 回避のため固定定数でした)。
Summary
Backend
telemetry.staleIntervalMultiplierを editableSettingsRegistryに再追加(runtime で読まれるようになったため false affordance ではなくなった)。ISystemSettingsService.GetTelemetryThresholdsAsyncが実効値{ staleThresholdSeconds, staleIntervalMultiplier }(既定 + 管理者 override)を返す。GET /api/telemetry/config(TelemetryConfigController,[AuthorizeFilter]= 認証済みなら全ロール可)。返すのは上記 2 値だけで、他の設定は一切漏らさない。編集は従来どおり管理者限定の/api/system/settings。Frontend
lib/telemetry/repository.tsのgetTelemetryConfig()がこのサーフェスを取得(セッションキャッシュ + 失敗時は定数へフォールバックし鮮度判定が壊れない)。エンドポイントは aspida 未生成のため bespoke fetch(型生成は follow-up)。TelemetryHotData)が、定数ではなく取得した閾値・倍率を使うよう配線。Test plan
yarn test— 422 pass(+4:getTelemetryConfigの parse/cache/fallback、およびレビュー指定の回帰 — 同一 interval/age が served 倍率 3→5 で stale→fresh に変わることを fetch→config→threshold→classify の実経路で確認)yarn typecheck/yarn lint— 0 errorsyarn build— 本番ビルド成功dotnet build(ApiServer)— 0 errorsdotnet test(Shared.Test Configuration フィルタ)— 31 pass(+2: 既定値フォールバック、倍率 override の反映)残り follow-up
GET /api/telemetry/configの aspida 型生成(現状は bespoke fetch)。Checklist
docs/oss-sla-freshness.md)🤖 Generated with Claude Code
Generated by Claude Code