Skip to content

fix(web): 결과 페이지 — 문제 텍스트 가독성, 풀이 표시, 죽은 버튼 제거#23

Merged
smilebank7 merged 1 commit into
mainfrom
fix/result-page-rendering
Jun 11, 2026
Merged

fix(web): 결과 페이지 — 문제 텍스트 가독성, 풀이 표시, 죽은 버튼 제거#23
smilebank7 merged 1 commit into
mainfrom
fix/result-page-rendering

Conversation

@smilebank7

@smilebank7 smilebank7 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

문제 (결과 화면 찐빠 3종)

스크린샷 기준 /app/new/result 의 사용자 가시 결함:

  1. 문제 텍스트 깨짐 — 한글 산문 전체를 KaTeX math mode 로 렌더 → 띄어쓰기 전부 소실 + 한 줄로 잘림 (문화제진행팀에는서로다른12명의학생...)
  2. 풀이 보기가 항상 빈 깡통 — agent 가 result 이벤트에 explanation_latex 를 아예 안 실음 (웹 hook/스키마는 이미 수신 준비 완료 상태였음)
  3. 죽은 버튼 — ↻/✎/× 3개가 영구 disabled ('v2 예정' 플레이스홀더), structural 모드에서 '개념동형' 필터 칩은 항상 빈 결과

수정

항목 내용
LatexAuto 컴포넌트 신설 구분자 없는 산문+수식 자동 분할: 수식 신호(\명령, ^{, =, 피연산자 사이 연산자)가 있는 ASCII 구간만 KaTeX, 나머지는 텍스트. $...$ 있으면 기존 splitDelimited 위임
적용 범위 결과 카드(문제/답/풀이) + 검증 페이지 preview + PDF export 시트
question-stage CSS 산문용 변형: 좌측 정렬, word-break: keep-all, 가로 클리핑 제거
wire-adapter proposed_solution_traceformatLatexexplanation_latex 송출 (빈 trace 는 생략). 풀이 없는 카드는 '풀이 보기' 자체를 숨김
버튼 정리 동작하는 ★(채택)만 남기고 disabled 3종 제거. 해당 문항 없는 필터 칩 숨김

검증 (실LLM 생성 + Playwright)

새 wire-adapter 로 실생성 3문항 → result 이벤트에 풀이 본문 확인 → 실페이로드를 sessionStorage 에 시드해 결과 페이지 구동:

  • ✅ 카드 3개 렌더, 문제 텍스트 띄어쓰기 보존(has_spaces=True), 가로 클리핑 없음(h_clipped=False ×3)
  • ✅ 카드당 버튼 1개(★)만, disabled 버튼 0개
  • ✅ ★ 클릭 → 'PDF 만들기' 활성화
  • ✅ '풀이 보기' 3개 모두 실풀이 본문 펼침
  • 🔍 '주의' 필터 → warning 1건만 표시; structural 모드라 '개념동형' 칩 미노출
  • 단위테스트: web 23/23 (segmentAuto 7건 신규), agent 259/259, web typecheck/build 통과

🤖 Generated with Claude Code


Summary by cubic

Fixes the result page so Korean prose renders correctly, solutions display when available, and only working actions are shown. The same rendering improvements apply to verify preview and PDF export.

  • Bug Fixes
    • Added LatexAuto to split undelimited prose+math and render only math runs via KaTeX; used for questions/answers on result cards, verify preview, and export sheet.
    • Introduced .question-stage styles for prose (left-aligned, keep-all wrapping) to preserve spacing and prevent horizontal clipping.
    • wire-adapter now emits explanation_latex by converting proposed_solution_trace with formatLatex; hides “풀이 보기” when no solution is present.
    • Removed the disabled ↻/✎/× buttons; kept only the star (채택). Filter chips with no matching problems are hidden.
    • Added tests for segmentAuto and solution trace formatting.

Written for commit 00a5440. Summary will update on new commits.

Review in cubic

Three user-facing defects on /app/new/result:

1. Korean problem text was passed whole into KaTeX math mode, which drops
   all spaces and clips to one line. Add LatexAuto — splits undelimited
   prose+math: ASCII runs with a math signal (\cmd, ^{, _{, =, operators
   between operands) render via KaTeX, everything else stays plain text.
   Applied to result cards, verify preview, and export sheet, with a
   question-stage prose variant (left-aligned, keep-all wrapping).

2. 풀이 보기 was always empty: the agent never sent explanation_latex.
   wire-adapter now projects proposed_solution_trace through formatLatex
   into the (already specced) explanation_latex field; the web hook and
   result page already consumed it. Cards without a solution hide the
   disclosure instead of showing a dead expander.

3. Removed the three permanently-disabled placeholder buttons (다시 생성/
   수정/폐기, 'v2 예정') — only the working star (채택) remains. Filter
   chips with no matching problems (e.g. 개념동형 in structural mode) are
   hidden.

Verified live via Playwright against a real 3-problem generation: prose
wraps without horizontal clipping, solutions expand with content, star
toggle enables PDF export, 주의 filter shows the warning card.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 10 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/web/components/math/latex-renderer.tsx">

<violation number="1" location="packages/web/components/math/latex-renderer.tsx:195">
P2: Operator heuristic misclassifies hyphen/slash prose words as math. This breaks readability by rendering normal words in KaTeX math mode.</violation>

<violation number="2" location="packages/web/components/math/latex-renderer.tsx:199">
P2: Any literal `$` disables `segmentAuto` for the remaining text because parsing is delegated too early. Mixed text containing currency plus undelimited math will skip math rendering after the `$`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

const TRAILING_PUNCT = /[.,]+$/;

export function segmentAuto(source: string): Segment[] {
if (/\$|\\\(|\\\[/.test(source)) return splitDelimited(source);

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: Any literal $ disables segmentAuto for the remaining text because parsing is delegated too early. Mixed text containing currency plus undelimited math will skip math rendering after the $.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/web/components/math/latex-renderer.tsx, line 199:

<comment>Any literal `$` disables `segmentAuto` for the remaining text because parsing is delegated too early. Mixed text containing currency plus undelimited math will skip math rendering after the `$`.</comment>

<file context>
@@ -181,3 +181,86 @@ export function LatexMixed({ source }: LatexMixedProps) {
+const TRAILING_PUNCT = /[.,]+$/;
+
+export function segmentAuto(source: string): Segment[] {
+  if (/\$|\\\(|\\\[/.test(source)) return splitDelimited(source);
+  const out: Segment[] = [];
+  let text = "";
</file context>

*/

const MATH_WORD = /^[A-Za-z0-9\\^_{}+\-*/=<>().,:%|']+$/;
const MATH_SIGNAL = /\\[a-zA-Z]+|[\^_]\{|=|[0-9A-Za-z)] ?[+\-*/] ?[0-9A-Za-z(]/;

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: Operator heuristic misclassifies hyphen/slash prose words as math. This breaks readability by rendering normal words in KaTeX math mode.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/web/components/math/latex-renderer.tsx, line 195:

<comment>Operator heuristic misclassifies hyphen/slash prose words as math. This breaks readability by rendering normal words in KaTeX math mode.</comment>

<file context>
@@ -181,3 +181,86 @@ export function LatexMixed({ source }: LatexMixedProps) {
+ */
+
+const MATH_WORD = /^[A-Za-z0-9\\^_{}+\-*/=<>().,:%|']+$/;
+const MATH_SIGNAL = /\\[a-zA-Z]+|[\^_]\{|=|[0-9A-Za-z)] ?[+\-*/] ?[0-9A-Za-z(]/;
+const TRAILING_PUNCT = /[.,]+$/;
+
</file context>

@smilebank7 smilebank7 merged commit b70bf85 into main Jun 11, 2026
5 checks passed
@smilebank7 smilebank7 deleted the fix/result-page-rendering branch June 11, 2026 05:50
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