BoxPistols / BoxPistols/BookStory
publish API レスポンスの diff オブジェクトが肥大化する可能性
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## 背景
`apps/web/src/app/api/publish/route.ts` のレスポンスに `diff` オブジェクトを丸ごと含めています。
```ts
return jsonRes({
success: true,
message,
diff, // ← components/tokens 名のフルリスト
warnings: validation.warnings,
}, 200, headers);
```
publish API はリクエスト側で `components: 500 / tokens: 1000` まで受け付けるため、`diff.components.{added,removed,modified}` と `diff.tokens.{added,removed,modified}` の合計で理論上最大 4500 件の名前が返り得ます。Figma プラグイン UI は現状、メッセージ文字列しか表示していないため、ペイロードが無駄に大きい状態です。
## 提案
レスポンスを以下のように分割。
```ts
{
success: true,
message,
summary: {
components: { added: N, removed: N, modified: N },
tokens: { added: N, removed: N, modified: N },
},
details: {
// 上位 N 件(例: 各 20 件)のみ
components: { added: [...], modified: [...], removed: [...] },
tokens: { added: [...], modified: [...], removed: [...] },
},
warnings: [...],
}
```
合わせて、`details` 全件が必要なら別エンドポイント(例: `/api/diff/last`)に分離。
## 関連
- PR #2 のレビュー指摘から派生
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in apps/web/src/app/api/publish/route.ts and trace how diff is assembled for the publish response. Confirm the response contract and choose the agreed limits or separate endpoint before changing it; done means the response no longer returns the full diff while preserving the summary, bounded details, warnings, and message behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100