Skip to content

feat(freshness): all-role telemetry-threshold read surface so the multiplier is live (#183)#215

Merged
takashikasuya merged 1 commit into
mainfrom
claude/telemetry-thresholds-read-surface
Jul 18, 2026
Merged

feat(freshness): all-role telemetry-threshold read surface so the multiplier is live (#183)#215
takashikasuya merged 1 commit into
mainfrom
claude/telemetry-thresholds-read-surface

Conversation

@takashikasuya

Copy link
Copy Markdown
Contributor

Addresses #183 の残り + #210 レビューのフォローアップを実装。per-point の鮮度倍率を runtime で全ロールが読むようにし、管理者の変更が実際に stale 判定へ反映されるようにします(従来は false affordance 回避のため固定定数でした)。

Summary

Backend

  • telemetry.staleIntervalMultiplier を editable SettingsRegistry再追加(runtime で読まれるようになったため false affordance ではなくなった)。
  • ISystemSettingsService.GetTelemetryThresholdsAsync が実効値 { staleThresholdSeconds, staleIntervalMultiplier }(既定 + 管理者 override)を返す。
  • 新規 GET /api/telemetry/configTelemetryConfigController, [AuthorizeFilter] = 認証済みなら全ロール可)。返すのは上記 2 値だけで、他の設定は一切漏らさない。編集は従来どおり管理者限定の /api/system/settings

Frontend

  • lib/telemetry/repository.tsgetTelemetryConfig() がこのサーフェスを取得(セッションキャッシュ + 失敗時は定数へフォールバックし鮮度判定が壊れない)。エンドポイントは aspida 未生成のため bespoke fetch(型生成は follow-up)。
  • home loaders とポイント詳細の鮮度バッジ(TelemetryHotData)が、定数ではなく取得した閾値・倍率を使うよう配線。

Test plan

  • yarn test422 pass(+4: getTelemetryConfig の parse/cache/fallback、およびレビュー指定の回帰 — 同一 interval/age が served 倍率 3→5 で stale→fresh に変わることを fetch→config→threshold→classify の実経路で確認)
  • yarn typecheck / yarn lint — 0 errors
  • yarn build — 本番ビルド成功
  • dotnet build(ApiServer)— 0 errors
  • dotnet test(Shared.Test Configuration フィルタ)— 31 pass(+2: 既定値フォールバック、倍率 override の反映)

残り follow-up

  • device / gateway 既定周期は Twin 未モデル化のため resolver は受け口のみ(point + system の 2 段で稼働)。
  • GET /api/telemetry/config の aspida 型生成(現状は bespoke fetch)。

Checklist

  • I read CONTRIBUTING.md and followed the coding conventions in CLAUDE.md
  • I added or updated tests for the change
  • I updated relevant docs (docs/oss-sla-freshness.md)

🤖 Generated with Claude Code


Generated by Claude Code

…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>
@takashikasuya
takashikasuya merged commit 6564869 into main Jul 18, 2026
6 checks passed
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.

2 participants