Skip to content

refactor(backend): アーカイブファイルの作成と解凍で同じライブラリを使用するように - #18020

Open
kakkokari-gtyih wants to merge 3 commits into
misskey-dev:developfrom
kakkokari-gtyih:refactor-use-zipjs-for-archiving
Open

kakkokari-gtyih wants to merge 3 commits into
misskey-dev:developfrom
kakkokari-gtyih:refactor-use-zipjs-for-archiving

Conversation

@kakkokari-gtyih

Copy link
Copy Markdown
Member

What

ZIP操作系のライブラリが2つ(ArchiverとZip.js)あるのを解消

Why

Additional info (optional)

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

このPRによるapi.jsonの差分
差分はありません。
Get diff files from Workflow Page

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: misskey-dev/misskey/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a7f3c85d-f715-4fce-81cc-64131c1d0bc3
📥 Commits

Reviewing files that changed from the base of the PR and between a7e0b90 and 582c206.

📒 Files selected for processing: 1
  • packages/backend/src/queue/processors/ExportCustomEmojisProcessorService.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

ZIP書き込み用のZipArchiveを追加しました。カスタム絵文字のエクスポートはこのクラスを使い、メタデータと取得に成功した絵文字をZIPに格納してからDriveへ保存します。同じZIP内ファイル名は、取得に成功したレコードのうち最後のものを保持します。

Changes: ZIP作成とカスタム絵文字のエクスポート

Layer / File(s) Summary
ZIP書き込みと安全性の検証
packages/backend/src/misc/zip.ts, packages/backend/test/unit/misc/zip.ts, packages/backend/package.json
ZipArchiveの作成、ファイル追加、完了・中止処理を追加しました。エントリ名、入力ファイル、出力先を検証するテストを追加し、archiverと@types/archiverを依存関係から削除しました。
カスタム絵文字のZIPエクスポート
packages/backend/src/queue/processors/ExportCustomEmojisProcessorService.ts
一時ファイルのパスをレコードごとに分け、同名のZIPファイルは成功順で最後のものを保持します。メタデータと保持対象の絵文字をZIPに追加し、アーカイブを閉じてからDriveへ保存します。処理後に一時ディレクトリとアーカイブをクリーンアップします。

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant Export as ExportCustomEmojisProcessorService
  participant Zip as ZipArchive
  participant Drive
  participant Notice as 完了通知
  Export->>Zip: メタデータと取得済み絵文字を追加
  Zip-->>Export: ZIPを完成
  Export->>Drive: ZIPを保存
  Export->>Notice: 完了を通知
Loading
Merge Risk: ⚪ Minimal · up to 582c2

Custom emoji export now builds the ZIP with the same library used for extraction. No actionable merge-blocking risk is apparent from the supplied changes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed タイトルは、ArchiverとZip.jsを統合し、ZIP作成と解凍で同じライブラリを使用する主要変更を明確に示しています。
Description check Passed What、チェックリスト、テスト追加の記載があります。Whyセクションは未記入ですが、変更目的はWhatの内容から確認でき、説明は全体として変更内容に関連しています。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

メタデータを先頭に添えて
絵文字のファイルを並べます
同じ名前なら最後を残し
閉じたZIPをDriveへ渡します
作業のあとに一時ファイルを片づけます

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

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.33803% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.32%. Comparing base (d43954b) to head (582c206).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
...e/processors/ExportCustomEmojisProcessorService.ts 0.00% 27 Missing and 2 partials ⚠️
packages/backend/src/misc/zip.ts 95.23% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #18020      +/-   ##
===========================================
- Coverage    26.44%   26.32%   -0.12%     
===========================================
  Files         1159     1159              
  Lines        39773    39825      +52     
  Branches     10961    10973      +12     
===========================================
- Hits         10519    10485      -34     
- Misses       23480    23557      +77     
- Partials      5774     5783       +9     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

⚙️ Backend Diagnostics Report

Memory: After GC

(No significant changes)

V8 Heap Snapshot Statistics

Metric @ Base @ Head Δ MAD
$\color{gray}{\rule{8pt}{8pt}}$ Total 84 MB
± 7.5 KB
84 MB
± 6.9 KB
$\text{+74 KB}$
$\text{+0.1\%}$
10 KB
$\color{orange}{\rule{8pt}{8pt}}$ Code 24 MB 24 MB $\text{+70 KB}$ 9.8 KB
$\color{red}{\rule{8pt}{8pt}}$ Strings 29 MB 29 MB $\text{+264 B}$ 1.2 KB
$\color{cyan}{\rule{8pt}{8pt}}$ JS arrays 5.4 MB 5.4 MB 0 B 0 B
$\color{green}{\rule{8pt}{8pt}}$ Typed arrays 543 KB 543 KB 0 B 0 B
$\color{yellow}{\rule{8pt}{8pt}}$ System objects 2.2 MB 2.2 MB $\text{+4.9 KB}$ 1.2 KB
$\color{violet}{\rule{8pt}{8pt}}$ Other JS objs 23 MB 23 MB $\text{-88 B}$ 228 B
$\color{pink}{\rule{8pt}{8pt}}$ Other non-JS objs 39 KB 39 KB 0 B 0 B

Download representative heap snapshot: base / head

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🖥 Frontend Diagnostics Report

(No significant changes)

View details

Requests by resource type
Type Requests Encoded bytes
Base Head Δ Base Head Δ
Document 2 2 0 33 KB 33 KB 0 B
Script 148 148 0 2.1 MB 2.1 MB 0 B
Stylesheet 58 58 0 284 KB 284 KB 0 B
Fetch 20 20 0 46 KB 46 KB 0 B
Image 10 10 0 254 KB 254 KB 0 B
Font 2 2 0 118 KB 118 KB 0 B
Other 9 9 0 421 KB 421 KB $\color{green}{\text{-4 B}}$
V8 heap snapshot statistics
Metric @ Base @ Head Δ MAD
$\color{gray}{\rule{8pt}{8pt}}$ Total 11 MB
± 3.8 KB
11 MB
± 1.7 KB
$\text{-812 B}$
$\text{-0\%}$
4.1 KB
$\color{orange}{\rule{8pt}{8pt}}$ Code 2.8 MB 2.8 MB $\text{-1.3 KB}$ 1.1 KB
$\color{red}{\rule{8pt}{8pt}}$ Strings 1.2 MB 1.2 MB $\text{+16 B}$ 119 B
$\color{cyan}{\rule{8pt}{8pt}}$ JS arrays 113 KB 113 KB 0 B 0 B
$\color{green}{\rule{8pt}{8pt}}$ Typed arrays 0 B 0 B 0 B 0 B
$\color{yellow}{\rule{8pt}{8pt}}$ System objects 0 B 0 B 0 B 0 B
$\color{violet}{\rule{8pt}{8pt}}$ Other JS objs 2 MB 2 MB $\text{-32 B}$ 196 B
$\color{pink}{\rule{8pt}{8pt}}$ Other non-JS objs 5 MB 5 MB $\text{-1.7 KB}$ 3.5 KB

Download representative heap snapshot: base / head

📦 Bundle Stats

Chunk size diff (0 updated, 0 added, 0 removed)
Chunk Base Head Δ Δ (%)
(total) 5.9 MB 5.9 MB 0 B 0%
(other generated chunks) 2 MB 2 MB 0 B 0%
Startup chunk size (0 updated, 0 added, 0 removed)
Chunk Base Head Δ Δ (%)
(total) 1 MB 1 MB 0 B 0%
(other generated chunks) 757 KB 757 KB 0 B 0%
(other) 283 KB 283 KB 0 B 0%

Startup chunks are the Vite entry for src/_boot_.ts and its static imports.

Bundles Modules Entries Imports Size
Static Dynamic Rendered Gzip Brotli
Base 469 2,855 21 10,334 333 10 MB 2.8 MB 2.4 MB
Head 469 2,855 21 10,334 333 10 MB 2.8 MB 2.4 MB
Δ 0 0 0 0 0 0 B $\text{-10 B}$ $\text{-32 B}$
Δ (%) 0% 0% 0% 0% 0% 0% $\text{-0\%}$ $\text{-0\%}$

Open treemap HTML

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: misskey-dev/misskey/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 253a436f-b015-4132-858c-c8da0fe019ac
📥 Commits

Reviewing files that changed from the base of the PR and between 8e07cf0 and a7e0b90.

⛔ Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing: 4
  • packages/backend/package.json
  • packages/backend/src/misc/zip.ts
  • packages/backend/src/queue/processors/ExportCustomEmojisProcessorService.ts
  • packages/backend/test/unit/misc/zip.ts
💤 Files with no reviewable changes: 1
  • packages/backend/package.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages/backend:test packages/backend Server side specific issue/PR

Projects

Development

Successfully merging this pull request may close these issues.

1 participant