Skip to content

feat(identity): ノートの同一性キーと origin 判定を導入する - #62

Merged
hitalin merged 2 commits into
developfrom
feat/note-identity
Sep 12, 2026
Merged

feat(identity): ノートの同一性キーと origin 判定を導入する#62
hitalin merged 2 commits into
developfrom
feat/note-identity

Conversation

@hitalin

@hitalin hitalin commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

概要

複数サーバーで観測した同じノートを束ねるための identity (正規化 ActivityPub object id) を導入する。設計の正本は notedeck-dev/notedeck#1058 の設計コメント (v5.1)。この PR は P0 (notecli 側) にあたる。

変更

  • identity モジュール: identity_of / normalize_host / identity_host。uri が無いローカルノートは host + ID から組み立て、純粋 Renote の Announce id (末尾 /activity) を origin 側の行と一致させる。host は UTS#46 で ASCII 小文字化 (ポート保持)。フラグメント・クエリ・末尾スラッシュには触れない
  • NormalizedNote_identity / _isOrigin / _identityTrusted / contentHidden を追加。origin 判定となりすまし検査 (リモート投稿者の host と identity の host の一致) は Rust 側で済ませ、フロントは真偽値を読むだけ。RawNoteisHidden を named field で受ける
  • 旧 JSON は serde default で読み、DB 読み出しの共通関数 parse_cached_note で補完する (5 経路すべて)
  • notes_cacheidentity 列と索引 (V7)。migration は列追加だけにし、既存行の backfill は backfill_identity_chunk で起動後にバックグラウンドで行う。完了前は find_notes_by_identity が uri 列でフォールバックする
  • find_notes_by_identity (account 横断)、search_cached_notes_across (複数アカウントの variant 返却)
  • CLI ログインの host を NoteDeck 経路と同じ ASCII 小文字で保存

テスト

  • identity の正規化 11 件 (ローカル / リモート / /activity / Mastodon / 大文字 / Unicode host / ポート / フラグメント / 解釈不能)
  • models: normalize の identity 導出・再帰・isHidden 透過・旧 JSON の補完・serde 名
  • db: identity 検索の束ね (ローカル行 + /activity 行)、origin / trusted フラグ、backfill と uri フォールバック、旧 JSON の補完、横断検索
  • tests::get_credentials_no_token は develop でも落ちる既存のフレーク (keychain の並列テスト干渉)

🤖 Generated with Claude Code

https://claude.ai/code/session_01FkkqpTo56FUVjoksbhLj1n

複数サーバーで観測した同じノートを束ねるための identity (正規化 AP object id)
を追加する (notedeck#1058)。

- identity モジュール: uri が無いローカルノートは host + ID から組み立て、
  純粋 Renote の Announce id (末尾 /activity) を origin 側の行と一致させる。
  host は UTS#46 で ASCII 小文字化し、比較はすべて Rust 側で済ませる
- NormalizedNote に _identity / _isOrigin / _identityTrusted / contentHidden
  を追加。旧 JSON は serde default で読み、DB 読み出しの共通関数で補完する
- notes_cache に identity 列と索引 (V7、列追加のみ)。既存行の backfill は
  起動をブロックしないチャンク API で行い、完了前は uri 列でフォールバック
- find_notes_by_identity (account 横断) と search_cached_notes_across
- CLI ログインの host を NoteDeck 経路と同じ ASCII 小文字で保存

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkkqpTo56FUVjoksbhLj1n
@coderabbitai

coderabbitai Bot commented Sep 12, 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: Advanced

Run ID: 5318ac2a-04a7-46b3-a4c0-085b3c6e493b

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

CI の stable toolchain が進み、Result<Response, Response> を返す認証
middleware が result_large_err で落ちるようになった。axum の from_fn の
定型なので Err を Box にはできず、この関数に限って許可する。

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkkqpTo56FUVjoksbhLj1n
@hitalin hitalin self-assigned this Sep 12, 2026
@hitalin
hitalin merged commit 92db2f6 into develop Sep 12, 2026
4 checks passed
@hitalin
hitalin deleted the feat/note-identity branch September 12, 2026 05:22
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