Skip to content

fix: report real app version from /health and discovery#150

Merged
fuba merged 2 commits into
mainfrom
fix-version-hardcode
May 24, 2026
Merged

fix: report real app version from /health and discovery#150
fuba merged 2 commits into
mainfrom
fix-version-hardcode

Conversation

@fuba

@fuba fuba commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

/healthGET /(discovery) が version: '0.1.0' をハードコードしており、実リリース版に関わらず古いバージョンを返していた問題を修正。

Changes

  • src/utils/version.ts を新設: resolveAppVersion()APP_VERSION env → package.json version → 0.0.0 フォールバック)と共有 readPackageVersion()
  • startApiServer の discovery + health に resolveAppVersion() を注入
  • docs.ts の重複していた package version 読み取りを共有ヘルパに統合(DOCS_REF 既定挙動は不変)
  • offline E2E harness も同じ解決ロジックに合わせ、テストは解決後の値をアサート
  • doc/API.md の例レスポンスを現行バージョンに更新

Test

  • src/test/version.test.ts を追加(package.json 由来 / 0.1.0 でない / APP_VERSION 上書き)
  • 全 152 テスト pass、typecheck / lint / build OK

🤖 Generated with Claude Code

fuba and others added 2 commits May 25, 2026 01:32
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>
@fuba fuba merged commit cd3bd9b into main May 24, 2026
6 checks passed
@fuba fuba deleted the fix-version-hardcode branch May 24, 2026 16:50
@fuba fuba mentioned this pull request May 24, 2026
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