Skip to content

[DONE] Pattern Lab 의 ! 단언 가운데 타입으로 좁힐 수 있는 일곱이 빠진다 - #248

Merged
patternflow-bot merged 3 commits into
devfrom
claude/lsh-pf-round99-ujt5qf
Oct 25, 2026
Merged

patternflow-bot merged 3 commits into
devfrom
claude/lsh-pf-round99-ujt5qf

Conversation

@patternflow-bot

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

Copy link
Copy Markdown

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

Pattern Lab 코드가 ! 로 값이 있다고 믿던 일곱 곳을 타입으로 좁혔어요. 저장된 판 크기는 parseMatrixSize 가 맞는 크기나 null 로 돌려주고, 텍스트 효과가 무엇을 그리는지는 textEffectSource 한 곳에서 정해요. 화면은 그대로예요. 머지하면 손으로 고친 저장의 판 크기 127.6 이 128 로 열리고, source 가 없는 흐르기 레이어를 그리라고 해도 TypeError 없이 지나가요.

좋아지는 것: 없음

한 일

lib/pattern/matrix.ts 의 isValidMatrix 는 boolean 만 돌려줘서, 그걸 거친 legacyDraft.ts 의 readMatrix 와 serialize.ts 의 deserializeProject 가 candidate!.width, candidate!.height 를 다시 Number() 로 읽었어요. 그 자리에 parseMatrixSize 를 두었어요. 범위를 보는 셈(clampDimension)은 같고, 맞으면 그 셈이 낸 크기를, 아니면 null 을 돌려줘요. 두 파일은 ?? DEFAULT_MATRIX 와 ?? undefined 로 받아요. isValidMatrix 를 부르는 곳은 이 둘과 matrix.test.ts 뿐이라 이름째 바꿨어요.

텍스트 효과는 「twinkle 은 비트맵을, scroll 과 ramp 는 source 를 그린다」를 flatten.ts 와 hExport.ts 가 따로 적고 있었어요(effect === "twinkle" ? { x: 0, … } : layer.source!). 그 한 줄을 textEffects.ts 의 textEffectSource 로 옮겼어요. scroll 과 ramp 는 sourceFits 를 거친 source 만 돌려줘요. 두 내보내기는 효과를 모으는 Map 에 source 를 같이 담아서, 쓸 때 다시 꺼낼 일이 없어요. renderTextEffect 는 sourceFits 로 거르고, 맞지 않으면 out 을 건드리지 않고 돌아가요.

표대로 나머지 열(project! 들, getContext("2d")!, stack.pop()!, raw.get(t)!, ownerSVGElement! 들)은 그대로 뒀어요.

증거

시험 아닌 Lab 코드(lib/lab, app/pattern-lab, lib/pattern)의 ! 를 TypeScript AST 의 NonNullExpression 으로 셌어요.

dev(dce6b5e)  17
이 브랜치     10   빠진 곳: flatten.ts:106, hExport.ts:291, legacyDraft.ts:82(둘), serialize.ts:449(둘), textEffects.ts:171

새 시험을 dev 에서 돌렸어요. dev 엔 두 이름이 없어서, dev 의 옛 셈 그대로(! 와 Number()) 두 이름을 덧대고 돌렸어요.

× parseMatrixSize reads a side saved as text and rounds one between whole numbers
  → expected { width: 127.6, height: 64 } to deeply equal { width: 128, height: 64 }
× twinkle moves the bitmap, scroll and ramp only a source that fits
  → expected { x: 2, width: 23, …(1) } to be null
× a frame asked of a scroll with no source is left as it was
  TypeError: Cannot read properties of null (reading 'data')
✓ a moving text with no source, exported > scroll: the flattened JS and the header carry the bitmap, standing still
✓ a moving text with no source, exported > ramp: the flattened JS and the header carry the bitmap, standing still

이 브랜치에선 다 초록이에요.

$ npm ci
added 762 packages, and audited 763 packages in 25s

$ npm run lint -- --max-warnings=0
lint exit 0

$ npm run typecheck
> tsc --noEmit && tsc --noEmit -p ../tools/virtual-panel
typecheck exit 0

$ npm run build
ƒ  (Dynamic)  server-rendered on demand
build exit 0

$ npm run check:ci
 Test Files  103 passed (103)
      Tests  1291 passed (1291)
pattern-sandbox.html is up to date
passed   virtual-panel
check:ci exit 0
skipped  links-absolute · roadmap   (gh 로그인과 태그가 없는 컨테이너라서요. drift.yml 이 다시 돌려요)

$ npm run check:voice
check:voice: nothing found

GitHub 에서도 6d2ddee 의 Drift checks 와 Web CI 가 둘 다 success 예요. dev(dce6b5e)는 이 브랜치가 갈라진 뒤 움직이지 않아서 merge 할 것이 없었어요.

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

실행법

cd web && npm ci && npm run typecheck
npx vitest run src/lib/lab/textEffects.test.ts src/lib/pattern/matrix.test.ts src/lib/lab/textExport.test.ts src/lib/lab/serialize.test.ts

가정

  • 옛 isValidMatrix 는 범위만 보고 값은 Number() 그대로 돌려줘서, 손으로 고친 저장의 127.6 이 그대로 판 크기가 됐어요. parseMatrixSize 는 clampDimension 이 반올림한 128 을 돌려줘요. Lab 이 쓰는 저장은 늘 정수라서 Lab 이 남긴 저장은 열리는 모습이 그대로예요.
  • 「source 가 null 인 효과 레이어를 내보내는」 시험은 dev 에서도 초록이에요. dev 의 내보내기도 activeTextEffect 가 null 을 돌려줘서 비트맵으로 내보내요. 이 시험은 그 길을 지켜요. dev 에서 빨간 것은 위의 셋이에요.
  • renderTextEffect 가 맞지 않는 source 앞에서 out 을 그대로 두는 길은 지금 부르는 쪽에선 닿지 않아요. engine.ts 는 activeTextEffect 를, text.ts 는 placeTextSource 를 거친 뒤에만 불러요.
  • 표 밖: lib/lab/serialize.ts 는 @/lib/pattern/matrix 를 :16 과 :46 두 줄로 따로 불러와요.

Changelog

Web

  • Pattern Lab reads a saved frame size and a moving text's source through typed helpers. Seven non-null assertions are gone. A hand-edited size of 127.6 now opens as 128, and a scroll frame asked of a layer with no source leaves the frame alone instead of throwing.

경험

언제: 바퀴에서 새 이름을 부르는 시험이 dev 에서 빨갰다는 것을 보일 때
교훈: dev worktree 에 그 이름을 dev 의 옛 셈 그대로 덧대고 돌리면, import 실패 대신 동작이 달라 빨간 시험만 골라 볼 수 있어요
근거: #248 에서 textEffectSource 와 parseMatrixSize 를 옛 셈으로 덧대니 42개 가운데 셋만 빨갰고, 내보내기 시험 둘은 dev 에서도 초록이라는 걸 알았어요

바퀴

바퀴 99 · 후보 7 「Pattern Lab 의 ! 단언 가운데 타입으로 좁힐 수 있는 일곱이 빠진다」

다음 바퀴

  • 8위 「모든 쪽이 받는 globals.css 에서 아무도 쓰지 않는 옛 Inside 패널 규칙 377줄이 빠진다」. 남은 줄 가운데 순위가 가장 높아요.
  • 9위 「Lab 밖 CSS 모듈 다섯에서 아무 컴포넌트도 읽지 않는 클래스 23개가 빠지고, 시험이 사이트 전체의 CSS 모듈을 본다」. 바퀴 89 의 셈을 사이트 전체로 넓혀요.
  • 10위 「globals.css 에 남은 안 쓰는 규칙 70개와 그것만 쓰던 애니메이션 둘, 변수 넷이 빠진다」. 8위와 같은 파일이라 8위 다음에 하면 줄 번호가 덜 어긋나요.

https://claude.ai/code/session_01LkUCcHKEkbGmU8en5vWofb


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LkUCcHKEkbGmU8en5vWofb
@patternflow-bot patternflow-bot changed the title [WIP] 바퀴 99 — 앞 바퀴를 읽고 고를 줄을 찾는 중 [WIP] Pattern Lab 의 ! 단언 가운데 타입으로 좁힐 수 있는 일곱이 빠진다 Oct 25, 2026
… by !

Seven non-null assertions trusted an earlier boolean check; parseMatrixSize and textEffectSource hand back the checked value instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LkUCcHKEkbGmU8en5vWofb
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LkUCcHKEkbGmU8en5vWofb
@patternflow-bot patternflow-bot changed the title [WIP] Pattern Lab 의 ! 단언 가운데 타입으로 좁힐 수 있는 일곱이 빠진다 [DONE] Pattern Lab 의 ! 단언 가운데 타입으로 좁힐 수 있는 일곱이 빠진다 Oct 25, 2026
@patternflow-bot
patternflow-bot marked this pull request as ready for review October 25, 2026 06:13
@patternflow-bot
patternflow-bot merged commit 2ad0585 into dev Oct 25, 2026
2 checks passed
@patternflow-bot
patternflow-bot deleted the claude/lsh-pf-round99-ujt5qf branch October 25, 2026 06:15
engmung pushed a commit to engmung/Patternflow that referenced this pull request Oct 25, 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