Skip to content

docs(project): アーキテクチャの骨格の方針を要件から隔離する形で明文化する - #40

Merged
reiroop merged 1 commit into
mainfrom
docs/architecture-skeleton
Aug 4, 2026
Merged

docs(project): アーキテクチャの骨格の方針を要件から隔離する形で明文化する#40
reiroop merged 1 commit into
mainfrom
docs/architecture-skeleton

Conversation

@reiroop

@reiroop reiroop commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

概要

アーキテクチャ決定を「要件の流動的な詳細に依存させない不変な骨格」と「seam の裏に隔離して遅延する変化点」に切り分ける方針を openspec/project.md に明文化する。#39 で整理した決定を、以後の設計が従う規約として残す。

変更

  • 「アーキテクチャの骨格 — 変化する要件から隔離する」節を追加する。
    • 骨格が依存してよいのはサービスの定義(会員・会計の管理と外部決済サービスの利用)という最上流の安定した要件だけとし、流動的な詳細は seam の裏に隔離して遅延する、という原則を示す。
    • 不変な性質にだけ依存する骨格(RDB・会員集約・append-only の台帳・決済プロバイダ非依存のドメイン層 + webhook + 冪等 + 突合・監査ログ + 認可)と、隔離して遅延する変化点(決済プロバイダ・DB エンジン・デプロイ運用先・バックエンド構成・機能スライス)を列挙する。
    • seam は無料ではない(軸を取り違えると二重払い)ことと、各不変項に見直す条件を残すことも記す。
  • 技術スタック節の「バックエンドは独立サービスではない」という記述を、「独立サービスとして切り出すかは確定せず、変化点として保留する(独立デプロイへ切り出せる seam を保つ)」に和らげる。

背景

早期に決めるべきアーキテクチャ決定として洗い出した #27#37 は、決済プロバイダ・デプロイ運用先・バックエンド構成を暗黙に固定して個別の論点を立てていた。これらの前提自体はまだ未確定で、確実に今決められることと、要件・運用先が固まってから決めることが混在していた。今回、両者を骨格(先に決める)と変化点(隔離して遅延)に切り分け、決済プロバイダ非依存を横断前提として明示した。

関連

Closes #39

🤖 Generated with Claude Code

Summary by CodeRabbit

  • ドキュメント
    • バックエンド構成を、特定のホスティング形態に固定しない方針へ更新しました。
    • データベース、会員情報、変更履歴、外部イベント処理、監査ログなどの基本要件を明文化しました。
    • 決済サービス、データベース製品、デプロイ方法、機能提供の順序は、今後の検討事項として整理しました。

要件の流動的な詳細に骨格を依存させず、サービスの定義から出る不変な性質に
依存して先に決め、変化点を seam の裏に隔離する方針を「アーキテクチャの骨格」
節として追加する。技術スタック節のバックエンド一体化の記述も、変化点として
保留する形に軟化する。#39 で整理した決定の記録。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@reiroop reiroop added the documentation Improvements or additions to documentation label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

バックエンド構成の固定を解除し、独立サービス化を含む seam を維持する方針に変更しました。不変なアーキテクチャ骨格と、後から決定する技術要素を openspec/project.md に追加しました。

Changes

アーキテクチャ方針

Layer / File(s) Summary
バックエンド構成の固定解除
openspec/project.md
バックエンドを Nitro 内に固定する記述を削除し、独立デプロイ可能な構成を未確定の変化点として扱います。
不変な骨格と変化点の定義
openspec/project.md
RDB、会員集約、append-only 台帳、整数金額、プロバイダ非依存ドメイン層、webhook の冪等取り込み、監査ログ、既定 deny を不変な骨格として定義します。決済プロバイダ、DB エンジン、デプロイ先、バックエンド構成、機能スライス順序を後決定の変化点として整理します。

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning #39 の骨格・変化点の整理は反映されていますが、#27#28#30#32 への注記追加を確認できません。 #27#28#30#32 に、決済プロバイダ非依存、バックエンド分離、運用先未定の前提を注記してください。
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルは、アーキテクチャの骨格を要件から分離して文書化する主変更を明確に示しています。
Out of Scope Changes check ✅ Passed 変更はアーキテクチャの不変な骨格と変化点の整理に限定され、#39 の目的に適合しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/architecture-skeleton

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: 1

🤖 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 `@openspec/project.md`:
- Around line 113-155: openspec/project.md の Issue `#27`–#28、#30、#32
への言及に、それぞれ前提訂正が必要であることを示す注記を追加してください。既存の設計方針や他の Issue への記述は変更せず、対象 Issue
を確認・修正すべき旨だけを明記してください。
🪄 Autofix

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: b7f7d21a-7f0e-4543-9bc0-aff52c3291b8

📥 Commits

Reviewing files that changed from the base of the PR and between 31a9954 and 5d3de00.

📒 Files selected for processing (1)
  • openspec/project.md

Comment thread openspec/project.md
Comment on lines +113 to +155
## アーキテクチャの骨格 — 変化する要件から隔離する

要件のうち流動的な詳細(どの機能から作るか・料金・UI・どの決済手段か)は上流ではなく、隔離すべき
変化点として扱う。骨格が依存してよいのは、サービスの定義(会員・会計の管理と、外部決済サービスの
利用)という最も安定した最上流の要件だけ。これに依存する不変な性質を先に決め、流動的な詳細は
seam の裏に置いて後から差し替えられるようにする。

seam は無料ではない。変化の軸を正しく捉えた seam だけが遅延を安くし、軸を取り違えた seam は現在の
コストと将来の書き直しの二重払いになる(例: 出力 allowlist は決済プロバイダの移植性を与えない —
移行には入力語彙・カーソル・ハンドラの書き換えも要る)。だから各不変項には、それが依存している
仮定と、その仮定が崩れる観測(見直す条件)を残す。

- 不変な性質にだけ依存する骨格(要件の詳細を待たず先に決める):
- データは RDB。会計は関係的で結合・集計が多く、これはドメインの構造から言える。
- 会員集約を同定の単一ソースにする。内部 ID を正とし、決済プロバイダの顧客 ID は属性、traQ ID は
任意として扱い、PII と会計記録を分離する。会員資格は期ごとの第一級レコードとして持つ(「(会員,期)
あたり課金 1 回」の一意強制は業務ルールなので暫定・見直し条件付き)。
- 台帳は append-only の単一ソースとし、金額は整数の最小通貨単位で持つ。状態は拡張可能な符号付き
エントリの開いた集合として持ち、後から状態を加算できる(具体の状態集合はプロバイダとフローが
固まってから)。
- 決済プロバイダ非依存のドメイン層を設け、入金は外部イベントを webhook で受ける。取り込みは外部
イベント ID で重複排除する inbox 境界を持ち(冪等)、内部台帳エントリと外部イベントが双方向に
辿れて乖離を検出できる(突合可能性)。
- 監査ログを append-only で持ち、機微な金銭の変更・閲覧は認可の裏に置き既定 deny(fail-closed)。
具体のロール・ポリシーは暫定。
- 隔離して遅延する変化点(要件・運用先が決める。seam は今引き、確定は後):
- どの決済プロバイダを使うか。非依存層の実装として後で差す。状態はドメイン語彙で定義し、
プロバイダ→ドメインの写像を seam にする(第 2 のプロバイダの生涯周期を一度写像するまで「非依存」
は未検証)。
- どの DB エンジンを使うか。RDB は確定。実データが無い間は移行コストが低いが、スキーマ定義の
書き直しは要る。骨格をエンジン固有機能に依存させない。ドメインモデル(#27)の本実装前に確定する。
- デプロイ・運用先。正しさは共有状態を DB に寄せて吸収するが、常駐サーバーか否かという実行形態は
非同期実行基盤(#30)の成立を左右する。
- バックエンドの構成(独立デプロイするか)。言語(TypeScript)はほぼ確定で残す価値が高く、開けて
おくのはプロセス構成の seam。RPC 契約から OpenAPI を出力できるため他言語へ移す余地も残る(その
出力を維持される成果物として扱うことが条件)。
- 機能スライスの順序。ただしこれは会員のカーディナリティや状態集合など骨格の暫定部分を確定する
情報源でもある。

各項目の詳細設計は #27–#37 で詰める。ここに置くのは「不変な性質に依存し変化点を隔離する」方針と、
確定した方向性まで(プロバイダを裏に隠す・出力 allowlist などの既述の横断方針は繰り返さない)。
これは「意思決定の指針」を骨格設計に当てはめたもの。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Issue `#27`, `#28`, `#30`, `#32` に前提訂正の注記が追加されているか確認する。
gh issue view 27 --comments 2>/dev/null | tail -n 30
gh issue view 28 --comments 2>/dev/null | tail -n 30
gh issue view 30 --comments 2>/dev/null | tail -n 30
gh issue view 32 --comments 2>/dev/null | tail -n 30

Repository: traPtitech/Checkin

Length of output: 156


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 対象リポジトリを特定し、関連ファイル/Diff/Issue refs を調べる。
pwd
git remote -v || true
git status --short
git diff --stat HEAD~1..HEAD 2>/dev/null || git diff --stat origin/main..HEAD 2>/dev/null || true
rg -n "#(27|28|30|32)|前提訂正|訂正|受け入れ条件|accept|requirement|requirement" . --glob '!node_modules' 2>/dev/null | head -n 200

Repository: traPtitech/Checkin

Length of output: 729


🌐 Web query:

GitHub REST API issue comments list issue_url comments_url

💡 Result:

In the GitHub REST API, there is a clear distinction between the base URL for listing issue comments and the comments_url field returned within an issue resource [1][2][3]. 1. REST API Endpoints for Listing Issue Comments: To programmatically retrieve comments for an issue, you use specific endpoints based on the scope: - For a specific issue: Use GET /repos/{owner}/{repo}/issues/{issue_number}/comments [1][4]. - For an entire repository: Use GET /repos/{owner}/{repo}/issues/comments [1][4]. 2. The comments_url Field: When you retrieve an issue resource (e.g., via GET /repos/{owner}/{repo}/issues/{issue_number}), the response object includes a comments_url field [3]. This field is a pre-constructed, absolute URL provided by GitHub that points directly to the API endpoint for listing comments specifically for that issue [3]. This allows you to navigate to the comments endpoint without needing to manually construct the URL string from the owner, repository name, and issue number [3]. Note that in the GitHub REST API, pull requests are treated as issues [1][5]. Therefore, the same issue comment endpoints are used to manage comments on pull requests [5]. Top results: [1][2][3][5]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import os, subprocess, json
owner = "traPtitech"
repo = "Checkin"
for n in [27,28,30,32]:
    raw = subprocess.check_output(["gh","api",f"repos/{owner}/{repo}/issues/{n}"], text=True, stderr=subprocess.DEVNULL)
    data = json.loads(raw)
    print(f"#{n} state={data.get('state')} title={data.get('title')} body_len={len(data.get('body',''))}")
PY

echo "--- comments ---"
python3 - <<'PY'
import subprocess, json
owner = "traPtitech"
repo = "Checkin"
for n in [27,28,30,32]:
    raw = subprocess.check_output(["gh","api",f"repos/{owner}/{repo}/issues/{n}/comments"], text=True, stderr=subprocess.DEVNULL)
    comments = json.loads(raw)
    print(f"#{n} comment_count={len(comments)}")
    for c in comments:
        print("  ----")
        print(c.get('body','')[:400].replace('\n','\\n'))
        print("  author=", c.get('user',{}).get('login'))
PY

echo "--- accepts/requirement text in open specs ---"
rg -n "受け入れ条件|requirement|requirement|accept|acceptance|前提訂正|訂正|fix|前提" . --glob '!node_modules' 2>/dev/null

Repository: traPtitech/Checkin

Length of output: 1769


Issue 側の前提訂正注記を追加してください。

openspec/project.md には #27#28#30#32 への言及はありますが、各 Issue に前提訂正が必要なことを伝える注記がありません。対象 Issue に前提訂正の注記を追加してください。

🤖 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 `@openspec/project.md` around lines 113 - 155, openspec/project.md の Issue
`#27`–#28、#30、#32 への言及に、それぞれ前提訂正が必要であることを示す注記を追加してください。既存の設計方針や他の Issue
への記述は変更せず、対象 Issue を確認・修正すべき旨だけを明記してください。

@reiroop
reiroop merged commit 628a3ce into main Aug 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

アーキテクチャ決定を「不変な骨格」と「隔離する変化点」に整理し、骨格を先に固める

1 participant