Skip to content

[DONE] 빌드 경로 둘이 이상한 몸과 이름에 500 이나 빈 200 대신 400 과 404 를 돌려주고, 처음 시험을 얻는다 - #287

Merged
patternflow-bot merged 3 commits into
devfrom
claude/lsh-pf-round116-jj3sq3
Oct 26, 2026
Merged

patternflow-bot merged 3 commits into
devfrom
claude/lsh-pf-round116-jj3sq3

Conversation

@patternflow-bot

@patternflow-bot patternflow-bot commented Oct 26, 2026 •

Copy link
Copy Markdown

lsh / https://claude.ai/code/session_018VpxviUVNcAM8zhftzDuzY

커뮤니티의 모듈 빌드 POST 는 patterns 에 null 하나만 들어도 던져서 CORS 없는 500 을 냈고, 모듈 GET 은 ?file=__proto__ 같은 이름에 빈 200 을 줬어요. 머지하면 앞은 까닭을 적은 400 을, 뒤는 404 를 돌려주고, 시험이 하나도 없던 빌드 경로 셋이 처음 시험 22개를 얻어요.

좋아지는 것: 없음

할 일

한 일

  • web/src/app/api/community/builds/route.ts: patterns 의 칸이 null, 수, 참거짓, 글, 배열이면 Pattern N: expected an object with the header in "code". 로 400 이에요. 전에는 null 만 .code 에서 던졌고 나머지는 「header is empty」 400 이었어요. 칸이 없거나 20개를 넘는 요청과 빈 헤더의 답은 그대로예요.
  • web/src/app/api/community/builds/[id]/modules/route.ts: ?file= 을 Object.hasOwn(entries, wantedFile) 로 찾아요. zip 에 든 이름만 나가고, __proto__, constructor, toString, hasOwnProperty 는 없는 이름처럼 404 예요.
  • 새 시험 web/src/app/api/community/builds/route.test.ts: 제 DB 와 산출물 폴더에 가입한 ada 로 세 처리기를 진짜로 불러요.
    • POST: 이상한 칸 여섯 가지(null, 0, true, 글, 배열, 좋은 칸 뒤의 null)가 Lab 의 Origin 으로 400 과 CORS 를 받는지. 좋은 헤더 하나는 202 로 줄에 서고, 폴 경로가 queued 와 queuePosition: 1 로 읽는지.
    • 폴 GET: 끝난 빌드의 modulesUrl 과 크기, 없는 id 의 404.
    • 모듈 GET: 통 zip, 목록, 파일 둘(.pfm 과 .json 의 Content-Type 과 길이), 없는 이름과 프로토타입 이름 넷의 404, 산출물 폴더 밖을 가리키는 행의 400, 디스크에서 사라진 zip 의 410, 줄에 선 빌드와 없는 id 의 404.

증거

새 시험을 dev 의 두 경로로 돌렸을 때(web/ 에서):

$ npx vitest run src/app/api/community/builds/route.test.ts
 × POST /api/community/builds > answers a pattern that is null with a 400 the Lab can read
 × POST /api/community/builds > answers a pattern that is null after a good one with a 400 the Lab can read
 × GET /api/community/builds/[id]/modules > answers ?file=__proto__, which the zip does not hold, with a 404
 × GET /api/community/builds/[id]/modules > answers ?file=constructor, which the zip does not hold, with a 404
 × GET /api/community/builds/[id]/modules > answers ?file=toString, which the zip does not hold, with a 404
 × GET /api/community/builds/[id]/modules > answers ?file=hasOwnProperty, which the zip does not hold, with a 404
TypeError: Cannot read properties of null (reading 'code')
     → expected 200 to be 404 // Object.is equality
      Tests  6 failed | 16 passed (22)

고친 뒤, 이 시험과 같은 POST 를 돌리는 nullBody.test.ts 를 같이:

 Test Files  2 passed (2)
      Tests  35 passed (35)

진짜 Next 경로로도 쟀어요. dev 경로 둘과 이 PR 을 각각 npm run build 하고, 같은 스크래치 DB 로 next start(COMMUNITY_ENABLED=1, BUILD_ENABLED=1, COMMUNITY_ALLOWED_ORIGINS=https://lab.patternflow.test)를 띄워 curl 로 보냈어요. 모듈 GET 은 POST 로 줄에 세운 빌드를 done 으로 돌리고 zip(265바이트, route_test.pfm 8바이트와 route_test.json)을 둔 뒤 재었어요.

                                      dev                                   이 PR
POST {"patterns":[null]}              500 · CORS 머리 없음 · JSON 없음       400 · access-control-allow-origin 있음
                                      서버 로그 TypeError (reading 'code')   {"error":"Pattern 1: expected an object with the header in \"code\"."}
GET …/modules?file=route_test.pfm     200 · 8바이트                          200 · 8바이트 · Content-Length 8
GET …/modules?file=missing.pfm        404                                    404
GET …/modules?file=__proto__          200 · 0바이트 · Content-Type 없음      404 · No such file in this build.
GET …/modules?file=constructor        200 · 0바이트                          404
GET …/modules?file=toString           200 · 0바이트                          404
GET …/modules?file=hasOwnProperty     200 · 0바이트                          404

다섯 검사(web/ 에서, 75a031b. 그 뒤 커밋은 시험 머리 주석만 바꿨어요):

npm ci                              → exit 0
npm run lint -- --max-warnings=0    → lint exit 0
npm run typecheck                   → typecheck exit 0
npm run build                       → ✓ Compiled successfully in 25.2s · build exit 0
npm run check:ci                    → Test Files 115 passed (115) · Tests 1413 passed (1413)
                                      drift: passed 14, skipped 2 (links-absolute, roadmap) · check:ci exit 0
npm run check:voice                 → read: 253 added lines in 3 files · check:voice: nothing found

화면은 바뀌지 않아서 사진은 없어요.

실행법

# web/ 에서
npx vitest run src/app/api/community/builds/route.test.ts

가정

  • 칸 검사를 null 하나가 아니라 「객체가 아닌 칸」 전부로 넓혔어요. 수나 글 같은 칸은 전에도 400 이었지만 「header is empty」 라고 해서, 무엇이 틀렸는지 말하지 않았어요. 바른 요청({ label, code } 칸)의 답은 그대로예요.
  • Object.hasOwn 은 tsconfig 의 lib: esnext 안이고 이 경로는 Node 22 에서만 돌아요.
  • 후보 줄의 「고칠 곳」 말고는 손대지 않았어요. 폴 경로 builds/[id]/route.ts 는 이미 바르게 답해서 시험만 붙였어요.
  • 이 시험은 jsdom 에서 돌아서, fflate 의 strToU8 가 준 바이트를 zipSync 가 파일로 받지 않고 바이트마다 폴더를 만들었어요. 시험의 JSON 항목은 Uint8Array.from 으로 만들었고, 경로 코드는 Node 의 Buffer 를 받아서 상관없어요.

Changelog

Web

  • The community's build routes answer bad input with 400 and 404. POST /api/community/builds threw on a null in patterns and came back a 500 without CORS headers, and GET …/modules?file=__proto__ (or constructor, toString, hasOwnProperty) answered 200 with an empty body. The three build routes have their first tests.

경험

언제: jsdom 에서 도는 Vitest 시험에서 fflate 의 zipSync 로 zip 을 만들 때
교훈: strToU8 나 TextEncoder 가 준 바이트는 다른 realm 의 Uint8Array 라 zipSync 가 파일 대신 바이트마다 폴더를 만드니, 항목은 Uint8Array.from 이나 new Uint8Array([...]) 로 만들어요
근거: #287 에서 route_test.json 항목이 route_test.json/0/ 부터 /20/ 까지 폴더 스물하나가 되어 목록 시험과 파일 시험이 빨갰어요

바퀴

바퀴 116 · 후보 11 「빌드 경로 둘이 이상한 몸과 이름에 500 이나 빈 200 대신 400 과 404 를 돌려주고, 처음 시험을 얻는다」

다음 바퀴

  • 12위 「로그인한 사람의 머리줄에 쪽을 열 때마다 「Sign in」 이 잠깐 뜨지 않는다」: 폰 390px 에서 로그인한 패턴 쪽과 덱 쪽의 CLS 가 0.049 예요.
  • 13위 「펌웨어 안내 띠가 첫 그림부터 쪽에 있어서, 하이드레이션 뒤에 쪽 전체를 아래로 밀지 않는다」: 390px 에서 패턴 쪽과 덱 쪽의 CLS 가 매번 0.141 이에요.
  • 14위 「아이폰에서 커뮤니티 글 칸을 눌러도 쪽이 확대되지 않는다」: 폰에서 글 칸의 글자가 12~14px 로 16px 아래예요.

https://claude.ai/code/session_018VpxviUVNcAM8zhftzDuzY


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VpxviUVNcAM8zhftzDuzY
@patternflow-bot patternflow-bot changed the title [WIP] pf 116바퀴 — 고를 일을 찾는 중 [WIP] 빌드 경로 둘이 이상한 몸과 이름에 500 이나 빈 200 대신 400 과 404 를 돌려주고, 처음 시험을 얻는다 Oct 26, 2026
…th 400 and 404

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VpxviUVNcAM8zhftzDuzY
@patternflow-bot patternflow-bot changed the title [WIP] 빌드 경로 둘이 이상한 몸과 이름에 500 이나 빈 200 대신 400 과 404 를 돌려주고, 처음 시험을 얻는다 [DONE] 빌드 경로 둘이 이상한 몸과 이름에 500 이나 빈 200 대신 400 과 404 를 돌려주고, 처음 시험을 얻는다 Oct 26, 2026
@patternflow-bot
patternflow-bot marked this pull request as ready for review October 26, 2026 16:54
@patternflow-bot
patternflow-bot merged commit 3ccaa08 into dev Oct 26, 2026
2 checks passed
@patternflow-bot
patternflow-bot deleted the claude/lsh-pf-round116-jj3sq3 branch October 26, 2026 16:56
engmung pushed a commit to engmung/Patternflow that referenced this pull request Oct 27, 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.

2 participants