Skip to content

[DONE] 서버가 HTML 오류 쪽을 돌려줘도 커뮤니티 글 칸이 「Network error.」 대신 서버가 몇 번으로 답했는지 말한다 - #292

Merged
patternflow-bot merged 4 commits into
devfrom
claude/patternflow-round-121-92wehc
Oct 26, 2026
Merged

patternflow-bot merged 4 commits into
devfrom
claude/patternflow-round-121-92wehc

Conversation

@patternflow-bot

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

Copy link
Copy Markdown

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

커뮤니티의 댓글 칸과 창 다섯(Edit details, Report, 펌웨어 헤더, 퍼포먼스, 덱 공유)은 서버가 HTML 오류 쪽으로 답하면 「Network error.」 라고만 했어요. 서버는 답을 했는데요. 머지하면 「Comment failed (HTTP 502).」 처럼 몇 번으로 답했는지 말하고, 서버가 제 글을 보냈으면 그 글을 그대로 보여요.

좋아지는 것: 서버가 HTML 로 거절해도 몇 번인지 보인다 — 끊긴 것과 거절을 가린다

한 일

lib/community/apiBase.ts 에 readApiError(response, fallback) 를 더했어요. 몸이 { error } 가 든 JSON 이면 그 글을 돌려주고, HTML 이거나 비었거나 error 가 글이 아니면 「fallback」 (HTTP 502). 를 돌려줘요. JSON 읽기가 실패해도 던지지 않아서, catch 의 「Network error.」 는 fetch 가 아무 데도 닿지 못한 때만 나와요.

쓰는 곳은 여덟이에요. CommentSection.tsx 의 올리기, 고치기, 지우기와 EditDetailsModal.tsx, ReportModal.tsx, AddHeaderModal.tsx, AddPerformanceModal.tsx, ShareDeckModal.tsx 예요. 여섯 곳은 ok 를 보기 전에 몸을 JSON 으로 읽었는데, 이제 !response.ok 를 먼저 보고 그때만 도우미로 읽어요. 성공한 답의 몸은 아무도 쓰지 않아서(ShareDeckModal 의 id 만 빼고) 읽지 않아요. AddHeaderModal 의 hasCpp 는 읽는 곳이 없었어요. 글은 PublishModal 이 이미 쓰는 꼴(「Publishing failed (HTTP 502).」)을 따랐어요.

증거

폰 390 · 댓글 502 · 고치기 전
폰 390 · 댓글 502 · 고친 뒤
폰 390 · Edit details 413 · 고친 뒤
데스크톱 1440 · Edit details 413 · 고친 뒤
데스크톱 1440 · 댓글 502 · 고치기 전
데스크톱 1440 · 댓글 502 · 고친 뒤
폰 390 · Edit details 413 · 고치기 전
데스크톱 1440 · Edit details 413 · 고치기 전

Pi 와 같은 NEXT_PUBLIC_COMMUNITY_URL, NEXT_PUBLIC_BUILD_ENABLED 로 이 브랜치와 dev 의 컴포넌트 여섯을 따로 빌드했어요. 스크래치 DB 에 ada 와 공개 패턴 하나를 HTTP 로 넣고, ada 로 그 패턴 쪽을 열었어요. Playwright page.route 가 댓글 POST 에는 nginx 의 502 쪽을, Edit details 의 PATCH 에는 413 쪽을 text/html 로 돌려줬어요. 나머지 경로는 진짜 서버가 답했어요.

                     dev              이 브랜치
390 댓글 502          Network error.   Comment failed (HTTP 502).
390 Edit details 413 Network error.   Could not save (HTTP 413).
1440 댓글 502         Network error.   Comment failed (HTTP 502).
1440 Edit details 413 Network error.   Could not save (HTTP 413).

새 시험 셋을 dev 의 컴포넌트로 돌렸을 때(도우미 시험은 dev 에 도우미가 없어서 빼고):

CommentSection.test.tsx   Tests  3 failed | 3 passed (6)
   × says the status when the server answers a post with an HTML page
   × says the status when saving an edit meets an HTML page
   × says the status when a delete meets an empty answer
formErrors.test.tsx       Tests  10 failed | 5 passed (15)
   × Edit details · HTTP 502 / 413, Report · 502 / 413, Add firmware header · 502 / 413,
     Publish a performance · 502 / 413, Share deck · 502 / 413

dev 에서 지난 것은 서버가 JSON 으로 제 글을 보낸 때와 fetch 가 끊긴 때, 성공한 올리기예요. 이 브랜치에서도 그대로 지나요.

 ✓ src/lib/community/apiBase.test.ts (5 tests)
 ✓ src/components/community/CommentSection.test.tsx (6 tests)
 ✓ src/components/community/formErrors.test.tsx (15 tests)
      Tests  26 passed (26)

다섯 검사(web/ 에서):

npm ci                              added 1024 packages, and audited 1025 packages in 33s
npm run lint -- --max-warnings=0    lint exit 0 (출력 없음)
npm run typecheck                   typecheck exit 0 (출력 없음)
npm run build                       build exit 0
npm run check:ci                    Test Files 120 passed (120) · Tests 1468 passed (1468) · skipped links-absolute · skipped roadmap · exit 0
npm run check:voice                 check:voice: nothing found
npm run check:human-lock            check:human-lock: no locked words changed

links-absolute 와 roadmap 은 이 컨테이너에 gh 로 원래 레포를 읽을 길이 없어서 skipped 예요. PR 의 drift.yml 이 다시 돌려요.

실행법

# web/ 에서
npx vitest run src/lib/community/apiBase.test.ts src/components/community/CommentSection.test.tsx src/components/community/formErrors.test.tsx

화면으로 보려면 커뮤니티를 띄우고 패턴 쪽에서 댓글을 올리기 전에 개발자 도구로 POST /api/community/patterns/<id>/comments 를 막아요. 끊긴 때는 그대로 「Network error.」 예요.

가정

  • 줄이 꼽은 LikeButton.tsx:52 는 고치지 않았어요. 그 줄은 성공한 답을 읽는 곳이고, 실패한 답(:47:51)은 몸을 읽지 않고 말없이 되돌려요. 좋아요 단추엔 글을 보일 자리가 없어서 도우미가 돌려줄 글을 받을 곳이 없어요. 까닭을 보이는 일은 18위(LikeButton.tsx:47:51, :55~:58)이고, 그 바퀴가 readApiError 를 거기서 부르면 돼요.
  • 줄이 적은 줄 번호는 오늘 dev 에서 두 줄씩 밀려 있었어요(EditDetailsModal.tsx:102, ReportModal.tsx:58, AddHeaderModal.tsx:96, AddPerformanceModal.tsx:67, ShareDeckModal.tsx:67).
  • ShareDeckModal 이 2xx 를 받고 id 가 없으면 전처럼 「Sharing failed.」 예요. 경로는 201 과 { id } 로만 답해요. 2xx 인데 JSON 이 아니면 지금도 catch 로 가요.
  • PublishModal.tsx:221~:232 는 같은 일을 제 코드로 이미 해서 그대로 뒀어요.
  • 남은 19곳은 이 바퀴 밖이에요. app/community/p/[id]/PatternDetailClient.tsx:292, :890, :911, :1048, :1069, app/community/d/[id]/DeckDetailClient.tsx:148, :183, :269, :623, :737, lib/community/useModuleBuild.ts:115, :151, components/community/PatternCard.tsx:101, :195, DeckDock.tsx:274, FeaturedEditor.tsx:144, :219, ReportQueue.tsx:53, CommunityFeedClient.tsx:349 예요.
  • 표 밖: 폰 390 에서 Edit details 창의 아래 끝이 폰 탭 바 밑에 들어가요(「Edit details 413」 폰 사진의 맨 아래). 29위와 가까운 일이에요.

Changelog

Web

  • Community forms name the status when the server answers with an error page. A comment, Edit details, a report, a firmware header, a performance or a shared deck that met a proxy's 502 page or a bare 413 said "Network error."; it now says "Comment failed (HTTP 502)." and still shows the route's own message when it sent one.

경험

언제: 커뮤니티 글 칸의 오류 글을 빌드한 쪽에서 dev 와 견줄 때
교훈: 프록시를 세우거나 서버를 멈추지 말고 Playwright page.route 로 그 경로 하나만 HTML 502 나 413 으로 답하게 하고, 나머지는 진짜 서버에 맡겨요
근거: #292 에서 댓글 POST 와 Edit details PATCH 만 가로채 390 과 1440 에서 dev 의 「Network error.」 와 이 브랜치의 「(HTTP 502).」 를 쟀어요

언제: 고친 것을 이미 커밋한 뒤 「고치기 전」 빌드를 만들 때
교훈: git stash push -- <파일> 은 커밋된 고침에 말없이 아무것도 안 하니, git checkout origin/dev -- <파일> 로 되돌려 빌드하고 git checkout HEAD -- <파일> 로 돌아와요
근거: #292 에서 stash 가 출력 없이 끝나 git status 가 깨끗했고, 그대로 빌드했으면 「고치기 전」 사진이 고친 판이었어요

바퀴

바퀴 121 · 후보 16 「서버가 HTML 오류 쪽을 돌려줘도 커뮤니티 글 칸이 「Network error.」 대신 서버가 몇 번으로 답했는지 말한다」

다음 바퀴

  1. 17위 「「Liked」 탭이 비면 아무도 올리지 않았다는 글 대신 아직 좋아한 패턴이 없다고 한다」: 빈 갈래가 sort === "liked" 를 보지 않아 패턴 30개가 있는 벽에서도 「Nobody has hung anything here yet.」 이 떠요.
  2. 18위 「서버가 거절한 좋아요가 말없이 되돌아가지 않고 까닭을 보인다」: 이 바퀴의 readApiError 를 LikeButton.tsx 와 PatternCard.tsx 의 실패 갈래에서 부르면 서버 글이 바로 와요.
  3. 19위 「Preview 에서 댓글을 올리면 칸이 Write 로 돌아온다」: BodyComposer.tsx:34 의 previewing 이 글이 비어도 그대로라 올린 뒤 글 칸이 사라져요.

https://claude.ai/code/session_01DvhhnwQJLYXfjnFh8gg7q4


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DvhhnwQJLYXfjnFh8gg7q4
@patternflow-bot patternflow-bot changed the title [WIP] 바퀴 121 — 고를 일을 찾는 중 [WIP] 서버가 HTML 오류 쪽을 돌려줘도 커뮤니티 글 칸이 「Network error.」 대신 서버가 몇 번으로 답했는지 말한다 Oct 26, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DvhhnwQJLYXfjnFh8gg7q4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DvhhnwQJLYXfjnFh8gg7q4
@patternflow-bot patternflow-bot changed the title [WIP] 서버가 HTML 오류 쪽을 돌려줘도 커뮤니티 글 칸이 「Network error.」 대신 서버가 몇 번으로 답했는지 말한다 [DONE] 서버가 HTML 오류 쪽을 돌려줘도 커뮤니티 글 칸이 「Network error.」 대신 서버가 몇 번으로 답했는지 말한다 Oct 26, 2026
@patternflow-bot
patternflow-bot marked this pull request as ready for review October 26, 2026 19:53
@patternflow-bot
patternflow-bot merged commit 860dee1 into dev Oct 26, 2026
2 checks passed
@patternflow-bot
patternflow-bot deleted the claude/patternflow-round-121-92wehc branch October 26, 2026 19:54
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