Skip to content

health: 응답 시각을 timestamp 로도 내보낸다 - #43

Merged
mikim merged 1 commit into
mainfrom
claude/health-contract
Sep 9, 2026
Merged

mikim merged 1 commit into
mainfrom
claude/health-contract

Conversation

@mikim

@mikim mikim commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

무엇이 바뀌었나

/api/health 가 생태계 health 규약(HEALTH_CONTRACT.md v1)이 요구하는 timestamp 를 빠뜨리고 있었다. 값 자체는 이미 ts 로 존재했으므로 새 신호를 만들 필요는 없었고, 이름만 하나 더 붙였다.

app/api/health/route.ts 에서 instant 를 const now 로 한 번만 계산해 ts 와 timestamp 에 같은 값을 넣는다. new Date() 를 두 번 부르면 tick 을 사이에 두고 갈라져 같은 응답이 두 개의 생성 시각을 주장할 수 있다.

payload (before → after):

{"status":"ok","service":"alpha","db":"ok","seo_pages":1966,"ts":"…","worst_status":"not_evaluated"}
{"status":"ok","service":"alpha","db":"ok","seo_pages":1966,"ts":"…","timestamp":"…","worst_status":"not_evaluated"}

status 와 service 는 이미 규약을 만족하고 있었다.

검증

  • tsc --noEmit — exit 0
  • next build — exit 0, 전 라우트 빌드 성공
  • node --import tsx --test tests/*.test.ts — 28 pass / 0 fail

일부러 건드리지 않은 것

  • ts 유지. 기존 소비자가 읽는 이름이라 지우지 않았다. 순수 추가이므로 기존 필드는 하나도 삭제·개명·재배치하지 않았다.
  • status: "fail" 유지. 규약 enum 은 ok|degraded|down 이라 "fail" 은 off-enum 이지만, 문서화된 소비자 두 곳(app/developers/page.tsx, app/llms.txt/route.ts:42)이 이 payload 를 그대로 보여준다. 이번 rollout 은 순수 추가로 두고 enum 정규화는 별도로 다룬다.
  • ?strict=1 의 503 유지. scripts/deploy.sh 의 DEPLOY_STRICT_URL 게이트가 HTTP 코드로 알람하므로 그대로 둔다.

배포 영향

payload 에 키 하나가 추가될 뿐이고 HTTP status code 동작은 변화 없음. 기존 소비자는 영향받지 않는다.

🤖 Generated with Claude Code

/api/health 가 생태계 health 규약이 요구하는 timestamp 를 빠뜨리고 있었다.
값 자체는 이미 ts 로 있었으므로 새로 만들 것은 없고, 이름만 하나 더 붙인다.

한 번 계산한 instant 를 now 로 올려 ts 와 timestamp 에 같이 넣는다.
new Date() 를 두 번 부르면 tick 을 사이에 두고 갈라져 같은 응답이
두 개의 생성 시각을 주장할 수 있다.

ts 는 그대로 둔다 — 기존 소비자가 읽는 이름이다. 순수 추가이므로
기존 필드는 하나도 지우거나 옮기지 않았고, status 값("fail")과
?strict=1 의 503 동작도 건드리지 않았다.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mikim
mikim merged commit faa4608 into main Sep 9, 2026
1 check passed
@mikim
mikim deleted the claude/health-contract branch September 9, 2026 14:15
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