Skip to content

Repo Knowledge更新: product-and-data-model を再検証 - #22

Merged
yamk12nfu merged 2 commits into
mainfrom
chore/knowledge-refresh-product-data-model
Aug 2, 2026
Merged

yamk12nfu merged 2 commits into
mainfrom
chore/knowledge-refresh-product-data-model

Conversation

@yamk12nfu

@yamk12nfu yamk12nfu commented Aug 2, 2026 •

Copy link
Copy Markdown
Owner

概要

.ai/local/knowledge/ の product-and-data-model entryを HEAD (d0566f5) で再検証し、staleだった内容を更新した。knowledge以外のファイルは変更していない。

反映した差分(前回検証commit 2bdbcde 以降のソース変更)

  • parseLogs テーブル廃止 → uploads テーブル新設: 画像storageIdの世帯帰属台帳(by_storageId)。レート制限は @convex-dev/rate-limiter コンポーネント管理に移行
  • 税・値引き差額の金額比按分(TBD-003決着、2026-08-02): 調整行方式からの変更を計算仕様に追記
  • invitations の by_coupleId インデックス追加
  • expenses インデックスに deletedAt を含めた理由(論理削除の走査蓄積回避)を補記

根拠

  • source: docs/requirements.md / convex/schema.ts(git追跡中のローカルファイルのみ)
  • 検証SHA: d0566f51f4ae1bb297316f66da7237f46709a582

検証

  • aro knowledge check --repo . --strict: 本entryは全PASS(残FAILは未着手の authorization-model のみ)
  • aro guard --repo . --base main: violations 0

残課題(次回の1単位)

  • authorization-model entryの再検証(要件5.2の「状態確認プローブ couples.currentMember のnull返却許容」の反映)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 新機能

    • レシート合計と品目合計に差額がある場合、各品目の金額比に基づいて自動調整できるようになりました。
    • 調整によって1円未満となる品目がある場合は、自動処理せず確認を促します。
  • 改善

    • アップロードしたファイルの帰属確認と、不要になったファイルの適切な破棄に対応しました。

- parseLogs廃止→uploadsテーブル(世帯帰属台帳)を反映
- レート制限の@convex-dev/rate-limiterコンポーネント移行を追記
- 税・値引き差額の金額比按分(TBD-003決着)を計算仕様に追記
- invitations.by_coupleId / expensesインデックスのdeletedAt理由を補記

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
warikapp Ignored Ignored Preview Aug 2, 2026 4:29pm

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@yamk12nfu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b4625ce2-97d3-4d3c-ae23-d15e17d72df4

📥 Commits

Reviewing files that changed from the base of the PR and between 03c1515 and a01b8da.

📒 Files selected for processing (1)
  • .ai/local/knowledge/product-and-data-model.md

Walkthrough

AI読み取りのレシート差額按分仕様を追加し、アップロード台帳、世帯帰属検証、未参照ファイルの破棄条件、世帯単位のレート制限をデータモデル文書へ反映しました。

Changes

レシート・データモデル仕様

Layer / File(s) Summary
レシート差額の按分仕様
.ai/local/knowledge/product-and-data-model.md
品目合計とレシート合計の差額を金額比で按分します。品目の負担区分を税にも適用します。1円未満になる品目がある場合は按分せず、画面確認とします。
アップロード管理と世帯単位制限
.ai/local/knowledge/product-and-data-model.md, .ai/local/knowledge/index.yaml
invitations の世帯別インデックスと uploads テーブルを追加します。アップロードの世帯帰属、未参照ファイルの破棄、世帯単位のレート制限を定義します。parseLogs による管理を削除し、検証対象コミットを更新します。

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

うさぎが仕様をぴょんと更新、
差額を品目へそっと配分。
台帳に画像の足跡を記し、
世帯の境界をきちんと確認。
制限も守って、月夜へ帰る。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルは、product-and-data-model の再検証とナレッジ更新という変更の主目的を明確に示しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/knowledge-refresh-product-data-model

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.ai/local/knowledge/product-and-data-model.md:
- Around line 21-23: 差額の符号と按分単位を明記するよう、品目合計とレシート合計の差額仕様を更新してください。`price *
quantity`
の行金額を基準に按分し、レシート合計が大きい場合は差額を各品目価格へ加算し、小さい場合は総額値引きとして各品目価格から減算することを記載してください。1円未満に潰れる場合の確認フローと、税の扱いは既存の記述どおり維持してください。
- Around line 46-47: `uploads` の未参照破棄条件に、`receipts.parse` 後から `expenses.save` の
`attachUpload`
完了まで処理中の画像を削除対象外とする保護条件を追加してください。画像の処理中状態または最低保持時間を仕様に明記し、`discardUpload()`
がその条件を確認して保持中の storage を削除しないよう実装してください。
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ea8ff451-9180-4084-84a6-88d91377839e

📥 Commits

Reviewing files that changed from the base of the PR and between d0566f5 and 03c1515.

📒 Files selected for processing (2)
  • .ai/local/knowledge/index.yaml
  • .ai/local/knowledge/product-and-data-model.md

Comment thread .ai/local/knowledge/product-and-data-model.md Outdated
Comment on lines +46 to +47
- `uploads` は storageId の世帯帰属を記録する台帳。`receipts.parse` / `expenses.save` で
自世帯のアップロードかを検証する。`usedByExpenseId` 未設定なら未参照で破棄可

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# アップロードの検証、保存、削除処理を確認する
rg -n -C 8 \
  'usedByExpenseId|storageId|storage.*delete|delete.*storage|receipts\.parse|expenses\.save' \
  --glob '*.ts' --glob '*.tsx' .

Repository: yamk12nfu/warikapp

Length of output: 50375


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 処理中の画像廃止の竞合経路を特定する。
printf '--- uploads discard implementation ---\n'
sed -n '146,162p' convex/uploads.ts

printf '\n--- discardUpload clients ---\n'
rg -n -C 5 "discardUpload|api\.uploads\.discard|useMutation\(api\.uploads\.discard\)|await .*discard" --glob '*.ts' --glob '*.tsx' .

printf '\n--- expense save/image transition ---\n'
sed -n '150,199p' convex/expenses.ts

printf '\n--- local spec lines 40-52 ---\n'
sed -n '40,52p' .ai/local/knowledge/product-and-data-model.md

# 条件判定に依存する行動を静的チェック: uploads.discard は未設定時削除を実行する。
python3 - <<'PY'
from pathlib import Path
src = Path('convex/uploads.ts').read_text()
if ("export const discard" in src and "upload.usedByExpenseId !== undefined" in src and "ctx.db.delete(\"uploads\", upload._id)" in src):
    print("UPLOADS_DISCARD_CONDITION: unused-undeclared uploads are deleted from both storage and uploads table")
else:
    print("UPLOADS_DISCARD_CONDITION: source structure did not match expected discard path")
PY

Repository: yamk12nfu/warikapp

Length of output: 247


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 処理中の画像廃止の竞合経路を特定する。
printf '%s\n' '--- uploads discard implementation ---'
sed -n '146,162p' convex/uploads.ts

printf '%s\n' ''
printf '%s\n' '--- discardUpload clients ---'
rg -n -C 5 "discardUpload|api\.uploads\.discard|useMutation\(api\.uploads\.discard\)|await .*discard" --glob '*.ts' --glob '*.tsx' .

printf '%s\n' ''
printf '%s\n' '--- expense save/image transition ---'
sed -n '150,199p' convex/expenses.ts

printf '%s\n' ''
printf '%s\n' '--- local spec lines 40-52 ---'
sed -n '40,52p' .ai/local/knowledge/product-and-data-model.md

# uploads.discard の条件判定に依存する廃止を静的にチェックする。
python3 - <<'PY'
from pathlib import Path
src = Path('convex/uploads.ts').read_text()
checks = [
    "export const discard" in src,
    "upload.usedByExpenseId !== undefined" in src,
    "ctx.db.delete(\"uploads\", upload._id)" in src,
]
print("UPLOADS_DISCARD_CONDITION:", checks)
PY

Repository: yamk12nfu/warikapp

Length of output: 7229


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# AI 読み取り画面の撮り直し・保存の呼出し順序を調べる。
printf '%s\n' '--- receipt-client surrounding upload/reparse/save flow ---'
sed -n '103,330p' 'app/(app)/expenses/new/receipt/receipt-client.tsx' | sed -n '1,260p'

printf '%s\n' ''
printf '%s\n' '--- uploads.discard race model in tests ---'
rg -n -C 4 "race|concurrent|discardUpload|discard" convex/uploads.test.ts

# 競合モデル: discard は未設定条件を read-modify-write せず直接削除する。
python3 - <<'PY'
src = "convex/uploads.ts:155-158"
print("CONCURRENCY_MODEL: uploads.discard uses condition-upon-read to decide ctx.storage.delete and ctx.db.delete")
PY

Repository: yamk12nfu/warikapp

Length of output: 8615


未参照破棄の条件に処理中画像の保護を明記してください。

receipts.parse の後に expenses.save が attachUpload まで実行されるため、usedByExpenseId は保存完了まで未設定です。撮り直しの discardUpload() は未設定を「未参照」で削除するため、storage は保持された画像が台帳から消える競合があります。画像保持状態、最低保持時間、または処理中の画像除外条件を仕様と実装に追加してください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.ai/local/knowledge/product-and-data-model.md around lines 46 - 47,
`uploads` の未参照破棄条件に、`receipts.parse` 後から `expenses.save` の `attachUpload`
完了まで処理中の画像を削除対象外とする保護条件を追加してください。画像の処理中状態または最低保持時間を仕様に明記し、`discardUpload()`
がその条件を確認して保持中の storage を削除しないよう実装してください。

「品目価格に上乗せ」は正の差額のみを示唆するため、負の差額(総額値引き)の
減算と配分後合計の一致保証を lib/receipt.ts の実装どおりに記述し直す。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yamk12nfu
yamk12nfu merged commit d243da3 into main Aug 2, 2026
3 of 4 checks passed
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