Skip to content

⬆️ labstack/echo/v5#1009

Merged
H1rono merged 5 commits intov2from
echo-v5
Feb 23, 2026
Merged

⬆️ labstack/echo/v5#1009
H1rono merged 5 commits intov2from
echo-v5

Conversation

@H1rono
Copy link
Copy Markdown
Member

@H1rono H1rono commented Feb 23, 2026

Summary by CodeRabbit

  • Chores

    • Goランタイムを1.24.11→1.25.0にアップグレード
    • Webフレームワークをv4→v5へ移行し、エラーハンドリングとミドルウェア周りを更新
    • 不要・古い間接依存を整理し、依存関係の整合性を向上
  • Bug Fixes

    • ルーティング・テストのパラメータ処理を新仕様に合わせて修正し、テスト安定性と動作の一貫性を改善

- `HTTPError.SetInternal` to `HTTPError.Wrap.(*HTTPError)`
- `HTTPError.WithInternal` to `httpError.Wrap.(*HTTPError)`
- Remove `e.Debug`
- Fix signature of `HTTPErrorHandler`, `WebhookApplicationsEventHandler`
- Use `echo.DefaultHTTPErrorHandler` at once
- Use `echo.UnwrapResponse` in `AccessLoggingMiddleware`
- `SetParamNames`/`SetParamValues` to `SetPathValues`
@H1rono
Copy link
Copy Markdown
Member Author

H1rono commented Feb 23, 2026

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 40.50633% with 47 lines in your changes missing coverage. Please review.
✅ Project coverage is 7.26%. Comparing base (a4dc093) to head (510e433).
⚠️ Report is 6 commits behind head on v2.

Files with missing lines Patch % Lines
internal/router/middleware.go 0.00% 21 Missing ⚠️
internal/router/error.go 47.61% 5 Missing and 6 partials ⚠️
internal/router/file.go 58.33% 5 Missing ⚠️
internal/webhook/webhook.go 0.00% 3 Missing ⚠️
internal/router/auth.go 0.00% 2 Missing ⚠️
internal/router/router.go 0.00% 2 Missing ⚠️
internal/router/application.go 83.33% 1 Missing ⚠️
internal/router/wrapsession/wrapper.go 0.00% 1 Missing ⚠️
internal/router/wrapsession/wrapsession.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##              v2   #1009   +/-   ##
=====================================
  Coverage   7.26%   7.26%           
=====================================
  Files        118     118           
  Lines      16913   16931   +18     
=====================================
+ Hits        1228    1230    +2     
- Misses     15603   15616   +13     
- Partials      82      85    +3     

☔ View full report in Codecov by Sentry.
📢 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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 23, 2026

📝 Walkthrough

Walkthrough

Echo フレームワークを v4 → v5 に移行し、Go を 1.24.11 → 1.25.0 に更新。複数のハンドラーとミドルウェアで Context パラメータを値型からポインタ型へ変更し、テストのパスパラメータ注入とエラーハンドリングを v5 に合わせて修正した。

Changes

Cohort / File(s) Summary
依存関係管理
go.mod
Go を 1.25.0 に更新。Echo 関連を v4 → v5 に置換(github.com/labstack/echo/v5 と v5 の echo-contrib/session へ)。いくつかの間接依存の削除・バージョン調整を実施。
ハンドラー署名のポインタ化
internal/router/account_manager.go, internal/router/application.go, internal/router/auth.go, internal/router/file.go, internal/router/tag.go, internal/router/user.go
多くのハンドラーで引数型を echo.Context*echo.Context に変更。関連インポートを v5 に更新。
セッションラッパー更新
internal/router/wrapsession/wrapsession.go, internal/router/wrapsession/wrapper.go
WithSession と内部 drop メソッドのコンテキスト引数をポインタ化し、echo-contrib/session の v5 API に合わせて呼び出しを更新。
エラーハンドリングの調整
internal/router/error.go, internal/router/file.go
v5 のエラーラッパー(.Wrap)を採用するようエラー処理を変更。file 内部のフィルタ関数が *echo.HTTPErrorerror に変更され、呼出側で適切にラップするよう修正。
ミドルウェアとルーター設定
internal/router/middleware.go, internal/router/router.go
ミドルウェア内クロージャのコンテキスト引数をポインタ化。AccessLoggingMiddleware が echo.UnwrapResponse を用いるように更新。HTTP エラー処理の初期化とハンドラシグネチャを v5 に合わせて変更。
テストのパラメータ注入更新
internal/router/account_manager_test.go, internal/router/application_test.go, internal/router/file_test.go, internal/router/tag_test.go, internal/router/user_test.go
テストでのルートパラメータ注入を SetParamNames/SetParamValuesSetPathValues([]echo.PathValue{...}) に置換し、テストパス表記を一部修正。Echo v5 へインポートパスを更新。
Webhook / Traq 更新
internal/webhook/webhook.go, internal/traq/traq.go
webhook ハンドラーのコンテキストをポインタ化し、エラー引数の早期リターンを追加。traq は import を v5 に更新。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルはEcho v5へのアップグレードという主要な変更を明確に示しており、変更セットの中心となる内容を正確に反映している。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch echo-v5

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/router/middleware.go (1)

36-82: ⚠️ Potential issue | 🟡 Minor

AccessLoggingMiddleware の UnwrapResponse 失敗時にアクセスログが出力されない。

Line 47-52 で echo.UnwrapResponse が失敗した場合、uErr がそのまま返されますが、以下の問題があります:

  1. Line 42 で既にエラーハンドラーがレスポンスを書き込んでいる可能性があるため、uErr を返しても Echo がさらにレスポンスを書こうとする可能性がある
  2. アクセスログが完全にスキップされてしまう

UnwrapResponse が失敗するケースは通常運用では稀ですが、失敗時にもアクセスログ(エラー情報付き)を出力するか、最低限 return nil で安全にフォールバックする方が堅牢です。

🛡️ 提案: UnwrapResponse 失敗時もログ出力する
 		rw, uErr := echo.UnwrapResponse(c.Response())
 		if uErr != nil {
 			logger := logging.GetLogger(req.Context())
 			logger.Error("failed to unwrap response", zap.Error(uErr))
-			return uErr
+			return nil
 		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/router/middleware.go` around lines 36 - 82, AccessLoggingMiddleware
currently returns uErr when echo.UnwrapResponse fails which can cause Echo to
attempt another response write and skips access logging; change the unwrap error
handling in AccessLoggingMiddleware so that instead of returning uErr you log
the unwrap error (include zap.Error(uErr)) and fall back to using c.Response()
(or default values) to build and emit the access log (include the original
handler error `err` if present), then return nil; update the block that calls
echo.UnwrapResponse to emit an error-level log entry for the unwrap failure and
continue to the same log-emission switch (server/client/redirect/success) so
access logs are always produced.
🧹 Nitpick comments (3)
go.mod (2)

3-3: go 1.25.0 への変更はコンテナ環境の GOMAXPROCS 挙動に影響します。

新しい GOMAXPROCS の挙動(Linux で cgroup CPU 割り当てを考慮)は go.modgo 1.25 以上が記載されている場合にのみ有効になります。 Kubernetes 等のコンテナ環境では CPU limit に基づいて GOMAXPROCS が自動設定されるため、パフォーマンス特性が変化する可能性があります。意図した変更であることを確認してください。

また、Go 1.25.6 は 2026-01-15 にリリースされており、1.25.1 以降のパッチには net/http 等へのセキュリティ修正が含まれています。 go ディレクティブは最小要件のみを定義するため直接の影響はありませんが、CI/CD やコンテナイメージで使用する実際の Go ツールチェーンが最新パッチ(1.25.6)であることを確認してください。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` at line 3, go.mod was changed to "go 1.25.0", which alters GOMAXPROCS
behavior in containerized environments and may have security/patch implications;
decide whether this is intended and either (A) keep it but update the go
directive to a patched point release like "go 1.25.6" and ensure your
CI/container toolchain images use Go 1.25.6, or (B) revert to the previous major
version (e.g., "go 1.24") if you want to preserve prior GOMAXPROCS semantics;
update the go directive in go.mod accordingly and adjust CI/build Dockerfiles to
match the chosen Go toolchain so runtime/patch behavior is consistent.

15-16: Echo v5 は現時点で本番環境への適用が推奨されていません。

Echo 公式リポジトリは「本番環境での使用は 2026-03-31 以降まで待つことを推奨する」と案内しています。 本 PR マージ時点(2026-02-23)はこの期間内であるため、本番デプロイのタイミングを考慮してください。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` around lines 15 - 16, The go.mod currently depends on
github.com/labstack/echo/v5 and github.com/labstack/echo-contrib/v5 which Echo
maintainers advise against using in production until 2026-03-31; revert these to
the stable v4 line by replacing the two v5 module entries with the matching v4
modules (e.g., github.com/labstack/echo/v4 and
github.com/labstack/echo-contrib/v4), run go get to update the lock, and run the
test suite/build to fix any API differences (search for usages of echo imports
in the codebase to adjust import paths/types if needed).
internal/router/router.go (1)

27-27: Go命名規則: defaultHttpErrorHandlerdefaultHTTPErrorHandler

Goの命名規則では、HTTPのような頭字語は全て大文字にするのが慣例です(例: HTTPError, HTTPHandler)。HttpではなくHTTPを使用してください。

♻️ 修正案
-var defaultHttpErrorHandler = echo.DefaultHTTPErrorHandler(false)
+var defaultHTTPErrorHandler = echo.DefaultHTTPErrorHandler(false)

Line 36も合わせて変更:

-		defaultHttpErrorHandler(c, he)
+		defaultHTTPErrorHandler(c, he)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/router/router.go` at line 27, Rename the variable
defaultHttpErrorHandler to defaultHTTPErrorHandler to follow Go naming
conventions for acronyms; update its declaration (var defaultHTTPErrorHandler =
echo.DefaultHTTPErrorHandler(false)) and replace all references/usages (e.g.,
the occurrence mentioned around line 36) to the new identifier so the code
compiles and consistently uses defaultHTTPErrorHandler while keeping
echo.DefaultHTTPErrorHandler unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@internal/router/middleware.go`:
- Around line 36-82: AccessLoggingMiddleware currently returns uErr when
echo.UnwrapResponse fails which can cause Echo to attempt another response write
and skips access logging; change the unwrap error handling in
AccessLoggingMiddleware so that instead of returning uErr you log the unwrap
error (include zap.Error(uErr)) and fall back to using c.Response() (or default
values) to build and emit the access log (include the original handler error
`err` if present), then return nil; update the block that calls
echo.UnwrapResponse to emit an error-level log entry for the unwrap failure and
continue to the same log-emission switch (server/client/redirect/success) so
access logs are always produced.

---

Nitpick comments:
In `@go.mod`:
- Line 3: go.mod was changed to "go 1.25.0", which alters GOMAXPROCS behavior in
containerized environments and may have security/patch implications; decide
whether this is intended and either (A) keep it but update the go directive to a
patched point release like "go 1.25.6" and ensure your CI/container toolchain
images use Go 1.25.6, or (B) revert to the previous major version (e.g., "go
1.24") if you want to preserve prior GOMAXPROCS semantics; update the go
directive in go.mod accordingly and adjust CI/build Dockerfiles to match the
chosen Go toolchain so runtime/patch behavior is consistent.
- Around line 15-16: The go.mod currently depends on github.com/labstack/echo/v5
and github.com/labstack/echo-contrib/v5 which Echo maintainers advise against
using in production until 2026-03-31; revert these to the stable v4 line by
replacing the two v5 module entries with the matching v4 modules (e.g.,
github.com/labstack/echo/v4 and github.com/labstack/echo-contrib/v4), run go get
to update the lock, and run the test suite/build to fix any API differences
(search for usages of echo imports in the codebase to adjust import paths/types
if needed).

In `@internal/router/router.go`:
- Line 27: Rename the variable defaultHttpErrorHandler to
defaultHTTPErrorHandler to follow Go naming conventions for acronyms; update its
declaration (var defaultHTTPErrorHandler = echo.DefaultHTTPErrorHandler(false))
and replace all references/usages (e.g., the occurrence mentioned around line
36) to the new identifier so the code compiles and consistently uses
defaultHTTPErrorHandler while keeping echo.DefaultHTTPErrorHandler unchanged.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a4dc093 and 3adc0a5.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (19)
  • go.mod
  • internal/router/account_manager.go
  • internal/router/account_manager_test.go
  • internal/router/application.go
  • internal/router/application_test.go
  • internal/router/auth.go
  • internal/router/error.go
  • internal/router/file.go
  • internal/router/file_test.go
  • internal/router/middleware.go
  • internal/router/router.go
  • internal/router/tag.go
  • internal/router/tag_test.go
  • internal/router/user.go
  • internal/router/user_test.go
  • internal/router/wrapsession/wrapper.go
  • internal/router/wrapsession/wrapsession.go
  • internal/traq/traq.go
  • internal/webhook/webhook.go

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
internal/router/middleware.go (2)

47-53: UnwrapResponse 失敗時にアクセスログが完全に欠落します。

UnwrapResponse がエラーを返した場合、そのリクエストのアクセスログ(メソッド、パス、レイテンシ等)が一切出力されません。コメントの意図(アクセスログの失敗はリクエストの失敗ではない)は理解できますが、rw が取得できなくてもリクエスト情報(req.Method, req.URL 等)だけは出力するとデバッグに役立ちます。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/router/middleware.go` around lines 47 - 53, UnwrapResponse failure
currently aborts writing the access log; instead, when
echo.UnwrapResponse(c.Response()) returns uErr, still emit the access log using
available request fields (e.g., req.Method, req.URL.Path, req.RemoteAddr,
req.Header, start/stop times) by obtaining logger :=
logging.GetLogger(req.Context()) and calling the same access-log path used for
the success case with sensible defaults for response-specific fields (status,
size, etc. — e.g., status=0 or "-" and size=0) so that requests where rw is
unavailable still produce method/path/latency logs for debugging while still
logging the unwrap error via logger.Error.

40-53: defaultHTTPErrorHandler の直接呼び出しと e.HTTPErrorHandler の関係を確認してください。

Line 42 で defaultHTTPErrorHandler を直接呼び出していますが、router.goe.HTTPErrorHandler には追加のデバッグログ(logger.Debug("handling error", ...))が含まれています。AccessLoggingMiddleware は常に nil を返す(Line 81)ため、e.HTTPErrorHandler が呼ばれることは実質的にありません。

現在の設計では、AccessLoggingMiddleware 自身がエラーログを出力するため問題ありませんが、e.HTTPErrorHandler のカスタムロジック(将来的な追加含む)が bypass される点は認識しておくと良いでしょう。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/router/middleware.go` around lines 40 - 53, AccessLoggingMiddleware
currently calls defaultHTTPErrorHandler directly on error
(defaultHTTPErrorHandler and AccessLoggingMiddleware), which bypasses the echo
instance's configurable e.HTTPErrorHandler and its extra debug logic; change the
error path so it delegates to the echo instance's HTTPErrorHandler when present
(use e.HTTPErrorHandler(c, err) or the equivalent handler stored on the Echo
instance) and fall back to defaultHTTPErrorHandler only if e.HTTPErrorHandler is
nil, ensuring any custom/debug logic in e.HTTPErrorHandler is executed while
preserving the existing access-log behavior.
internal/router/router.go (1)

9-11: Echo v5 安定期間前のアップグレードについて。

Echo v5 を本番環境で使用する場合は 2026-03-31 以降にアップグレードすることが推奨されており、それまでは重要な問題に対してセマンティックバージョニングに違反する破壊的 API 変更が行われる可能性があります。

現在(2026-02-23)はこの安定期間の前です。本番デプロイのタイミングやバージョン固定(v5.0.4)を考慮し、2026-03-31 以降に再度 go.mod のバージョンを確認することをお勧めします。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/router/router.go` around lines 9 - 11, この差分は Echo v5(import:
"github.com/labstack/echo/v5" と
"github.com/labstack/echo-contrib/v5/session")を取り込んでいますが、Echo v5
の安定期間前で本番利用にリスクがあるため、go.mod でバージョンを明示的に固定(例: v5.0.4)して依存をピン留めし、router.go の該当
import 周辺に「一時的ピン留め/2026-03-31 以降に再確認」旨の TODO コメントを追加しておいてください; 本番デプロイ前に
2026-03-31 を越えたら go.mod のバージョンを見直し、問題なければアップデートを解除またはバージョンを上げる手順を実行してください。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@internal/router/middleware.go`:
- Around line 47-53: UnwrapResponse failure currently aborts writing the access
log; instead, when echo.UnwrapResponse(c.Response()) returns uErr, still emit
the access log using available request fields (e.g., req.Method, req.URL.Path,
req.RemoteAddr, req.Header, start/stop times) by obtaining logger :=
logging.GetLogger(req.Context()) and calling the same access-log path used for
the success case with sensible defaults for response-specific fields (status,
size, etc. — e.g., status=0 or "-" and size=0) so that requests where rw is
unavailable still produce method/path/latency logs for debugging while still
logging the unwrap error via logger.Error.
- Around line 40-53: AccessLoggingMiddleware currently calls
defaultHTTPErrorHandler directly on error (defaultHTTPErrorHandler and
AccessLoggingMiddleware), which bypasses the echo instance's configurable
e.HTTPErrorHandler and its extra debug logic; change the error path so it
delegates to the echo instance's HTTPErrorHandler when present (use
e.HTTPErrorHandler(c, err) or the equivalent handler stored on the Echo
instance) and fall back to defaultHTTPErrorHandler only if e.HTTPErrorHandler is
nil, ensuring any custom/debug logic in e.HTTPErrorHandler is executed while
preserving the existing access-log behavior.

In `@internal/router/router.go`:
- Around line 9-11: この差分は Echo v5(import: "github.com/labstack/echo/v5" と
"github.com/labstack/echo-contrib/v5/session")を取り込んでいますが、Echo v5
の安定期間前で本番利用にリスクがあるため、go.mod でバージョンを明示的に固定(例: v5.0.4)して依存をピン留めし、router.go の該当
import 周辺に「一時的ピン留め/2026-03-31 以降に再確認」旨の TODO コメントを追加しておいてください; 本番デプロイ前に
2026-03-31 を越えたら go.mod のバージョンを見直し、問題なければアップデートを解除またはバージョンを上げる手順を実行してください。

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3adc0a5 and 97be3fa.

📒 Files selected for processing (2)
  • internal/router/middleware.go
  • internal/router/router.go

@H1rono H1rono merged commit 1208d26 into v2 Feb 23, 2026
6 of 7 checks passed
@H1rono H1rono deleted the echo-v5 branch February 23, 2026 15:41
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@internal/router/router.go`:
- Around line 32-37: HTTPErrorHandler currently calls logging.GetLogger which
can panic when no logger is in context; change e.HTTPErrorHandler to first
unwrap the response via echo.UnwrapResponse and return immediately if
resp.Committed, then obtain a logger in a nil-safe way (do not call
logging.GetLogger directly) — either check for logger presence (e.g. a
logging.HasLogger/FromContext helper) or fall back to a non-panicking default
logger before calling logger.Debug; keep HTTPErrorHandlerInner and
defaultHTTPErrorHandler usage but remove or guard the debug log since
AccessLoggingMiddleware normally prevents this path.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97be3fa and 510e433.

📒 Files selected for processing (2)
  • internal/router/middleware.go
  • internal/router/router.go

Comment on lines +32 to 37
e.HTTPErrorHandler = func(c *echo.Context, err error) {
logger := logging.GetLogger(c.Request().Context())
logger.Debug("handling error", zap.Error(err))
he := HTTPErrorHandlerInner(err)
c.Echo().DefaultHTTPErrorHandler(he, c)
defaultHTTPErrorHandler(c, he)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

logging.GetLogger が panic する潜在リスク

Echo v5 の公式ドキュメントでは、カスタムエラーハンドラ内でまず echo.UnwrapResponseresp.Committed を確認する実装パターンが推奨されています。

それとは別に、Line 33 の logging.GetLogger は context にロガーが存在しない場合に panic します(internal/logging/context.go の実装による)。

e.HTTPErrorHandler が呼ばれるのはミドルウェアチェーンがエラーを返したときですが、AccessLoggingMiddleware はハンドラからのエラーを全て吸収して nil を返します。そのため、このハンドラが実際に呼ばれるのは middleware.RequestID()setLoggerMiddleware でエラーが発生した場合のみです。setLoggerMiddleware が実行される前(RequestID のエラー時)は context にロガーが存在せず、panic が発生します。

🛡️ 防御的実装への変更案
 e.HTTPErrorHandler = func(c *echo.Context, err error) {
-    logger := logging.GetLogger(c.Request().Context())
+    logger, logErr := logging.GetLoggerMaybe(c.Request().Context())
+    if logErr != nil {
+        logger = zap.NewNop()
+    }
     logger.Debug("handling error", zap.Error(err))

また、AccessLoggingMiddleware がエラーを全て吸収するため、Line 34 の logger.Debug("handling error", ...) は通常のリクエストでは実質的に到達しないコードになっています。デバッグログの必要性についても確認を推奨します。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/router/router.go` around lines 32 - 37, HTTPErrorHandler currently
calls logging.GetLogger which can panic when no logger is in context; change
e.HTTPErrorHandler to first unwrap the response via echo.UnwrapResponse and
return immediately if resp.Committed, then obtain a logger in a nil-safe way (do
not call logging.GetLogger directly) — either check for logger presence (e.g. a
logging.HasLogger/FromContext helper) or fall back to a non-panicking default
logger before calling logger.Debug; keep HTTPErrorHandlerInner and
defaultHTTPErrorHandler usage but remove or guard the debug log since
AccessLoggingMiddleware normally prevents this path.

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