feat: server_info SWR キャッシュ (servers → server_detections) - #42
Merged
Conversation
Release v0.5.0
…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>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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.
なぜ
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は純関数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