Skip to content

[DONE] 커뮤니티에서 Lab 으로 연 패턴을 손대지 않고 다시 올려도 크기 검사에 막히지 않는다 - #152

Merged
patternflow-bot merged 5 commits into
devfrom
claude/lsh-pf-round53-wnc8wk
Oct 22, 2026
Merged

patternflow-bot merged 5 commits into
devfrom
claude/lsh-pf-round53-wnc8wk

Conversation

@patternflow-bot

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

Copy link
Copy Markdown

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

커뮤니티에서 Lab 으로 연 패턴을 손대지 않고 다시 올리면, 공유 창이 라이선스 머리말과 꼬리말까지 세어서 서버가 받아 줄 패턴을 「100 KB of code」로 먼저 막았어요. 머지하면 창이 서버처럼 그 둘을 떼고 재요. 본문 99,700자인 포크와 작성자가 고치러 다시 연 글이 그대로 올라가요.

좋아지는 것: 상한 가까운 패턴도 Lab 에서 그대로 다시 올라간다 — 서버가 받는 패턴을 창이 막지 않는다

할 일

한 일

web/src/components/community/PublishModal.tsx 의 크기 검사가 code.length 대신 이 길이를 재요.

const codeLength = (code.length <= CODE_MAX * 2 ? stripShareWrapping(code) : code).length;

두 서버 라우트(app/api/community/patterns/route.ts:142, patterns/[id]/route.ts:287)가 cleanCode 에 넘기는 값과 같은 식이에요. 그래서 창과 서버가 어떤 입력에서든 같은 길이를 봐요. 거절 글의 KB 도 이 길이로 적어요.

PublishModal.test.tsx 에 시험 셋을 더했어요. 본문 99,700자를 buildStoredPatternCode 로 포크처럼 감싸면 100,251자예요. 이걸 포크로 올리면 요청이 한 번 나가고, editOf 로 다시 열어 고치면 PATCH /api/community/patterns/p1 이 나가요. 본문이 100,600자면 지금처럼 요청 없이 「This pattern is 101 KB of code」로 막아요.

증거

새 시험을 dev 의 PublishModal.tsx 에 돌렸어요(워크트리에 시험 파일만 옮겨서).

   ✓ PublishModal > sends one publish for a double-click
   ✓ PublishModal > stays shut after publishing, while the page changes
   ✓ PublishModal > lets a failed publish be tried again
   × PublishModal code size > publishes an untouched fork whose body fits under the cap
     → expected <div class="formError"></div> to be null
   × PublishModal code size > saves the author's own post reopened in the lab, unedited
     → expected <div class="formError"></div> to be null
   ✓ PublishModal code size > still stops a body over the cap before it is sent
      Tests  2 failed | 4 passed (6)

이 브랜치에선 ✓ src/components/community/PublishModal.test.tsx (6 tests) 예요.

dev(9064c6d)와 이 브랜치를 COMMUNITY_ENABLED=1 과 NEXT_PUBLIC_COMMUNITY_URL 을 주고 각각 빌드해 3101, 3100 에 띄웠어요. @ada 가 API 로 본문 99,700자인 원작을 올리면 서버가 머리말과 꼬리말을 붙여 100,157자로 저장해요. 그다음 390px 와 1440px 에서 @ada 는 패턴 쪽의 「Edit in Pattern Lab」 → Lab 의 Update → 「Update this pattern」을, @grace 는 「Open in Pattern Lab」 → Share → 제목을 넣고 「Publish to the wall」을 눌렀어요.

dev    ada   390px → requests: []  · url: /pattern-lab · error: This pattern is 100 KB of code; the community takes up to 100 KB. …
dev    grace 390px → requests: []  · url: /pattern-lab · error: (같은 글)
dev    ada  1440px → requests: []  · url: /pattern-lab · error: (같은 글)
dev    grace 1440px → requests: [] · url: /pattern-lab · error: (같은 글)
branch ada   390px → requests: [PATCH /api/community/patterns/0e43ce3fc1f0469c] · url: /community/p/0e43ce3fc1f0469c · error: none
branch grace 390px → requests: [POST /api/community/patterns] · url: /community/p/ff05705baf1c46dd · error: none
branch ada  1440px → requests: [PATCH /api/community/patterns/0e43ce3fc1f0469c] · url: /community/p/0e43ce3fc1f0469c · error: none
branch grace 1440px → requests: [POST /api/community/patterns] · url: /community/p/eb571dcd409c41cc · error: none

이 브랜치의 데이터베이스에 남은 길이예요. 서버가 잰 길이(떼고 난 길이)는 다 100,000 밑이에요.

0e43ce3fc1f0469c original stored 100246 bare 99789
ff05705baf1c46dd fork     stored 100347 bare 99789
eb571dcd409c41cc fork     stored 100350 bare 99792

폰 390 · dev · 포크를 Share 하면 창이 막아요
폰 390 · 이 브랜치 · 포크가 올라가 패턴 쪽으로 가요
데스크톱 1440 · dev · 작성자가 고치러 연 글을 Update 하면 창이 막아요
데스크톱 1440 · 이 브랜치 · 같은 글이 고쳐져 패턴 쪽으로 가요

web/ 에서 다섯 검사의 끝줄이에요.

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 17.4s · build exit 0
npm run check:ci                    → Test Files 84 passed (84) · Tests 871 passed (871) · passed virtual-panel · check:ci exit 0

check:ci 의 links-absolute 와 roadmap 은 gh 로그인이 없는 컨테이너라 skipped 예요. npm run check:voice 는 「read: 97 added lines in 2 files · nothing found」예요.

실행법

cd web
npx vitest run src/components/community/PublishModal.test.tsx

가정

  • 표는 머리말과 꼬리말이 원작 447자, 포크 576자라고 적었어요. 제목과 아이디 길이에 따라 달라서, 여기선 원작 457자, 시험의 포크 551자였어요. 코드 주석엔 수를 적지 않고 「a few hundred characters」로 적었어요.
  • 서버의 CODE_MAX * 2 문턱까지 그대로 옮겼어요. 그 위에선 서버도 떼지 않고 재서 거절하니, 창도 같은 답을 내요.
  • PostHog 로 보내는 code_length 는 그대로 감싼 길이예요. 분석 값이 바뀌면 지난 값과 견줄 수 없어서 두었어요.
  • Lab 은 올릴 때 @matrix 와 @knobs 줄을 더해요. 본문 99,700자가 99,789자가 됐고, 여전히 상한 밑이에요.
  • 브라우저 시험에서 패턴 쪽의 「Edit in Pattern Lab」과 「Open in Pattern Lab」은 Playwright click() 이 처리기를 부르지 못했어요. 이 컨테이너는 편집기(Monaco)를 받는 CDN 에 닿지 못해요. 그래서 그 단추만 dispatchEvent("click") 로 눌렀어요. Lab 안의 단추와 창의 단추는 그냥 눌렀어요.
  • 표 밖에서 하나 봤어요. 본문이 100,001~100,499자면 거절 글이 「This pattern is 100 KB of code; the community takes up to 100 KB」가 돼요(Math.round). dev 에서도 감싼 길이로 같은 글이 났어요(위 사진). 고치지 않았어요.

Changelog

Web

  • Sharing from Pattern Lab measures the code the way the community does. "Open in Pattern Lab" hands back the stored code with its licence header and footer on, and the publish modal counted them, so an unchanged fork or a reopened post just under the 100 KB cap was refused before it was sent, though the server takes it.

경험

언제: 바퀴에서 커뮤니티 패턴 쪽의 「Open in Pattern Lab」이나 「Edit in Pattern Lab」을 브라우저로 눌러 Lab 까지 잴 때
교훈: Playwright click() 대신 locator.dispatchEvent("click") 로 누른다. click() 은 sessionStorage 에 handoff 를 쓰지 못하고 쪽에 그대로 남는다
근거: #152 에서 click() 뒤 25초를 기다려도 주소가 /community/p/… 였고 sessionStorage 가 비어 있었어요. 편집기 CDN 이 막혀 「Monaco initialization: error」가 난 쪽이었고, 같은 단추의 onClick 을 부르자 /pattern-lab?from=community 로 갔어요

바퀴

바퀴 53 · 후보 9 「커뮤니티에서 Lab 으로 연 패턴을 손대지 않고 다시 올려도 크기 검사에 막히지 않는다」

다음 바퀴

  • 10 「커뮤니티 API 가 원작 패턴의 라이선스를 거둔 MIT 나 CC0 로 바꾸는 요청을 거절한다」. 원작에 PATCH {"license":"MIT"} 가 200 이고 소스의 SPDX 줄이 MIT 로 바뀌어요.
  • 11 「커뮤니티 창이 Esc 로 닫히고, 열리면 초점이 창 안으로 들어가며, 닫히면 연 단추로 돌아온다」. 로그인, 신고, Edit details, Add firmware header, Publish a performance 창이 Esc 에 닫히지 않아요.
  • 12 「폰에서 지도의 거르개 단추 줄이 지도 위에 따로 서서 점 이름을 가리지 않고, 지도 아래 빈 칸과 폰에서 안 되는 휠 안내가 없어진다」. 390px 에서 투명한 거르개 단추 밑에 지도 글자 83개 가운데 21개가 깔려요.

https://claude.ai/code/session_01WVX967x95TPzbEiTm15jot


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVX967x95TPzbEiTm15jot
@patternflow-bot patternflow-bot changed the title [WIP] pf 53바퀴 — 후보 표에서 다음 한 줄을 고친다 [WIP] 커뮤니티에서 Lab 으로 연 패턴을 손대지 않고 다시 올려도 크기 검사에 막히지 않는다 Oct 22, 2026
The API strips the stored header and footer before it checks the cap, so a
fork reopened from the community was refused by the modal and not the server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVX967x95TPzbEiTm15jot
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVX967x95TPzbEiTm15jot
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVX967x95TPzbEiTm15jot
@patternflow-bot patternflow-bot changed the title [WIP] 커뮤니티에서 Lab 으로 연 패턴을 손대지 않고 다시 올려도 크기 검사에 막히지 않는다 [DONE] 커뮤니티에서 Lab 으로 연 패턴을 손대지 않고 다시 올려도 크기 검사에 막히지 않는다 Oct 22, 2026
@patternflow-bot
patternflow-bot marked this pull request as ready for review October 22, 2026 03:19
@patternflow-bot
patternflow-bot merged commit 4c51ecf into dev Oct 22, 2026
2 checks passed
@patternflow-bot
patternflow-bot deleted the claude/lsh-pf-round53-wnc8wk branch October 22, 2026 03:21
engmung pushed a commit to engmung/Patternflow that referenced this pull request Oct 22, 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