Skip to content

feat(column-query): キャッシュ検索をカラムの所属バケットで絞る - #961

Merged
hitalin merged 1 commit into
developfrom
feat/bucket-scoped-column-query
Aug 4, 2026
Merged

hitalin merged 1 commit into
developfrom
feat/bucket-scoped-column-query

Conversation

@hitalin

@hitalin hitalin commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

なぜ

カラムクエリのキャッシュ遡り検索(#783 Phase 3)はタイムライン種別で絞っていない。notecli#30 以前は所属が後勝ち上書きで母集合を保証できず、種別で絞ると「本来あるはずのノートが出てこない」取りこぼしになるため、気づける側(別種別が混ざる)に倒した意図的な妥協だった(068bb210 が notecli#30 待ちと明文化)。

実体/所属分離(V6)が入ったので、この妥協を解消する(notecli#30 仕様 v5 §12-9)。

変更内容

  • notecli rev を 203d9d8feat(db): scan_cached_notes にバケット絞り (scope) を追加 notecli#57: scan_cached_notes に scope 追加)に bump
  • qir_search_cachetimelineKey: string | null を追加 — canonical キーで当該バケット所属のみを母集合にする。parse 失敗は Err で顕在化、null は従来の全体走査(挙動不変)
  • フロント: loadMoreFromCache の searchable 分岐で columnCacheKey 由来の cacheKey を渡す — クエリ付きカラムの遡り検索に別種別のノートが混ざらなくなる
  • useNoteColumnCache の妥協コメントを解消済みの記述に更新、bindings.ts / openapi.json 再生成

テスト

  • backend: cargo test 285 本全通過・clippy 警告ゼロ
  • front: vitest 2565 本全通過(dom テストにバケットキー引数の検証を追加)・typecheck / biome clean

🤖 Generated with Claude Code

カラムクエリのキャッシュ遡り検索 (#783 Phase 3) はタイムライン種別で
絞っていなかった — notecli#30 以前は所属が後勝ち上書きで母集合を保証できず、
種別で絞ると取りこぼしになるため「混ざる側」に倒した妥協だった
(068bb21 が notecli#30 待ちと明文化)。

実体/所属分離が入ったので、notecli の scan_cached_notes に追加された
scope (notecli#57) を配線して妥協を解消する:

- qir_search_cache に timeline_key (canonical, nullable) を追加。
  parse 失敗は Err で顕在化、null は従来の全体走査
- フロントは loadMoreFromCache の searchable 分岐で columnCacheKey 由来の
  cacheKey を渡す — 別種別のノートが検索結果に混ざらなくなる
- notecli rev を 203d9d8 (scan scope 追加) に bump

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 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: 63eca5a9-acf9-4dee-9f04-b04750b94fa8

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

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

@github-actions github-actions Bot added rust Pull requests that update rust code javascript Pull requests that update javascript code labels Aug 4, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying notedeck with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3e004c0
Status: ✅  Deploy successful!
Preview URL: https://d90523ea.notedeck-d3a.pages.dev
Branch Preview URL: https://feat-bucket-scoped-column-qu.notedeck-d3a.pages.dev

View logs

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

API surface diff

外部アプリ向け API 面 (src-tauri/openapi.json / src/bindings.ts) が変更されています。
互換性への影響 (#709) をレビューしてください。

src/bindings.ts | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
Full diff
diff --git a/src/bindings.ts b/src/bindings.ts
index 8659022..d697552 100644
--- a/src/bindings.ts
+++ b/src/bindings.ts
@@ -88,14 +88,20 @@ async qirValidate(query: QirQuery) : Promise<QirValidation> {
  * 偽陰性を出さない規則に従うので (不変条件 (b))、FTS で落ちたノートが
  * 本来マッチするということはない。
  * 
+ * `timeline_key` (canonical 文字列) を渡すと当該バケット所属のみを母集合に
+ * する。実体/所属分離 (notecli#30) 以前は所属が後勝ち上書きで種別絞りが
+ * 取りこぼしになるため全体走査しかなかったが、その妥協は解消済み。
+ * null は従来どおりアカウントの全キャッシュを走査する。
+ * 
  * 走査上限に達したら打ち切って継続カーソルを返す。呼び出し側は必要なだけ
- * 繰り返す (一度の呼び出しで巨大キャッシュを読み切らせない)。
+ * 繰り返す (一度の呼び出しで巨大キャッシュを読み切らせない)。カーソルは
+ * 同じ timeline_key の続き読みにのみ使うこと。
  *
  * @see src-tauri/src/commands/column_query.rs
  */
-async qirSearchCache(accountId: string, query: QirQuery, limit: number | null, maxScannedRows: number | null, cursor: QirSearchCursor | null) : Promise<Result<QirSearchResult, { code: string; message: string; apiCode: string | null }>> {
+async qirSearchCache(accountId: string, query: QirQuery, timelineKey: string | null, limit: number | null, maxScannedRows: number | null, cursor: QirSearchCursor | null) : Promise<Result<QirSearchResult, { code: string; message: string; apiCode: string | null }>> {
     try {
-    return { status: "ok", data: await TAURI_INVOKE("qir_search_cache", { accountId, query, limit, maxScannedRows, cursor }) };
+    return { status: "ok", data: await TAURI_INVOKE("qir_search_cache", { accountId, query, timelineKey, limit, maxScannedRows, cursor }) };
 } catch (e) {
     if(e instanceof Error) throw e;
     else return { status: "error", error: e  as any };

@hitalin hitalin self-assigned this Aug 4, 2026
@hitalin
hitalin merged commit 7cf1dee into develop Aug 4, 2026
12 checks passed
@hitalin hitalin mentioned this pull request Aug 4, 2026
@hitalin
hitalin deleted the feat/bucket-scoped-column-query branch August 10, 2026 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant