Skip to content

feat: complete section extraction pipeline#85

Merged
seonghobae merged 2 commits into
developfrom
feat/issue-35-section-extraction
Mar 25, 2026
Merged

feat: complete section extraction pipeline#85
seonghobae merged 2 commits into
developfrom
feat/issue-35-section-extraction

Conversation

@seonghobae
Copy link
Copy Markdown
Owner

Resolves #35

Changes

  • Implemented bandscope_analysis.sections package (models, anchors, extractor).
  • Aligned shared-types (TypeScript) SectionFormLabel to precisely match canonical section labels.
  • Connected API integration to return extracted sections over dummy data.
  • Enforced 100% test coverage and full typings.

Security Notes

  • Data flowing through the section pipeline operates exclusively on in-memory representations. No new I/O, subprocess, or external network calls are introduced.
  • Strict SectionLabel and extraction logic ensures no arbitrary string payloads bypass validation boundaries within IPC.

- Introduce section/form/cue extraction domain models
- Extract section tags using lyric phrasing and count anchors
- Synchronize frontend TS models with backend extraction model
- Validate with comprehensive engine and shared-type tests
@seonghobae
Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9558cd2c-210b-4f9f-bee8-98756e1feb9b

📥 Commits

Reviewing files that changed from the base of the PR and between 6532a55 and 263afb4.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (8)
  • packages/shared-types/src/index.ts
  • packages/shared-types/test/index.test.ts
  • services/analysis-engine/src/bandscope_analysis/api.py
  • services/analysis-engine/src/bandscope_analysis/sections/__init__.py
  • services/analysis-engine/src/bandscope_analysis/sections/anchors.py
  • services/analysis-engine/src/bandscope_analysis/sections/extractor.py
  • services/analysis-engine/src/bandscope_analysis/sections/model.py
  • services/analysis-engine/tests/test_sections.py

Cache: Disabled due to Reviews > Disable Cache setting

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • 새로운 기능

    • 표준화된 소문자 섹션 레이블과 레이블 기반 섹션 추출(카운트/가사 전략) 도입
    • 가사 기반 및 박자 기반 큐 앵커 생성 기능 추가
  • 버그 수정 / 안정성

    • 섹션 레이블 검증을 강화해 정의된 레이블만 허용
    • 데모 및 내보내기 요약 메타데이터가 새 레이블 형식으로 갱신됨
  • 테스트

    • 섹션 추출, 레이블 정규화 및 앵커 동작을 검증하는 테스트 추가

Walkthrough

섹션/폼/큐 앵커 추출 파이프라인을 새로 추가하고, 공유 타입의 섹션 레이블을 허용 목록으로 제약해 데모·검증·런타임 검증을 정비했습니다.

Changes

Cohort / File(s) Summary
Shared Types - 스키마 & 검증
packages/shared-types/src/index.ts, packages/shared-types/test/index.test.ts
SECTION_FORM_LABELS(허용 레이블 튜플) 및 SectionFormLabel 타입 추가. RehearsalSection.label을 제약된 타입으로 변경하고 런타임 검증을 목록 멤버십으로 강화. 데모/테스트 레이블을 소문자로 조정.
섹션 도메인 모델
services/analysis-engine/src/bandscope_analysis/sections/model.py
표준 섹션 레이블 Enum(SectionLabel)과 ALL_SECTION_LABELS, CueAnchorStrategy, 및 TypedDict 기반 타입(CueAnchor, SectionCandidate, SectionExtractionResult) 추가.
섹션 추출 로직
services/analysis-engine/src/bandscope_analysis/sections/extractor.py
_normalize_labelextract_sections() 추가: 레이블 정규화, form_label 기반 순번 id 생성, 전략 선택(lyric/count), 신뢰도 판정, cue_anchor 생성 및 추출 요약 반환.
앵커 헬퍼
services/analysis-engine/src/bandscope_analysis/sections/anchors.py
count_based_anchor(beat=1, bar=1)lyric_phrase_anchor(phrase) 헬퍼 추가(간단한 CueAnchor 딕셔너리 생성).
패키지 초기화/공개 API
services/analysis-engine/src/bandscope_analysis/sections/__init__.py
섹션 관련 모듈/타입/함수를 패키지 레벨에서 재노출하도록 __all__ 구성(모듈 공개 API 정의).
데모 통합
services/analysis-engine/src/bandscope_analysis/api.py
build_demo_rehearsal_song()extract_sections()를 호출하여 섹션 필드(id,label,groove)를 채우고 exportSummary의 headline/ focusSections 레이블을 소문자 기반으로 변경.
테스트
services/analysis-engine/tests/test_sections.py
가사 기반/카운트 기반/비인식 레이블 시나리오를 검증하는 단위 테스트 추가.

Sequence Diagram(s)

sequenceDiagram
participant API as "API\n(build_demo_rehearsal_song)"
participant Extractor as "extract_sections\n(extractor.py)"
participant Model as "sections.model\n(ALL_SECTION_LABELS, types)"
participant Anchors as "anchors\n(lyric/count helpers)"

API->>Extractor: arrangement 전달
Extractor->>Model: ALL_SECTION_LABELS로 레이블 정규화/판별
alt lyric_cue 존재
    Extractor->>Anchors: lyric_phrase_anchor(phrase)
    Anchors-->>Extractor: CueAnchor(strategy=lyric, value=phrase)
else lyric_cue 없음
    Extractor->>Anchors: count_based_anchor(beat,bar)
    Anchors-->>Extractor: CueAnchor(strategy=count, value="Enter on beat 1 of bar 1")
end
Extractor->>Model: confidence 결정 및 SectionCandidate 생성
Extractor-->>API: SectionExtractionResult(sections, strategy_used, notes)
API->>API: rehearsal song 생성 및 exportSummary 업데이트
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐇 소문자 라벨로 줄 맞추고 뛰네
가사로 짚고 카운트로 손짓하네
ID는 순서대로, 신뢰는 표시되고
앵커가 길을 비추니 리허설이 빛나네 🎶

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-35-section-extraction

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae seonghobae enabled auto-merge (squash) March 25, 2026 21:46
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae seonghobae merged commit af6a731 into develop Mar 25, 2026
21 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.

[Level 2] 섹션/폼/큐 앵커 추출 파이프라인 구현

1 participant