Skip to content

♻️ Oversized file cleanup — deferred splits (close #14) - #15

Merged
turtton merged 7 commits into
mainfrom
refactor/oversized-modules
Jul 20, 2026
Merged

♻️ Oversized file cleanup — deferred splits (close #14)#15
turtton merged 7 commits into
mainfrom
refactor/oversized-modules

Conversation

@turtton

@turtton turtton commented Jul 20, 2026

Copy link
Copy Markdown
Member

概要

Issue #14 の延期リスト全件への対応。全て機械的分割・監査済み死コード削除であり、到達可能コードの挙動変更はありません。

close #14

変更内容

先行バグ修正(ベースライン clippy エラーの解消、ユーザー承認済み)

  • 94b9aaa 🐛 SSRF フィルタの IPv6 documentation range (2001:db8::/32) チェックが恒 false になっていたバグを修正(application/driver の重複箇所両方、単体テスト追加)

分割(#13 と同一規約の directory module 化)

  • 4b3d826 adapter processor/account.rs (435行) → account/{mod,command,query}.rs(7つの公開パスは再エクスポートで維持)
  • 4ca9be6 server route/activitypub.rs (532行) → activitypub/{mod,discovery,actor,collections,inbox}.rs
  • 6431ddf server route/oauth2.rs (897行) → oauth2/{mod,login,consent}.rs
  • 9eda8c6 driver postgres/account.rs (784行) → account/{mod,row,tests}.rs(SQL リテラルはバイト同一を検証済み。impl ブロックは分割せず row マッピングとテストを抽出)

利用監査の結果: 分割ではなく死コード削除

account_detail 導入により call site がゼロになっていた UseCase trait を削除(Issue の「利用監査の実施」トリガーに対応):

  • 14bab0c service/metadata.rs: Get/Create/Update/DeleteMetadataUseCase 削除(420→110行)。UpdateMetadata/rehydrate_metadata は applier/account_detail が使用中のため保持
  • 7c1aa22 service/profile.rs: Get/UpdateProfileUseCase 削除(326→116行)。UpdateProfile/resolve_field_action_image_id 等は保持

対象外(Issue 記載の方針通り)

  • server/src/handler.rskernel/src/entity/account.rs — サイズ例外として分割しない
  • server/tests/support/*.rs — fixture は ceiling 適用外
  • SSRF/DNS pinning ロジックの共通化 — architecture change のため別途設計

検証

  • cargo build / cargo clippy --all-targets / cargo fmt --check: 全て exit 0
  • cargo test: 全スイート 0 失敗(PostgreSQL/Redis 起動済み環境。postgres account の DB テスト8件は実 DB で実行して green)
  • 移動テストの検出数: oauth2 10件・activitypub 4件ともに移動前後で一致、OpenAPI スナップショットテスト pass
  • diff 監査: 移動 + 2件の死コード削除のみ(SQL・route 定義・trait bounds の変更なし)
  • 第三者レビュー(read-only): APPROVE

補足

削除により transfer/{metadata,profile}.rs の DTO が dead-but-public になったが、スコープ外のため保持(後続クリーンアップ候補)。

turtton added 7 commits July 21, 2026 00:01
The masked comparison (segments()[1] & 0xfff0) == 0x0db8 could never be
true (0x0db8 & 0xfff0 == 0x0db0), leaving the 2001:db8::/32 documentation
range unblocked. Compare both /32 segments exactly instead. Same defect
existed in the duplicated guard in driver http_signing; both are fixed
and covered by a new unit test.
Pure mechanical move of adapter/src/processor/account.rs into a directory module; no behavior change.
Remove confirmed-dead metadata use-case traits and implementations while retaining projection and rehydration behavior; no behavior change for reachable code.
Remove confirmed-dead profile use-case traits and implementations while retaining projection and image-resolution behavior; no behavior change for reachable code.
…ibility

Pure mechanical move of server/src/route/activitypub.rs into a directory module; no behavior change.
Pure mechanical move of server/src/route/oauth2.rs into a directory module; no behavior change.
…nd tests

Pure mechanical move of driver/src/database/postgres/account.rs into a directory module; no behavior change.
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.79634% with 262 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.53%. Comparing base (6669ac4) to head (9eda8c6).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
server/src/route/activitypub/inbox.rs 15.38% 99 Missing ⚠️
adapter/src/processor/account/query.rs 16.90% 59 Missing ⚠️
server/src/route/activitypub/mod.rs 49.23% 33 Missing ⚠️
driver/src/database/postgres/account/row.rs 44.73% 21 Missing ⚠️
server/src/route/activitypub/collections.rs 79.01% 17 Missing ⚠️
server/src/route/oauth2/login.rs 94.89% 14 Missing ⚠️
server/src/route/activitypub/discovery.rs 79.31% 12 Missing ⚠️
server/src/route/activitypub/actor.rs 76.19% 5 Missing ⚠️
server/src/route/oauth2/mod.rs 92.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #15      +/-   ##
==========================================
- Coverage   64.76%   64.53%   -0.23%     
==========================================
  Files         116      147      +31     
  Lines       15203    14400     -803     
==========================================
- Hits         9846     9293     -553     
+ Misses       5357     5107     -250     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@turtton
turtton merged commit 7a7fd47 into main Jul 20, 2026
13 checks passed
@turtton
turtton deleted the refactor/oversized-modules branch July 20, 2026 15:40
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.

Oversized file cleanup: deferred splits with triggers (post #12/#13)

1 participant