fix(blog): frontmatter 파서 견고화 (#99, 파서 부분만)#126
Merged
Conversation
- extractStringField/extractArrayField: 작은따옴표 전용 → 작은/큰따옴표/백틱 모두 허용 - parseFrontmatterMetadata/extractMetadata: null 반환(silent skip) → 파일 경로를 포함해 throw 블록 미발견, title/date 누락, fs 읽기 실패 모두 빌드를 실패시켜 포스트가 목록에서 조용히 사라지는 것을 방지 - getAllMdxFiles: metadata null 체크 제거(더 이상 nullable 아님, 예외는 상위로 전파) - mdx-utils.test: 두 실패 케이스를 throw 기대로 수정 + 큰따옴표/백틱/에러 메시지 경로 케이스 추가 - 캐싱(성능)은 이번 범위에서 제외 — 파서 정합성만 우선 처리 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
리뷰 중 확인: 실제 frontmatter 값 중 내부에 혼합 따옴표를 쓰는 사례는 없음(검증 완료). 값 내부 이스케이프는 정규식 파서의 알려진 한계로 남기고, 왜 다루지 않는지 주석으로 근거를 남김. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
🔍 코드 리뷰 (self-review)발견 및 반영 (
|
…w-up) 기존 api 테스트(find-posts/find-tags/find-series)는 전부 getAllMdxFiles를 mock하므로 실제 fs 스캔이나 parseFrontmatterMetadata의 throw 전파는 어디서도 검증되지 않고 있었다 (과거 이를 real fs로 검증하던 constants.test.ts는 #89에서 삭제됨). - '실제 posts 디렉토리 스캔 시 던지지 않고 모든 글이 title/date를 갖는다' — 회귀 가드. 향후 어떤 포스트의 frontmatter가 깨지면 pnpm build를 기다리지 않고 pnpm test에서 바로 드러남 - '깨진 frontmatter가 있으면 getAllMdxFiles 호출 자체가 던진다' — 임시 디렉토리 fixture로 parseFrontmatterMetadata의 throw가 getAllMdxFiles까지 정상 전파됨을 검증 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
✅ 회귀 검증 테스트 추가 (
|
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.
#99 검토 결과 캐싱(성능)과 파서 견고화(정합성)를 분리했습니다. 캐싱은 28포스트 기준 빌드 12초로 지금 급하지 않다고 판단해 제외하고, 정합성 버그(silent skip)만 처리합니다.
문제
parseFrontmatterMetadata가 작은따옴표(') 전용 정규식이라 큰따옴표/백틱 사용 시 조용히 실패null반환 →getAllMdxFiles가 그 포스트를 통째로 목록에서 스킵 → 빌드는 성공하는데 포스트가 사라짐console.error만 찍고 역시 조용히 스킵변경
extractStringField/extractArrayField: 작은/큰따옴표/백틱 모두 허용하도록 정규식 확장getAllMdxFiles가 잡지 않고 그대로 전파 → 빌드 실패로 승격MdxFileInfo['frontMatter'] | null→ 논널러블로 정리검증
mdx-utils.test: 기존 null 기대 케이스 2개를 throw 기대로 수정 + 큰따옴표/백틱/에러 메시지 경로 케이스 4개 추가🤖 Generated with Claude Code