Skip to content

Task/347 dev manual for codeserving - #348

Merged
HeechanKim-Genon merged 8 commits into
developfrom
task/347-dev-manual-for-codeserving
Aug 11, 2026
Merged

Task/347 dev manual for codeserving#348
HeechanKim-Genon merged 8 commits into
developfrom
task/347-dev-manual-for-codeserving

Conversation

@inoray

@inoray inoray commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

task(#347): 코드서빙 전처리기 개발 매뉴얼(타사 개발자용) + xlsx tabular 행별 청크

개요

Genos 코드서빙으로 배포된 전처리기의 코드를 타사(외부) 개발자가 직접 수정할 수 있도록,
개발환경 세팅 → 코드 이해 → 수정 → gitea push → 리비전 재배포까지 한 문서로 안내하는
개발 매뉴얼을 새로 작성했다. 이 매뉴얼은 공개 배포본 repo(doc_parser_code_serving)만
가지고 따라갈 수 있는 것
을 전제로 하며(이미지 빌드·사내 원본 repo 접근 불필요), 그 전제를
실제로 성립시키기 위해 배포본 생성 스크립트·예제 스크립트·기존 문서의 사내 의존(하드코딩된
접속정보, 배포본에 없는 상대링크, 사내 전용 문서)을 함께 정리했다.

매뉴얼을 쓰면서 발견한 동작 문제 하나도 같이 고쳤다 — formats.xlsx.processing_mode: tabular
인데도 doc_type 을 주지 않으면 xlsx/csv 가 시트 통짜 1청크로 나오던 문제. 이제
processing_mode 만으로 행 1개 = 청크 1개가 된다.

요약: ① 개발 매뉴얼 신규(2055줄) + docx/이미지, ② xlsx tabular 행별 청크(동작 변경),
③ 공개 배포본용 정리(하드코딩 키 제거·사내 문서 제외·deps 보강), ④ 문서/테스트 갱신.

주요 변경

1) 코드서빙 전처리기 개발 매뉴얼 신규 (본체)

  • facade/gitbook_doc/code_serving_dev_manual.md (신규, 2055줄)
    • 대상: Python·Git 은 알지만 Genos 는 처음인 외부 개발자. 시작 상태를 "코드서빙이 이미
      배포되어 동작 중"으로 고정하고, 출발점을 "돌고 있는 전처리기를 내 요구에 맞게 고치기"로 둠.
    • 구성: 0 문서 안내(대상·시작 상태·준비물·읽는 순서) → 1 Genos 기본(모델서빙·게이트웨이·
      리비전·코드스페이스) → 2 코드서빙 동작 모델·경로 제약 → 3 전처리기 5종·처리 흐름·저장소 2종 →
      4 개발환경(인터넷 연결 / 인터넷 단절 오프라인 키트 / 코드스페이스 / 모델서빙 연결) →
      5 코드 이해(코드 지도·main.py 처리 순서·parser/chunker 읽기·출력 스키마) →
      6 config yaml 옵션 → 7 코드 수정 가이드(개발 루프·수정 레시피·알아둘 제약) →
      8 재배포(gitea push → 리비전 → 호출 검증) → 9 퀵 가이드(시나리오 A/B) →
      부록 A 용어집 · B 환경값 확인 목록 · C 컨테이너 경로/환경변수 · D 참고 문서 ·
      E 코드서빙·코드스페이스 신규 생성.
    • 모든 명령 블록에 "실행 위치" 를 명시(내 PC / 코드스페이스 터미널 / 게이트웨이가 열리는 곳)해
      외부 개발자가 어디서 실행해야 하는지 헷갈리지 않게 함.
    • 환경마다 다른 값은 <GENOS_HOST> 처럼 꺾쇠 placeholder 로 통일 + 미치환 placeholder 확인
      명령을 각 장에 배치.
  • 배포용 산출물: code_serving_dev_manual.docx, 캡처 이미지 5장
    (gitbook_doc/images/codeserving_setup_*.png — 코드스페이스 생성/VSCode/gitea id/serving id/리비전 생성).
  • genon/tools/md2docx.py (신규, 611줄) — 위 docx 를 뽑는 md→docx 변환기.
    새 패키지 설치 없이 저장소 .venvmarkdown + python-docx 만 사용.
    지원: h1~h4 · 문단 · 중첩 목록 · 표 · 펜스 코드블록 · blockquote · hr · 인라인 서식 · 상대경로 이미지.
  • 진입 링크 추가 — 독자가 어느 문서에서 출발해도 매뉴얼로 도달하게:
    genon/README.md(타사 개발자에게 넘길 때 안내 + A~C 이미지 빌드는 사내 몫임을 명시),
    facade/gitbook_doc/intro.md, gitbook_doc/code_serving.md(호출 문서 ↔ 개발 문서 분리 명시),
    build-script/code-serving-README.md(독자별로 읽을 곳 표 신설).

2) 공개 배포본 정리 (매뉴얼 전제 성립)

  • build-script/sync-serving-repo.sh
    • 사내 전용 문서 EXCLUDE 추가genon/README.md, genon/MAINTAINERS.md,
      genon/dotsocr_vllm_max_num_seqs.md, genon/preprocessor/facade/README.md.
      배포본에 없는 폴더(build-script/·docling/·docs/)를 안내해 혼란만 주던 문서들.
    • 배포본 root .gitignore 생성 + 스모크 검증 추가 — 로컬 개발 산출물(.venv·result.json·
      캐시)과 오프라인 설치 키트(offline-dev-kit/·wheelhouse/)가 gitea 배포 저장소에
      실수로 커밋되지 않게.
    • requirements-dev.txt 보강 — 기존 4개(fastapi·httpx·grpcio·protobuf)에
      pymupdf·langchain-community·langchain-core·langchain-text-splitters·markdown2·
      pydub·chardet 추가. parser·chunking·attachment·convert facade 는 모듈 최상위에서 이들을
      import 해, 없으면 로컬에서 facade import 자체가 실패했다(외부 개발자의 주 작업 대상이 parser/chunker).
  • build-script/code-serving-README.md
    • 독자별 읽을 곳 표, 최초 설치 vs 갱신 분기(이미 배포 중이면 1·2번 건너뛰고 3번부터),
      1번 단계를 "설치 담당 엔지니어용(사이트당 1회)"로 명시.
    • GitHub PAT 발급 절차 삭제 — 배포본이 공개 repo 라 clone 에 인증 불필요.
    • 접속 정보 예시 → placeholder, 로컬 실행 절에서 "config 를 로컬용으로 고치기" 대신
      모델 서빙 외부 게이트웨이 URL + API 키 설정 방식으로 갱신(매뉴얼 4장 참조).
    • --chunk-size 생략 시 청크가 1개만 나오는 함정 경고 추가.

3) 접속 정보 하드코딩 제거 · 사내 링크 정리

  • examples/code_serving/serving_gateway_test.py, serving_gateway_preprocess_test.py
    • 하드코딩된 base URL·serving_id·auth_key 제거 → GENOS_BASE_URL/GENOS_SERVING_ID/
      GENOS_AUTH_KEY 환경변수 또는 --base-url/--serving-id/--auth-key.
      없으면 무엇을 지정해야 하는지 안내하고 exit 2.
    • --chunk-size 기본값 0None — 생략하면 전송하지 않아 서버 chunking.chunk_size
      쓰인다(종전엔 0 이 전송돼 의도치 않게 크기 기반 분할이 꺼졌다).
  • examples/code_serving/*_curl.sh 2종 — ${GENOS_*:?} 로 필수 환경변수화.
  • examples/parse_chunk/parse_chunk_test.py--doc_type/--chunk-size 도움말을 변경된
    의미(행 분할은 processing_mode, 0=크기 기반 병합·분할 끄기)로 갱신.
  • examples/parse_chunk/parse_chunk_test.sh — venv 탐색에 저장소 루트 .venv 추가
    (배포본 레이아웃 = 매뉴얼 4장이 만드는 위치). 순서: genon/preprocessor/.venv → 루트 .venv → 시스템 python.
  • gitbook_doc/installation.md·guardrail_workflow_setup.md, facade/README.md
    배포본에 존재하지 않는 상대링크(../../../README.md, ../../scripts/…)를 "사내 원본 저장소 …"
    텍스트 참조로 바꾸고, 예시 API 키·모델 경로를 placeholder 로 치환.

4) 기타 안정화

  • main.py_error_response()getattr(exc, 'error_code', None) 를 먼저 사용.
    facade 는 GenosServiceException 로컬 사본을 던져 전용 핸들러가 아닌 generic 경로로
    오는데, 그때 facade 가 부여한 코드가 INTERNAL_ERROR 로 뭉개지고 있었다.
  • facade/attachment_processor.py — weasyprint import 가드를 except (ImportError, OSError)
    확장(패키지는 있지만 libgobject-2.0 등 네이티브 라이브러리가 없는 환경).
    parser_processor.py 의 동일 블록과 형태 일치.
  • resource/·resource_dev/parser_processor_config.yamlprocessing_mode: tabular 주석을
    "데이터 행마다 parse element/청크 생성"으로 갱신.

5) 문서 / 테스트

  • gitbook_doc/parser_processor.md — CSV/XLSX 절 전면 갱신: tabular_row 스키마와 JSON 예시,
    metadata·column_map, 예약어 alias 정책, doc_type 과의 관계, page 의미(시트 순번),
    category 목록·content 형식 표에 tabular_row/custom_fields_row 추가, table
    "예전 산출물 재청킹 시에만 나타남"으로 표기. elements[].metadata 필드 설명 추가.
  • gitbook_doc/code_serving.md — 비-docling 청킹 설명을 csv/xlsx → [DA] 단일
    행마다 청크 1개 로 수정, 접속 정보 예시 placeholder 화, 개발 매뉴얼 링크 추가.
  • 신규 테스트 tests/unit/test_xlsx_processor.py (5종)
    • doc_type 없이 행별 element 생성 / multi_table 에서도 행 parity 유지
    • 예약 헤더(title 등) → field_<hash> alias 회피
    • _RESERVED_FIELDS ↔ chunker GenOSVectorMeta 드리프트 감지
    • 중복 헤더 정책 차이(parse 분리 경로는 오류, 직접처리는 _2 suffix) 고정
  • 신규 테스트 tests/unit/test_chunking_processor_unit.py (2종)
    • tabular_row 2행 → 청크 2개(i_chunk_on_doc 연속, metadata 가 벡터 property 로 승격)
    • 행/비-행 혼합 입력 → 비-행 드롭 + WARNING 로그 기록
  • 갱신 tests/smoke/test_parser_processor_smoke.py(csv/xlsx category → tabular_row),
    tests/unit/test_parser_processor_unit.py(_sheet_to_html 테스트 삭제 → 행별 element·
    metadata 키 검증), tests/unit/test_custom_fields_routing.py(tabular_row 파라미터 추가).

동작 변경 / 하위 호환

  • ⚠️ 동작 변경: processing_mode: tabular(기본)에서 csv/xlsx 의 parse 결과가
    시트당 table element데이터 행당 tabular_row element 로 바뀐다.
    이어지는 청킹도 [DA] 단일 벡터 → 행마다 벡터 1개. 벡터 수·검색 단위가 달라지므로
    기존 적재분과 섞이는 인덱스가 있으면 재적재 필요 여부를 확인해야 한다.
  • 하위 호환: category="table" 만으로 이루어진 예전 parse 산출물을 다시 청킹하면 종전대로
    [DA] 단일 벡터
    가 된다(legacy 가드 유지). faq_row·custom_fields_row 경로도 그대로.
  • 하위 호환: doc_type 매칭 tabular_mapping 이 있는 호출은 종전과 동일하게
    custom_fields_row 로 처리된다(우선순위 불변).
  • 예제 스크립트는 접속 정보를 환경변수/인자로 반드시 지정해야 한다(기본값 제거). 기존처럼
    인자 없이 실행하면 안내 메시지와 함께 exit 2.
  • serving_gateway_test.py --chunk-size 를 생략하던 호출은 이제 서버 config 값이 쓰인다
    (종전엔 0 전송). 종전 동작을 원하면 --chunk-size 0 을 명시.

테스트

  • tests/unit/test_xlsx_processor.py 5종 · tests/unit/test_chunking_processor_unit.py 2종 신규 통과.
  • csv/xlsx 스모크(test_parser_processor_smoke.py)에서 모든 element 가 tabular_row 임을 확인.
  • 로컬 E2E: FAQ 엑셀 → parse_chunk_test.py
    • --doc_type 없이 → 행마다 1청크(변경 전에는 시트 통짜 1청크), metadata 에 컬럼 키 + column_map.
    • --doc_type faq → 종전대로 custom_fields_row 목표필드 부착(회귀 없음).
  • 게이트웨이 호출: serving_gateway_test.py --mode parser_upload(xlsx) → --mode chunker
    행별 청크 결과 확인. 접속 정보 미지정 시 exit 2 동작 확인.
  • 배포본 생성: sync-serving-repo.sh 를 throwaway SERVING_DIR 로 실행해
    .gitignore·requirements-dev.txt·VERSION 생성과 사내 문서 4개 제외를 스모크로 확인.
  • md2docx.py 로 매뉴얼 docx 생성(표·코드블록·이미지·중첩목록 렌더 확인).

영향 파일

신규

  • genon/preprocessor/facade/gitbook_doc/code_serving_dev_manual.md (2055줄)
  • genon/preprocessor/facade/gitbook_doc/code_serving_dev_manual.docx
  • genon/preprocessor/facade/gitbook_doc/images/codeserving_setup_*.png (5장)
  • genon/tools/md2docx.py (611줄)
  • genon/preprocessor/tests/unit/test_xlsx_processor.py

코드

  • genon/preprocessor/converters/xlsx_processor.pytabular_data_to_parse_format,
    _build_column_keys, _RESERVED_FIELDS 확장, sheet_index
  • genon/preprocessor/facade/parser_processor.py_sheet_to_html 제거, 행별 위임
  • genon/preprocessor/facade/chunking_processor.pytabular_row 경로 + 드롭 WARNING
  • genon/preprocessor/facade/attachment_processor.py — weasyprint OSError 가드
  • main.pyerror_code 보존

빌드/배포

  • build-script/sync-serving-repo.sh, build-script/code-serving-README.md

config

  • genon/preprocessor/resource/parser_processor_config.yaml,
    genon/preprocessor/resource_dev/parser_processor_config.yaml (주석)

예제 스크립트

  • examples/code_serving/serving_gateway_test.py|.sh|_curl.sh,
    examples/code_serving/serving_gateway_preprocess_test.py|_curl.sh,
    examples/parse_chunk/parse_chunk_test.py|.sh

문서

  • genon/README.md, genon/preprocessor/facade/README.md,
    gitbook_doc/intro.md·code_serving.md·parser_processor.md·installation.md·
    guardrail_workflow_setup.md

테스트

  • tests/smoke/test_parser_processor_smoke.py, tests/unit/test_parser_processor_unit.py,
    tests/unit/test_chunking_processor_unit.py, tests/unit/test_custom_fields_routing.py

Summary by CodeRabbit

  • New Features
    • Added Markdown-to-DOCX conversion with support for headings, lists, tables, code, images, covers, and table of contents.
    • Spreadsheet parsing now produces row-level elements and chunks with consistent metadata.
  • Bug Fixes
    • Improved error responses by preserving available error codes.
    • Improved compatibility when native document-rendering libraries are unavailable.
  • Documentation
    • Clarified deployment, development, configuration, and spreadsheet-processing guidance.
    • Replaced embedded credentials with environment-based configuration in examples.

inoray and others added 7 commits August 10, 2026 16:06
Genos 를 처음 접하는 타사 개발자가 공개 배포본 repo 만으로 전처리기 코드를
수정·재배포할 수 있도록 개발 매뉴얼을 작성했다.

매뉴얼 (genon/preprocessor/facade/gitbook_doc/code_serving_dev_manual.md, 1,725줄)
- 0~3장: 시작 상태(이미 배포된 코드서빙 전제) · Genos/코드서빙/전처리기 개념
- 4장: 개발환경 준비 — 로컬(실측 검증) / 코드스페이스 / 로컬에서 되는 것·안 되는 것
- 5장: 코드 이해 — main.py 처리 순서, DocumentProcessor 계약,
       parser/chunker 내부 구조와 "여기를 고치면 무엇이 바뀌는가", 복제 범위
- 6장: config yaml 옵션 / 7장: 코드 수정 레시피·제약 / 8장: 재배포 / 9장: 퀵 가이드
- 부록: 용어집 · 환경값 확인 목록 · 컨테이너 경로 · 참고 문서 · 신규 생성
- docx 는 genon/tools/md2docx.py 로 md 에서 생성 (단일 소스 유지)

코드 변경
- sync-serving-repo.sh: requirements-dev.txt 에 로컬 개발 deps 추가
  (pymupdf/langchain-*/markdown2/pydub/chardet) — 기존 4개로는 parser·chunker
  facade import 자체가 실패
- parse_chunk_test.sh: venv 탐색 후보에 저장소 루트 .venv 추가
- 공개 repo 로 나가는 예제 스크립트·문서에서 게이트웨이 인증키·주소·serving_id 제거
  (환경변수 또는 필수 인자로 전환)

검증: 배포본 트리를 복제해 실제 설치 → 5개 facade import → PDF 파싱 → 청킹 E2E 확인.
링크·앵커는 원본/배포본 두 기준 모두 검증. 타사 개발자 페르소나 리뷰 2라운드 반영.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@inoray inoray self-assigned this Aug 11, 2026
@inoray inoray linked an issue Aug 11, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@inoray, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9f2b746a-1ca7-4134-bbab-1b199392aef0

📥 Commits

Reviewing files that changed from the base of the PR and between 6aa0b1b and fe6726b.

📒 Files selected for processing (10)
  • .gitignore
  • build-script/code-serving-README.md
  • build-script/sync-serving-repo.sh
  • genon/preprocessor/converters/xlsx_processor.py
  • genon/preprocessor/examples/code_serving/serving_gateway_preprocess_test.py
  • genon/preprocessor/examples/code_serving/serving_gateway_test.py
  • genon/preprocessor/examples/code_serving/serving_gateway_test.sh
  • genon/preprocessor/examples/parse_chunk/parse_chunk_test.sh
  • genon/preprocessor/facade/gitbook_doc/code_serving.md
  • genon/preprocessor/tests/unit/test_xlsx_processor.py
📝 Walkthrough

Walkthrough

The pull request updates generated code-serving deployment artifacts, changes CSV/XLSX processing to row-based parse elements and chunks, adds a Markdown-to-DOCX CLI, and adjusts runtime error and dependency handling.

Changes

Deployment and code-serving updates

Layer / File(s) Summary
Deployment packaging
build-script/..., genon/README.md
Deployment documentation and synchronization now describe generated public artifacts, exclusions, dependencies, .gitignore generation, and validation.
Gateway example configuration
genon/preprocessor/examples/..., build-script/code-serving-README.md, genon/preprocessor/facade/README.md
Examples use environment-based connection settings, validate missing values, and replace embedded credentials and model paths with placeholders.
Code-serving documentation
genon/preprocessor/facade/gitbook_doc/...
Documentation links to development guidance and describes row-based CSV/XLSX processing and current deployment paths.

Row-based tabular processing

Layer / File(s) Summary
Tabular row contract
genon/preprocessor/converters/xlsx_processor.py
The XLSX converter creates stable column metadata and tabular_row parse elements with sheet metadata.
Parser and chunker routing
genon/preprocessor/facade/parser_processor.py, genon/preprocessor/facade/chunking_processor.py, genon/preprocessor/resource*
The parser emits row elements, and the chunker routes them separately from legacy table output.
Tabular validation and documentation
genon/preprocessor/tests/..., genon/preprocessor/facade/gitbook_doc/parser_processor.md
Tests and documentation cover row categories, metadata, duplicate headers, reserved fields, row chunks, and compatibility behavior.

Document tooling and runtime handling

Layer / File(s) Summary
Markdown-to-DOCX conversion
genon/tools/md2docx.py
A CLI now parses GitHub-flavored Markdown and renders headings, lists, tables, code, links, images, blockquotes, cover pages, and tables of contents into DOCX.
Runtime error handling
genon/preprocessor/facade/attachment_processor.py, main.py
WeasyPrint native-library failures are handled, and explicit exception error codes are preserved.

Estimated code review effort: 5 (Critical) | ~90 minutes

Possibly related PRs

Suggested reviewers: heechankim-genon

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.48% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the developer manual for code-serving, which is a primary objective of the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/347-dev-manual-for-codeserving

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 9

🧹 Nitpick comments (2)
genon/tools/md2docx.py (2)

390-411: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the unused header_count variable, or use it to repeat header rows.

Lines 392 and 398-399 compute header_count, but no later code reads it. Either delete it, or apply it so header rows repeat on page breaks in Word.

♻️ Proposed fix (mark header rows as repeating)
             if src.tag == "th":
                 _set_shading(cell._tc.get_or_add_tcPr(), "EDEDED")
                 for run in p.runs:
                     run.bold = True
+        for r_idx in range(header_count):
+            tr_pr = table.rows[r_idx]._tr.get_or_add_trPr()
+            tr_pr.append(OxmlElement("w:tblHeader"))
         self.doc.add_paragraph()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@genon/tools/md2docx.py` around lines 390 - 411, Remove the unused
header_count variable and its related updates from _table, since no later logic
consumes it. Leave the existing table creation and autofit behavior unchanged.

586-607: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Declare the converter dependencies and handle file I/O errors.

genon/tools/pyproject.toml does not declare markdown or python-docx. Add both dependencies so the genos-tools environment can run md2docx.py.

_insert_image already handles image insertion failures. Handle OSError from input reading, output directory creation, and document saving, then return 1 with a concise error message.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@genon/tools/md2docx.py` around lines 586 - 607, Update
genon/tools/pyproject.toml to declare both markdown and python-docx
dependencies. In main, handle OSError from input reading, out_path.parent.mkdir,
and convert/document saving by reporting a concise stderr error and returning 1,
while preserving successful conversion behavior and the existing _insert_image
handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@build-script/code-serving-README.md`:
- Around line 67-72: Update the generated README content around the GenOS Docker
image instructions to remove the internal registry URL and internal repository
path; replace them with deployment-time placeholders or relocate the
build-and-push guidance to an internal document while preserving the public
deployment steps.
- Around line 212-213: Update the --chunk-size note in code-serving-README.md to
state that omitting the option leaves the field unset, allowing the server
configuration to apply instead of sending 0 and forcing a single chunk.
Reconcile the chunk_size table description so it reflects the same default and
omission behavior.

In `@build-script/sync-serving-repo.sh`:
- Around line 246-249: Extend the generated ignore entries near the existing
preprocessor example outputs to include the result_serving_gateway_test/
directory produced by
genon/preprocessor/examples/code_serving/serving_gateway_test.sh. Preserve the
existing ignore patterns and add only this generated output path.

In `@genon/preprocessor/converters/xlsx_processor.py`:
- Around line 559-563: Update the row-dictionary construction in the XLSX
processing flow to prevent duplicate blank headers from overwriting values:
either reject duplicate blank headers before calling dict(zip(headers, values)),
or assign positional col_N keys for blank headers as the neutral row format
does. Preserve all column values distinctly.

In `@genon/preprocessor/examples/code_serving/serving_gateway_test.py`:
- Around line 104-106: Prevent the argparse help output from revealing
GENOS_AUTH_KEY in both parsers. Update the auth-key defaults in
serving_gateway_test.py (lines 104-106) and serving_gateway_preprocess_test.py
(lines 70-72) to use a non-secret argparse default or suppress the default in
help, then resolve GENOS_AUTH_KEY after argument parsing while preserving
authentication behavior.

In `@genon/preprocessor/examples/code_serving/serving_gateway_test.sh`:
- Around line 8-10: Remove --auth-key "$GENOS_AUTH_KEY" from both parser and
chunker invocations in
genon/preprocessor/examples/code_serving/serving_gateway_test.sh at lines 8-10,
relying on the Python environment default; in
genon/preprocessor/examples/code_serving/serving_gateway_preprocess_test_curl.sh
at lines 21-23, replace interpolated AUTH in the curl header with a protected
curl config or header file so bearer tokens never appear in child-process
arguments.

In `@genon/preprocessor/facade/gitbook_doc/parser_processor.md`:
- Around line 954-955: Update the tabular_row example in the parser
documentation to use valid JSON string escaping: represent pipe characters as
raw | characters rather than \|, matching the formatter’s actual output. Keep
the existing sheet, header, and value content unchanged.

In `@genon/preprocessor/facade/README.md`:
- Around line 205-207: Sanitize the public configuration examples: in
genon/preprocessor/facade/README.md lines 205-207, replace adjacent internal API
URLs and the /nfs-root/models/223/760 path with placeholders or configurable
values; in genon/preprocessor/facade/gitbook_doc/code_serving.md line 326,
replace serving ID 139 and the implicit authentication default with required
environment or argument values.

In `@genon/README.md`:
- Around line 193-198: Keep the README blockquote continuous by removing the
blank line between the quoted manual guidance and the following quoted A~C
statement, or prefixing that line with “>” so the entire block remains one
blockquote.

---

Nitpick comments:
In `@genon/tools/md2docx.py`:
- Around line 390-411: Remove the unused header_count variable and its related
updates from _table, since no later logic consumes it. Leave the existing table
creation and autofit behavior unchanged.
- Around line 586-607: Update genon/tools/pyproject.toml to declare both
markdown and python-docx dependencies. In main, handle OSError from input
reading, out_path.parent.mkdir, and convert/document saving by reporting a
concise stderr error and returning 1, while preserving successful conversion
behavior and the existing _insert_image handling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ec090520-33a8-42e2-8bb6-05bac54dbab8

📥 Commits

Reviewing files that changed from the base of the PR and between 996b207 and 6aa0b1b.

⛔ Files ignored due to path filters (6)
  • genon/preprocessor/facade/gitbook_doc/code_serving_dev_manual.docx is excluded by !**/*.docx
  • genon/preprocessor/facade/gitbook_doc/images/codeserving_setup_create_code_serving_revision.png is excluded by !**/*.png
  • genon/preprocessor/facade/gitbook_doc/images/codeserving_setup_create_codespace_button.png is excluded by !**/*.png
  • genon/preprocessor/facade/gitbook_doc/images/codeserving_setup_gitea_id.png is excluded by !**/*.png
  • genon/preprocessor/facade/gitbook_doc/images/codeserving_setup_serving_id.png is excluded by !**/*.png
  • genon/preprocessor/facade/gitbook_doc/images/codeserving_setup_vscode.png is excluded by !**/*.png
📒 Files selected for processing (30)
  • build-script/code-serving-README.md
  • build-script/sync-serving-repo.sh
  • genon/README.md
  • genon/preprocessor/converters/xlsx_processor.py
  • genon/preprocessor/examples/code_serving/serving_gateway_preprocess_test.py
  • genon/preprocessor/examples/code_serving/serving_gateway_preprocess_test_curl.sh
  • genon/preprocessor/examples/code_serving/serving_gateway_test.py
  • genon/preprocessor/examples/code_serving/serving_gateway_test.sh
  • genon/preprocessor/examples/code_serving/serving_gateway_test_curl.sh
  • genon/preprocessor/examples/parse_chunk/parse_chunk_test.py
  • genon/preprocessor/examples/parse_chunk/parse_chunk_test.sh
  • genon/preprocessor/facade/README.md
  • genon/preprocessor/facade/attachment_processor.py
  • genon/preprocessor/facade/chunking_processor.py
  • genon/preprocessor/facade/gitbook_doc/code_serving.md
  • genon/preprocessor/facade/gitbook_doc/code_serving_dev_manual.md
  • genon/preprocessor/facade/gitbook_doc/guardrail_workflow_setup.md
  • genon/preprocessor/facade/gitbook_doc/installation.md
  • genon/preprocessor/facade/gitbook_doc/intro.md
  • genon/preprocessor/facade/gitbook_doc/parser_processor.md
  • genon/preprocessor/facade/parser_processor.py
  • genon/preprocessor/resource/parser_processor_config.yaml
  • genon/preprocessor/resource_dev/parser_processor_config.yaml
  • genon/preprocessor/tests/smoke/test_parser_processor_smoke.py
  • genon/preprocessor/tests/unit/test_chunking_processor_unit.py
  • genon/preprocessor/tests/unit/test_custom_fields_routing.py
  • genon/preprocessor/tests/unit/test_parser_processor_unit.py
  • genon/preprocessor/tests/unit/test_xlsx_processor.py
  • genon/tools/md2docx.py
  • main.py

Comment on lines +67 to +72
curl http://192.168.74.164:30500/v2/mnc/template-code-serving-doc-parser/tags/list
```
- GenOS **도커 이미지**에 등록하고, 이미지 타입은 반드시 **`Code_Serving`** 으로 지정합니다.
(이 타입이 아니면 4번 리비전 생성 화면의 이미지 목록에 나타나지 않습니다.)
- 레지스트리에 없으면 **사내 원본 저장소의 `build-script/code-serving-doc-parser/README.md`** 절차로
빌드·푸시합니다. 공개 배포본에는 빌드 도구가 포함되지 않습니다.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Remove internal registry details from the generated public README.

build-script/sync-serving-repo.sh copies this file into the public deployment repository. These lines expose http://192.168.74.164:30500/... and the internal path build-script/code-serving-doc-parser/README.md. Replace them with deployment-time placeholders, or move the internal build instructions to an internal document.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@build-script/code-serving-README.md` around lines 67 - 72, Update the
generated README content around the GenOS Docker image instructions to remove
the internal registry URL and internal repository path; replace them with
deployment-time placeholders or relocate the build-and-push guidance to an
internal document while preserving the public deployment steps.

Comment thread build-script/code-serving-README.md Outdated
Comment thread build-script/sync-serving-repo.sh
Comment thread genon/preprocessor/converters/xlsx_processor.py
Comment thread genon/preprocessor/examples/code_serving/serving_gateway_test.py Outdated
Comment on lines +8 to +10
# python serving_gateway_test.py --mode parser_upload --upload-file "../sample_files/hwp_sample_table.hwp" --out-doc result_serving_gateway_test/doc.json --serving-id "$GENOS_SERVING_ID" --auth-key "$GENOS_AUTH_KEY"
python serving_gateway_test.py --mode parser --file-path "/app/src/service/genon/preprocessor/sample_files/pdf_sample.pdf" --out-doc result_serving_gateway_test/doc.json --serving-id "$GENOS_SERVING_ID" --auth-key "$GENOS_AUTH_KEY"
python serving_gateway_test.py --mode chunker --doc-json result_serving_gateway_test/doc.json --out result_serving_gateway_test/chunks.json --serving-id "$GENOS_SERVING_ID" --auth-key "$GENOS_AUTH_KEY"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Keep bearer tokens out of child-process arguments.

Both shell examples read secrets from environment variables and then expand them into Python or curl arguments. This exposes tokens to process inspection and command logging.

  • genon/preprocessor/examples/code_serving/serving_gateway_test.sh#L8-L10: remove --auth-key "$GENOS_AUTH_KEY" and rely on the Python environment default.
  • genon/preprocessor/examples/code_serving/serving_gateway_preprocess_test_curl.sh#L21-L23: use a protected curl config or header file instead of interpolating AUTH into --header.
📍 Affects 2 files
  • genon/preprocessor/examples/code_serving/serving_gateway_test.sh#L8-L10 (this comment)
  • genon/preprocessor/examples/code_serving/serving_gateway_preprocess_test_curl.sh#L21-L23
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@genon/preprocessor/examples/code_serving/serving_gateway_test.sh` around
lines 8 - 10, Remove --auth-key "$GENOS_AUTH_KEY" from both parser and chunker
invocations in genon/preprocessor/examples/code_serving/serving_gateway_test.sh
at lines 8-10, relying on the Python environment default; in
genon/preprocessor/examples/code_serving/serving_gateway_preprocess_test_curl.sh
at lines 21-23, replace interpolated AUTH in the curl header with a protected
curl config or header file so bearer tokens never appear in child-process
arguments.

Comment on lines +954 to +955
| `tabular_row` | CSV/XLSX 데이터 행 1개. `시트명 → (제목) → 헤더 라인 → 값 라인` 파이프 텍스트 | `"시트명: Sheet1\n\| name \| age \|\n\| Alice \| 30 \|"` |
| `custom_fields_row` | CSV/XLSX 데이터 행 1개(`doc_type` 매핑 적용). `text_fields` 로 지정한 목표필드 값을 줄바꿈으로 이어붙임 | `"카드 발급은 어떻게 하나요?\n앱에서 신청 가능합니다."` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the invalid JSON example.

Line 954 uses \| inside a JSON string. \| is not a valid JSON escape. The row formatter also outputs raw pipe characters.

Proposed fix
- "시트명: Sheet1\n\| name \| age \|\n\| Alice \| 30 \|"
+ "시트명: Sheet1\n| name | age |\n| Alice | 30 |"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `tabular_row` | CSV/XLSX 데이터 행 1개. `시트명 → (제목) → 헤더 라인 → 값 라인` 파이프 텍스트 | `"시트명: Sheet1\n\| name \| age \|\n\| Alice \| 30 \|"` |
| `custom_fields_row` | CSV/XLSX 데이터 행 1개(`doc_type` 매핑 적용). `text_fields` 로 지정한 목표필드 값을 줄바꿈으로 이어붙임 | `"카드 발급은 어떻게 하나요?\n앱에서 신청 가능합니다."` |
| `tabular_row` | CSV/XLSX 데이터 행 1개. `시트명 → (제목) → 헤더 라인 → 값 라인` 파이프 텍스트 | `"시트명: Sheet1\n| name | age |\n| Alice | 30 |"` |
| `custom_fields_row` | CSV/XLSX 데이터 행 1개(`doc_type` 매핑 적용). `text_fields` 로 지정한 목표필드 값을 줄바꿈으로 이어붙임 | `"카드 발급은 어떻게 하나요?\n앱에서 신청 가능합니다."` |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@genon/preprocessor/facade/gitbook_doc/parser_processor.md` around lines 954 -
955, Update the tabular_row example in the parser documentation to use valid
JSON string escaping: represent pipe characters as raw | characters rather than
\|, matching the formatter’s actual output. Keep the existing sheet, header, and
value content unchanged.

Comment on lines +205 to +207
"toc_api_key": "<API_KEY>",
"metadata_api_key": "<API_KEY>",
"toc_model": "<MODEL_NAME_OR_PATH>"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Complete the public-repository configuration sanitization.

Both changes partially remove deployment-specific values but leave public examples with internal endpoints, paths, or serving defaults.

  • genon/preprocessor/facade/README.md#L205-L207: replace the adjacent internal API URLs and /nfs-root/models/223/760 path with placeholders or configurable values.
  • genon/preprocessor/facade/gitbook_doc/code_serving.md#L326-L326: replace the remaining 139 serving ID and implicit auth default with required environment or argument values.
📍 Affects 2 files
  • genon/preprocessor/facade/README.md#L205-L207 (this comment)
  • genon/preprocessor/facade/gitbook_doc/code_serving.md#L326-L326
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@genon/preprocessor/facade/README.md` around lines 205 - 207, Sanitize the
public configuration examples: in genon/preprocessor/facade/README.md lines
205-207, replace adjacent internal API URLs and the /nfs-root/models/223/760
path with placeholders or configurable values; in
genon/preprocessor/facade/gitbook_doc/code_serving.md line 326, replace serving
ID 139 and the implicit authentication default with required environment or
argument values.

Comment thread genon/README.md
Comment on lines +193 to +198
> **타사(외부) 개발자에게 전처리기 코드 수정을 넘길 때는**
> [`preprocessor/facade/gitbook_doc/code_serving_dev_manual.md`](preprocessor/facade/gitbook_doc/code_serving_dev_manual.md)
> 를 안내한다 — 공개 배포본 repo 만으로 개발환경 세팅 → parser/chunker 코드 이해·수정 → gitea push →
> 리비전 재배포까지 할 수 있게 쓴 매뉴얼이다(이미지 빌드·원본 repo 접근은 전제하지 않음).
> **아래 A~C(이미지 빌드·최초 등록)는 사내 담당자 몫**이며 그 매뉴얼에는 포함되지 않는다.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Keep the blockquote continuous.

The blank line at Line [198] splits the blockquote and triggers MD028. Remove the blank line or add > on that line.

Suggested fix
 > **아래 A~C(이미지 빌드·최초 등록)는 사내 담당자 몫**이며 그 매뉴얼에는 포함되지 않는다.
 
+>
 > **미리 코드서빙용 도커이미지를 보유하고 있다면 아래의 A, B 단계는 수행하지 않아도 된다.**
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)

[warning] 198-198: Blank line inside blockquote

(MD028, no-blanks-blockquote)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@genon/README.md` around lines 193 - 198, Keep the README blockquote
continuous by removing the blank line between the quoted manual guidance and the
following quoted A~C statement, or prefixing that line with “>” so the entire
block remains one blockquote.

Source: Linters/SAST tools

@HeechanKim-Genon
HeechanKim-Genon merged commit a93c4df into develop Aug 11, 2026
4 of 7 checks passed
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