Skip to content

Commit 4f7a2c3

Browse files
authored
パスワードリセット機能をGo版に移行 (#1312)
2 parents 9fd28ca + fcf1e17 commit 4f7a2c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+9137
-140
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
/.claude
44
/.env.op
55
/.pnpm-store
6-
/.vscode
76
/compose-up.sh
87
/docker-compose.override.yml
9-
/docs

difit/Dockerfile.dev

Lines changed: 0 additions & 17 deletions
This file was deleted.

docker-compose.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,9 @@ services:
6464
# https://docs.browserless.io/docs/docker.html#connection-timeout
6565
CONNECTION_TIMEOUT: 600000
6666

67-
difit:
68-
build:
69-
context: ./difit
70-
dockerfile: ./Dockerfile.dev
71-
volumes:
72-
- .:/workspace
73-
- difit-pnpm-store:/workspace/.pnpm-store
74-
- difit-node-modules:/workspace/node_modules
75-
ports:
76-
- "4106:4966"
77-
stdin_open: true
78-
tty: true
79-
working_dir: /workspace
80-
environment:
81-
- GITHUB_TOKEN=${GITHUB_TOKEN:-}
82-
8367
volumes:
8468
op-config:
8569
app_gems_data:
8670
go-build-cache:
8771
go-mod-cache:
8872
postgresql16_data:
89-
difit-pnpm-store:
90-
difit-node-modules:

docs/.keep

Whitespace-only changes.
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# tparse 導入 仕様書
2+
3+
## 概要
4+
5+
Go 版のテスト実行結果の可読性を向上させるため、[tparse](https://github.com/mfridman/tparse) を導入します。
6+
7+
tparse は `go test` の JSON 出力を解析・要約するコマンドラインツールです。テスト失敗とパニックを強調表示し、パッケージレベルのサマリーテーブルを出力することで、テスト結果を素早く把握できるようになります。
8+
9+
**目的**:
10+
11+
- テスト結果の可読性を向上させ、失敗したテストを素早く特定できるようにする
12+
- パッケージレベルのサマリーでテスト全体の状況を把握しやすくする
13+
- CI 環境でも見やすいテスト結果を出力する
14+
15+
**背景**:
16+
17+
- 現在の `go test -v` 出力は冗長で、テスト数が増えると失敗したテストを見つけにくい
18+
- 特に複数パッケージにまたがるテストでは、どのパッケージが失敗したかの把握に時間がかかる
19+
20+
## 要件
21+
22+
### 機能要件
23+
24+
- `make test` コマンドでテストを実行した際、tparse を経由して結果を整形表示する
25+
- `make test-pkg``make test-run``make test-verbose` コマンドでも同様に tparse を使用する
26+
- 失敗したテストとパニックは強調表示される
27+
- パッケージレベルのサマリーテーブルが表示される
28+
- CI 環境でも正常に動作する
29+
30+
### 非機能要件
31+
32+
- tparse は `tools.go` で管理し、バージョンを固定する
33+
- 既存の Makefile タスクとの互換性を維持する(コマンド名は変更しない)
34+
- `set -o pipefail` を使用してパイプラインのエラーを適切に検出する
35+
36+
## 設計
37+
38+
### 技術スタック
39+
40+
- **tparse v0.18.0**: Go テスト出力解析ツール
41+
42+
### 使用方法
43+
44+
tparse は `go test -json` の出力をパイプで受け取って使用します:
45+
46+
```sh
47+
# 基本的な使い方
48+
set -o pipefail && go test -json ./... | tparse
49+
50+
# 失敗テストのみ表示(デフォルト)
51+
set -o pipefail && go test -json ./... | tparse
52+
53+
# 合格テストも表示
54+
set -o pipefail && go test -json ./... | tparse -all
55+
```
56+
57+
### Makefile の変更
58+
59+
既存の test 関連タスクを tparse を使用するように変更します。
60+
61+
**変更前**:
62+
63+
```makefile
64+
test: db-setup-test
65+
go test -v -race ./...
66+
```
67+
68+
**変更後**:
69+
70+
```makefile
71+
test: db-setup-test
72+
@which tparse > /dev/null || (echo "Installing tparse from go.mod..." && go install github.com/mfridman/tparse@latest)
73+
set -o pipefail && go test -json -race ./... | tparse
74+
```
75+
76+
### tools.go への追加
77+
78+
```go
79+
//go:build tools
80+
81+
package tools
82+
83+
import (
84+
_ "github.com/a-h/templ/cmd/templ"
85+
_ "github.com/mfridman/tparse"
86+
_ "golang.org/x/tools/cmd/goimports"
87+
)
88+
```
89+
90+
## タスクリスト
91+
92+
### フェーズ 1: tparse の導入
93+
94+
- [x] **1-1**: tparse を tools.go に追加し、go.mod に依存関係を追加する
95+
96+
- tools.go に `_ "github.com/mfridman/tparse"` を追加
97+
- `go get github.com/mfridman/tparse@v0.18.0` を実行
98+
- `go mod tidy` で依存関係を整理
99+
- **想定ファイル数**: 約 2 ファイル(実装 2 + テスト 0)
100+
- **想定行数**: 約 5 行(実装 5 行 + テスト 0 行)
101+
102+
- [x] **1-2**: Makefile の test 関連タスクを tparse を使用するように変更する
103+
104+
- `make test` を tparse 経由に変更
105+
- `make test-pkg` を tparse 経由に変更
106+
- `make test-run` を tparse 経由に変更
107+
- `make test-verbose` を tparse 経由に変更(-all オプション付き)
108+
- CI 環境用の分岐も tparse を使用するように変更
109+
- **想定ファイル数**: 約 1 ファイル(実装 1 + テスト 0)
110+
- **想定行数**: 約 30 行(実装 30 行 + テスト 0 行)
111+
112+
- [x] **1-3**: CLAUDE.md のドキュメントを更新する
113+
- テスト実行コマンドの説明に tparse について追記
114+
- **想定ファイル数**: 約 1 ファイル(実装 1 + テスト 0)
115+
- **想定行数**: 約 10 行(実装 10 行 + テスト 0 行)
116+
117+
### 実装しない機能(スコープ外)
118+
119+
以下の機能は今回の実装では**実装しません**
120+
121+
- **カバレッジレポートの統合**: tparse はカバレッジ表示もサポートしているが、今回はテスト結果の整形のみに焦点を当てる
122+
- **GitHub Actions との統合**: tparse の GitHub Actions 向け機能(`-format markdown` など)は将来の検討事項とする
123+
124+
## 参考資料
125+
126+
- [tparse GitHub リポジトリ](https://github.com/mfridman/tparse)
127+
- [tparse リリースノート v0.18.0](https://github.com/mfridman/tparse/releases/tag/v0.18.0)

0 commit comments

Comments
 (0)