Skip to content

[Feat] weekly plan 드릴 cross-day 중복 제거#75

Merged
zweadfx merged 4 commits intomainfrom
feat/weekly-drill-dedup
Mar 18, 2026
Merged

[Feat] weekly plan 드릴 cross-day 중복 제거#75
zweadfx merged 4 commits intomainfrom
feat/weekly-drill-dedup

Conversation

@zweadfx
Copy link
Copy Markdown
Owner

@zweadfx zweadfx commented Mar 18, 2026

어떤 변경사항인가요?

Weekly Coach Agent의 retrieve_drills()에서 day별 독립 쿼리로 인한 cross-day 드릴 중복 문제를 해결합니다. used_drill_ids set으로 이미 배치된 드릴을 추적하고 fresh 드릴을 우선 배치하여 주간 플랜의 드릴 다양성을 높입니다.

작업 상세 내용

  • retrieve_drills()used_drill_ids: set[str] 추적 set 추가
  • day 순회를 sorted(week_plan.keys(), key=int)로 변경하여 day 1부터 드릴 선점
  • 드릴 수집 후 fresh/reused 분리 — fresh 우선 배치, 카테고리 풀 소진 시 reused graceful 허용
  • day 루프 후 다양성 메트릭 로깅 (unique / total, %)
  • 기존 테스트 통과 확인 (14/14 passed)

체크리스트

  • self-test를 수행하였는가?
  • 관련 문서나 주석을 업데이트하였는가?
  • 설정한 코딩 컨벤션을 준수하였는가?

관련 이슈

리뷰 포인트

  • fresh + reused 순서로 합치는 방식이 LLM 프롬프트 활용에 적절한지
  • 카테고리 풀 소진 시 reused를 허용하는 graceful 전략이 적절한지 (카테고리당 11~13개, n_results=10)

참고사항 및 스크린샷(선택)

  • 수정 파일: src/services/agents/weekly_coach_agent.py (retrieve_drills() 함수만 변경)
  • DB 레이어(chroma_db.py), 스키마(weekly_schema.py), LLM 프롬프트 변경 없음

Summary by CodeRabbit

  • Bug Fixes

    • Improved drill selection to prevent repetitive exercises within the weekly planning cycle.
    • Enhanced drill diversity tracking across multiple days.
    • Standardized the sequence of daily drill retrieval for consistency.
  • Improvements

    • Better logging to show fresh versus reused drill distribution and overall uniqueness metrics.

@zweadfx zweadfx self-assigned this Mar 18, 2026
@zweadfx zweadfx added the feature 새로운 기능 구현 시 사용합니다. label Mar 18, 2026
@zweadfx zweadfx linked an issue Mar 18, 2026 that may be closed by this pull request
5 tasks
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 18, 2026

📝 Walkthrough

Walkthrough

Modified retrieve_drills function in the weekly coach agent to implement cross-day drill deduplication. Tracks used drill IDs across the planning horizon, separates fresh drills from reused ones per day, sorts day iteration numerically, and logs diversity metrics including a global uniqueness ratio.

Changes

Cohort / File(s) Summary
Drill Deduplication Logic
src/services/agents/weekly_coach_agent.py
Implemented per-day fresh vs. reused drill separation using cumulative used_drill_ids tracking. Added sorted day iteration, updated logging to show fresh/reused drill counts per day, and added global diversity ratio calculation across all collected drills.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Poem

🐰 The drills now dance in sorted grace,
With fresh and reused finding their place,
No repetition across the days,
Diversity blooms in countless ways! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: implementing cross-day deduplication for drills in the weekly plan, which directly matches the PR's core objective of fixing drill duplication.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/weekly-drill-dedup
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/services/agents/weekly_coach_agent.py`:
- Around line 203-208: The dedupe logic treats missing IDs ("unknown") as
identical, causing later unique drills to be marked reused; update the block
that builds fresh/reused/final_drills so that any drill with id == "unknown" is
never considered in reused and is not added to used_drill_ids — e.g., compute
fresh = [d for d in drills_for_day if d["id"] not in used_drill_ids or d["id"]
== "unknown"], reused = [d for d in drills_for_day if d["id"] in used_drill_ids
and d["id"] != "unknown"], set day_drills[day_key] = fresh + reused as before,
and call used_drill_ids.update(...) only with real ids (exclude "unknown");
apply these changes around the variables used_drill_ids, drills_for_day,
day_drills, and final_drills in weekly_coach_agent.py.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c34d03e9-ce85-4400-ad46-33da625715bd

📥 Commits

Reviewing files that changed from the base of the PR and between 5e13a04 and d8b2b07.

📒 Files selected for processing (1)
  • src/services/agents/weekly_coach_agent.py

@zweadfx zweadfx merged commit c4fb6bc into main Mar 18, 2026
2 checks passed
@zweadfx zweadfx deleted the feat/weekly-drill-dedup branch March 18, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 새로운 기능 구현 시 사용합니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] weekly plan 드릴 중복 제거 (cross-day deduplication)

1 participant