fix: report real app version from /health and discovery#150
Merged
Conversation
The /health and GET / (discovery) endpoints hardcoded version '0.1.0', so the API reported a stale version regardless of the actual release. - Add src/utils/version.ts with resolveAppVersion() (APP_VERSION env override -> package.json version -> '0.0.0' fallback) and the shared readPackageVersion() helper - Wire resolveAppVersion() into startApiServer for discovery + health - Reuse readPackageVersion() in docs.ts (drops the duplicated reader) - Mirror the same resolution in the offline E2E harness and assert the resolved version instead of the hardcoded literal - Update doc/API.md example responses to the current version Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Sanitize version candidates (APP_VERSION env + package.json): reject empty, over-long (>64), or control-character-bearing values so the version cannot smuggle CR/LF/NUL into logs or headers if reused - Validate package.json version type before use (unknown -> normalized) - Add tests for blank, control-char, and over-long APP_VERSION inputs Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/healthとGET /(discovery) がversion: '0.1.0'をハードコードしており、実リリース版に関わらず古いバージョンを返していた問題を修正。Changes
src/utils/version.tsを新設:resolveAppVersion()(APP_VERSIONenv → package.json version →0.0.0フォールバック)と共有readPackageVersion()startApiServerの discovery + health にresolveAppVersion()を注入docs.tsの重複していた package version 読み取りを共有ヘルパに統合(DOCS_REF 既定挙動は不変)doc/API.mdの例レスポンスを現行バージョンに更新Test
src/test/version.test.tsを追加(package.json 由来 /0.1.0でない /APP_VERSION上書き)🤖 Generated with Claude Code