Skip to content

fix(packaging): 배포 파일을 모두 256 KiB 아래로 (hwpx-plugins #66) - #676

Merged
airmang merged 1 commit into
mainfrom
fix/audit-file-size-limit
Nov 10, 2026
Merged

airmang merged 1 commit into
mainfrom
fix/audit-file-size-limit

Conversation

@airmang

@airmang airmang commented Nov 10, 2026

Copy link
Copy Markdown
Owner

요약

배포되는 파일이 모두 256 KiB 아래가 되게 합니다. Claude 플러그인이 엔진 배포판을 묶음에 실을 때 파일당 256 KiB 한도가 있는데, form_fit/_glyph_table.py(464 KB)와 layout/pages.py(333 KB)가 이를 넘어 2026-10-23부터 플러그인의 엔진 갱신이 멈춰 있습니다(hwpx-plugins #66).

  • 글리프 표를 압축 자료 파일로 옮겼습니다. _glyph_table.json.gz(66 KB)이고, _glyph_table.py는 가져올 때 한 번 읽는 로더(3.7 KB)가 됩니다. 이름 8개와 import 경로는 그대로입니다. 사람이 고치는 원본은 scripts/glyph_table_source.py이고 scripts/build_glyph_table.py가 자료 파일을 만듭니다(--check 지원).
  • pages.py를 둘로 나눴습니다. 상수, _Measure, 문단·표 모델, 흐르는 표의 행 계산(정의 128개)을 layout/_page_measure.py로 글자 그대로 옮겼습니다. hwpx.layout.pages.<이름>은 모두 전과 같이 풀립니다.
  • 크기 검사 테스트를 넣었습니다. src/hwpx와 빌드한 wheel의 모든 파일이 256 KiB에 닿으면 실패하고 80%를 넘으면 경고합니다.
파일 전 후
form_fit/_glyph_table.py 464,531 B 3.7 KB
form_fit/_glyph_table.json.gz 없음 66,230 B
layout/pages.py 332,902 B 157,957 B
layout/_page_measure.py 없음 178,801 B

wheel 파일 수는 206개에서 208개가 됩니다.

출력이 달라지지 않았다는 확인

고치기 전 main에서 뜬 값과 비교해 전부 같았습니다.

  • 표 8개의 값·순서·형
  • 글꼴 90개 × 글자 5,578자의 폭
  • estimate_text_width·hancom_line_starts·estimate_lines 2,520행
  • 저장소의 HWPX 1,214개에 대한 estimate_pages
  • 203개 문서의 write_line_caches 결과

병합 전에 정할 것

  • 압축 자료 파일을 받아들일지. #650은 "압축 없이 읽을 수 있는 소스"로 여러 .py에 나누는 안입니다. 이 PR은 그와 다릅니다. 읽을 수 있는 코드로 두면 파일이 2개 이상 더 필요하고, 묶음 파일 수 한도(512개, 지금 499개)에 더 빨리 닿습니다. #66의 문구와 플러그인의 현재 검사로는 자료 파일에 문제가 없습니다.
  • 글리프 표를 고치는 절차가 바뀝니다. scripts/glyph_table_source.py를 고치고 python scripts/build_glyph_table.py를 돌려 둘을 함께 커밋합니다.
  • form_fit/measure.py가 한도의 75%입니다. 이번에는 나누지 않았습니다.
  • 옮긴 함수·클래스의 __module__이 hwpx.layout._page_measure가 됩니다.

관련 이슈

Refs airmang/hwpx-plugins#66. #650과 같은 목적의 다른 방법입니다.

변경 종류

  • 버그 수정
  • 기능
  • 문서
  • 리팩터링

체크리스트

  • pytest 테스트가 통과합니다. — Windows 11에서 7,693 통과, 14 실패. 실패 14건은 이 변경 전 main에서도 같은 이름으로 실패하던 것입니다(cp949, 심볼릭 링크 권한, CRLF). Linux CI 결과는 이 PR의 체크로 확인해 주세요.
  • CHANGELOG.md를 갱신했습니다(해당하는 경우).
  • 문서 갱신이 필요한지 확인했습니다.

🤖 Generated with Claude Code

The Claude plugin carries the released wheel unpacked, and its directory
reads at most 256 KiB of one file. form_fit/_glyph_table.py (454 KiB) and
layout/pages.py (325 KiB) passed that, so the plugin's engine has been
stuck at 6.8.0 since 2026-10-23.

- The glyph tables ship as form_fit/_glyph_table.json.gz (gzip-compressed
  JSON, 65 KiB), read when hwpx.form_fit._glyph_table is imported. The
  readable source moves, unchanged, to scripts/glyph_table_source.py (not
  shipped); scripts/build_glyph_table.py writes the data file from it and
  tests/test_glyph_table_data.py compares every table value for value.
- The lower half of layout/pages.py (constants, the paragraph and table
  model, the rows of a flowing table) moves, text unchanged, to
  layout/_page_measure.py. pages.py imports every name it defines and keeps
  its own imports, so hwpx.layout.pages.<name> resolves as before.
- tests/test_distribution_file_sizes.py fails when a file of src/hwpx or of
  the built wheel reaches 256 KiB and warns past 80% of it.

The wheel goes from 206 to 208 files. Advances, widths, line breaks and the
page estimates of the 1,214 tracked HWPX files are the same as before.

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

@airmang airmang left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Reviewed b93645f against main 168fe98, including loader/build code, packaging metadata, ownership and compatibility exports. Independently compared ASTs: all original pages.py function/class definitions are unchanged across the two modules, and the readable glyph source is identical to the previous table module. Exact-head Python 3.12 CI log records 7,707 passed, 18 skipped, 1 xfailed; all 13 PR checks pass. Local focused data/export/size checks: 17 passed, 1 skipped (wheel build tooling in that environment). Separate isolated wheel build/inspection is being completed before the merge gate. No unresolved correctness issue found. This is a COMMENT because the signed-in account owns this PR; no package or plugin release is authorized or performed.

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