Skip to content

feat(user): 생년월일 1900-01-01 이전 입력 거부#75

Merged
chanwoo7 merged 3 commits intodevelopfrom
feat/mypage-figma-birth-date-floor
Apr 29, 2026
Merged

feat(user): 생년월일 1900-01-01 이전 입력 거부#75
chanwoo7 merged 3 commits intodevelopfrom
feat/mypage-figma-birth-date-floor

Conversation

@chanwoo7
Copy link
Copy Markdown
Member

Summary

  • 회원정보 수정/온보딩의 생년월일 정규화 로직(normalizeBirthDate)에 1900-01-01 이전 날짜 거부 정책 추가
  • 봇/오입력 방지 목적의 가벼운 하한 검증
  • 비교 기준은 normalize와 동일한 로컬 타임존 자정으로 둠

변경 사항

  • MIN_BIRTH_DATE = new Date(1900, 0, 1) 상수 추가 (user.constants.ts)
  • user-base.service.ts normalizeBirthDate< MIN_BIRTH_DATE 거부 분기 추가
  • 회귀 테스트 2건 추가 (1899-12-31/1850 reject, 1900-01-01 통과)

Breaking 여부

  • 매우 약한 Breaking. 1900-01-01 이전 입력은 사실상 봇/오입력만 해당
  • 마이그레이션: 없음 (DB 스키마 변경 없음)
  • 기존 row 영향: 없음 (읽기 시 검증 안 함, 새 입력만 검증)

Test plan

  • 로컬 yarn test:cov 통과 (820 tests)
  • CI check 통과
  • CI coverage-report 통과
  • CodeQL 통과

기획자 화면 명세를 로컬에서 관리하는 .figma/ 디렉터리를 ignore에 등록.
스크린샷/스펙 텍스트는 작업자 본인 로컬에서만 참고하도록 한다.
기획 명세에 별도 하한 정책이 없으나, 봇/오입력 방지를 위해
normalizeBirthDate에 1900-01-01 이전 날짜 거부 로직을 추가한다.
비교 기준은 normalize와 동일한 로컬 타임존 자정으로 둔다.

- MIN_BIRTH_DATE 상수 추가 (user.constants.ts)
- 회귀 테스트 2건 추가 (1899-12-31/1850 reject, 1900-01-01 통과)
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 072c9a5a-8656-467d-b109-45b18fd3e4eb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mypage-figma-birth-date-floor

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f59f38266e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

today.setHours(0, 0, 0, 0);
const normalized = new Date(date);
normalized.setHours(0, 0, 0, 0);
if (normalized < MIN_BIRTH_DATE) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Accept min birth date string in non-UTC timezones

When raw is a date-only string (e.g. '1900-01-01'), new Date(raw) is interpreted as UTC, then setHours(0,0,0,0) shifts it to local midnight. In negative-offset environments (e.g. America/New_York), this becomes 1899-12-31 00:00 local, so the new lower-bound check rejects a value that should be valid per the inclusive 1900-01-01 policy. This regression affects API clients that send birth dates as strings and run on non-UTC servers.

Useful? React with 👍 / 👎.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 96.57% 2790/2889
🟢 Branches 86.53% 1599/1848
🟢 Functions 93.08% 592/636
🟢 Lines 96.92% 2546/2627

Test suite run success

820 tests passing in 75 suites.

Report generated by 🧪jest coverage report action from 7cfb5ea

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

기존 setHours(0,0,0,0) 로컬 자정 정규화 + 로컬 자정 MIN_BIRTH_DATE는
KST 환경에선 동작하나 음수 오프셋(예: America/New_York) 또는 UTC 환경에서는
'1900-01-01' 같은 ISO date string이 1899-12-31로 정렬되어 부당하게 reject되는
회귀가 있었음 (Codex 리뷰 P2).

GraphQL DateTime은 ISO string을 UTC로 해석하고 DB 컬럼은 @db.Date(시간 무시)이므로
UTC 자정 기준으로 정규화/비교하도록 통일한다.

- MIN_BIRTH_DATE = new Date(Date.UTC(1900, 0, 1))
- normalize: getUTCFullYear/getUTCMonth/getUTCDate로 UTC 자정 정렬
- 미래 비교의 today도 동일하게 UTC midnight 기준
- 회귀 테스트 입력을 ISO string으로 조정 + getUTCFullYear 검증
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7cfb5eaf2b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +113 to +116
const normalized = new Date(
Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()),
);
if (normalized < MIN_BIRTH_DATE) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve client date when enforcing 1900-01-01 lower bound

Using getUTC* to derive normalized causes timezone-offset DateTime inputs at midnight to shift to the previous UTC day, so valid boundary values can be rejected. For example, with GraphQL DateTime (see DateTimeScalar.parseValue), sending 1900-01-01T00:00:00+09:00 parses to 1899-12-31T15:00:00Z, then this code normalizes it to 1899-12-31 and throws birthDate is too old, even though the client provided calendar date 1900-01-01. This is a regression introduced by the new minimum-date check path and affects clients that submit full ISO timestamps with positive offsets.

Useful? React with 👍 / 👎.

@chanwoo7 chanwoo7 merged commit c210942 into develop Apr 29, 2026
9 checks passed
@chanwoo7 chanwoo7 deleted the feat/mypage-figma-birth-date-floor branch April 29, 2026 15:49
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