Skip to content

feat: server_info SWR キャッシュ (servers → server_detections) - #42

Merged
hitalin merged 3 commits into
developfrom
feat/server-detections
Jul 22, 2026
Merged

feat: server_info SWR キャッシュ (servers → server_detections)#42
hitalin merged 3 commits into
developfrom
feat/server-detections

Conversation

@hitalin

@hitalin hitalin commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

なぜ

notedeck-dev/notedeck#782 (Pinia store のサービス層兼務解消) の優先項目。フロントの servers store が持っていた「メモリ → DB → ネットワーク」の SWR・TTL 判定・in-flight dedup は壊れやすいロジックなのに DOM 抜きでテストしづらい場所にあった。Rust 側へ集約してユニットテストで直接守る。

変更

  • server_info::ServerInfoService — SWR 取得 (fresh 即返し / stale 返却+背景再検出 / miss は per-host lock で dedup して検出+保存)。TTL 判定 plan_for は純関数
  • V5 migration: server_detections (生の nodeinfo software + /api/meta JSON) を追加し、旧 servers を削除。旧テーブルは「アプリ側で解決済みの software/features」を保存していたため判定ロジック更新が既存キャッシュに反映されない鮮度問題があった。生データ保存 + 読取時解決で構造的に解消
  • StoredServer / load_servers / get_server / upsert_server は削除 (β方針: 後方互換を残さない)

テスト

  • plan_for 純関数テスト、DB round-trip、wiremock + temp DB で SWR 経路 (miss→fresh→stale 背景再検出) と meta 失敗許容を検証。全 190 テスト green

🤖 Generated with Claude Code

hitalin and others added 3 commits July 20, 2026 07:34
…deck#782)

フロント (Pinia store) が持っていた「メモリ → DB → ネットワーク」の
stale-while-revalidate・TTL 判定・in-flight dedup を ServerInfoService に集約。
保存するのは生の検出結果 (nodeinfo software + /api/meta 生 JSON) で、
フォーク解決と feature 判定はアプリ側が読取時に行う — 判定ロジックの更新が
古いキャッシュに埋まる鮮度問題 (旧 servers テーブル) を構造的に解消する。

- V5 migration: server_detections 追加、旧 servers は削除 (24h キャッシュの
  ため旧データ損失は軽微)
- StoredServer / load_servers / get_server / upsert_server は削除 (β方針)
- plan_for (TTL 判定) は純関数、SWR 経路は wiremock + temp DB でテスト

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 53afd48f-2612-41df-8e86-0e0836ab14b6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/server-detections

Comment @coderabbitai help to get the list of available commands.

@hitalin hitalin self-assigned this Jul 22, 2026
@hitalin
hitalin merged commit 4c5ab83 into develop Jul 22, 2026
4 checks passed
@hitalin hitalin mentioned this pull request Jul 22, 2026
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