-
Notifications
You must be signed in to change notification settings - Fork 44
Round 10 #414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: APapeIsName
Are you sure you want to change the base?
Round 10 #414
Changes from all commits
e08485a
dba0068
40446f9
b587008
01d2678
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.loopers.domain.ranking; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| public record DailyMetricSnapshot( | ||
| LocalDate date, | ||
| long viewCount, | ||
| long likesCount, | ||
| long salesCount | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,4 +11,6 @@ public interface ProductMetricsDailyRepository extends JpaRepository<ProductMetr | |
| Optional<ProductMetricsDaily> findByProductIdAndDate(Long productId, LocalDate date); | ||
|
|
||
| List<ProductMetricsDaily> findByDate(LocalDate date); | ||
|
|
||
| List<ProductMetricsDaily> findByDateBetween(LocalDate startDate, LocalDate endDate); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐งฉ Analysis chain๐ Script executed: #!/bin/bash
rg -nP -C3 'findByDateBetween\s*\('Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 2883 ๐ Script executed: # Verify the exact startDate and endDate calculations in the callers
cat -n presentation/commerce-batch/src/main/java/com/loopers/batch/job/ranking/WeeklyRankingJobConfig.java | sed -n '100,115p'Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 973 ๐ Script executed: # Check MonthlyRankingJobConfig for the same pattern
cat -n presentation/commerce-batch/src/main/java/com/loopers/batch/job/ranking/MonthlyRankingJobConfig.java | sed -n '100,115p'Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 976 ๐ Script executed: # Find the ProductMetricsDaily entity definition to check for indexing
fd -t f 'ProductMetricsDaily\.java' -x cat -n {}Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 2154 ๐ Script executed: # Check if there are any index annotations or SQL `@Index` definitions
rg -n '@Index|@Column.*index' infrastructure/jpa/src/main/java/com/loopers/infrastructure/metrics/ProductMetricsDaily.javaRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 67 ๐ Script executed: # Check for any streaming or pagination-based approaches in batch jobs
rg -n 'Stream|Page|Pageable' presentation/commerce-batch/src/main/java/com/loopers/batch/job/ranking/Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 67 ๐ Script executed: # Find WINDOW_DAYS constant values
rg -n 'WINDOW_DAYS\s*=' presentation/commerce-batch/src/main/java/com/loopers/batch/job/ranking/Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 384 ๐ Script executed: # Check for database migration scripts/schema definitions
fd -t f -e 'sql' -e 'yml' -e 'yaml' | grep -i migrationRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 67 ๐ Script executed: # Search for any index definitions in migration or schema files
rg -n 'CREATE.*INDEX.*product_metrics_daily|product_metrics_daily.*INDEX' --type sql --type yamlRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 67 ๐ Script executed: # Check the complete ProductMetricsDailyRepository interface
cat -n infrastructure/jpa/src/main/java/com/loopers/infrastructure/metrics/ProductMetricsDailyRepository.javaRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 723
์ด์ ๊ด์ ์์ ๋ค์ ๋ ๊ฐ์ง๋ฅผ ๊ฐ์ ํด์ผ ํ๋ค.
์ถ๊ฐ ํ ์คํธ ์ ์: ๊ฒฝ๊ณ๊ฐ(startDate == endDate, startDate > endDate) ๋ฐ ๋น ๊ฒฐ๊ณผ ์ผ์ด์ค๋ฅผ ๋ฆฌํฌ์งํ ๋ฆฌ ์ฌ๋ผ์ด์ค ํ ์คํธ์ ํฌํจํ๋ค. ๐ค Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package com.loopers.infrastructure.ranking; | ||
|
|
||
| import com.loopers.domain.BaseTimeEntity; | ||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.Index; | ||
| import jakarta.persistence.Table; | ||
| import jakarta.persistence.UniqueConstraint; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| @Entity | ||
| @Table(name = "mv_product_rank_monthly", | ||
| uniqueConstraints = @UniqueConstraint(columnNames = {"productId", "calculatedDate"}), | ||
| indexes = @Index(name = "idx_monthly_calculated_date", columnList = "calculatedDate")) | ||
|
Comment on lines
+16
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐งฉ Analysis chain๐ Script executed: #!/bin/bash
# 1) ์ค์ DB ๋ง์ด๊ทธ๋ ์ด์
/์คํค๋ง ํ์ผ์์ mv_product_rank_monthly ์ ์ ๋ฐ ์ปฌ๋ผ๋ช
ํ์ธ
fd -e sql -e xml -e yaml -e yml | xargs rg -nP -C2 'mv_product_rank_(weekly|monthly)' 2>/dev/null
# 2) ๋ค์ด๋ฐ ์ ๋ต ์ค์ ํ์ธ (physical-strategy / implicit-strategy)
rg -nP 'physical-strategy|implicit-strategy|PhysicalNamingStrategy|ImplicitNamingStrategy' -g '*.yml' -g '*.yaml' -g '*.properties' -g '*.java'
# 3) ๊ธฐ์กด MV ๋๋ ์ ์ฌ ์ํฐํฐ์์ uniqueConstraints/indexes ์ปฌ๋ผ๋ช
์ด ์ด๋ป๊ฒ ์ฐ์๋์ง ์ฌ๋ก ๋น๊ต
ast-grep --pattern '@Table(name = $_, uniqueConstraints = $$$)'
rg -nP '@UniqueConstraint\(columnNames' -g '*.java' -C1
rg -nP '@Index\([^)]*columnList' -g '*.java' -C1Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 3773 ๐ Script executed: # 1) MvProductRankMonthly ์ํฐํฐ ํ๋ ์ ์ ๋ฐ `@Column` ์ด๋
ธํ
์ด์
ํ์ธ
cat -n infrastructure/jpa/src/main/java/com/loopers/infrastructure/ranking/MvProductRankMonthly.java
# 2) MvProductRankWeekly ์ํฐํฐ ํ๋ ์ ์ ํ์ธ
cat -n infrastructure/jpa/src/main/java/com/loopers/infrastructure/ranking/MvProductRankWeekly.java
# 3) DB ๋ง์ด๊ทธ๋ ์ด์
ํ์ผ์์ mv_product_rank_monthly ํ
์ด๋ธ ์ ์ ๊ฒ์
find . -type f \( -name "*.sql" -o -name "*.xml" \) | xargs grep -l "mv_product_rank_monthly" 2>/dev/null | head -5
# 4) ๋ง์ด๊ทธ๋ ์ด์
ํ์ผ ๋ด์ฉ ํ์ธ (์ปฌ๋ผ๋ช
ํ์
)
find . -type f -name "*.sql" | xargs grep -A 10 "CREATE.*mv_product_rank_monthly" 2>/dev/nullRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 4188 ๐ Script executed: # DB ๋ง์ด๊ทธ๋ ์ด์
ํ์ผ ์์น ๋ฐ ํ์ ํ์
find . -type f \( -name "*.sql" -o -name "*migration*" -o -name "*schema*" \) | head -20
# mv_product_rank ๊ด๋ จ ํ์ผ ๊ฒ์
find . -type f -name "*.sql" | xargs grep -l "mv_product_rank" 2>/dev/null
# ๋ง์ด๊ทธ๋ ์ด์
๋๋ ํ ๋ฆฌ ๊ตฌ์กฐ ํ์ธ
find . -type d -name "*migration*" -o -name "*flyway*" -o -name "*liquibase*" 2>/dev/null | head -10
# ProductMetricsHourly, ProductMetricsDaily ์ํฐํฐ๋ ๋์ผ ํจํด์ธ์ง ํ์ธ (ํ๋๋ช
๊ณผ `@Column`)
sed -n '15,40p' infrastructure/jpa/src/main/java/com/loopers/infrastructure/metrics/ProductMetricsHourly.java
sed -n '15,40p' infrastructure/jpa/src/main/java/com/loopers/infrastructure/metrics/ProductMetricsDaily.javaRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 1558 ๐ Script executed: # constraint.sql ์ ์ฒด ๋ด์ฉ
cat docs/sql/constraint.sql
# index.sql ์ ์ฒด ๋ด์ฉ
cat docs/sql/index.sql
# mv_product_rank_monthly ๊ด๋ จ ๋ถ๋ถ๋ง ์ถ์ถ
grep -A 5 -B 5 "mv_product_rank_monthly" docs/sql/constraint.sql docs/sql/index.sql 2>/dev/nullRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 1407 ๐ Script executed: # constraint.sql, index.sql ์ ์ฒด ๋ผ์ธ ์ ํ์ธ
wc -l docs/sql/constraint.sql docs/sql/index.sql
# ๋ชจ๋ SQL ํ์ผ์์ mv_product_rank ๊ฒ์
find . -type f -name "*.sql" -exec grep -l "mv_product_rank" {} \;
# ๋ชจ๋ SQL ํ์ผ ๋ชฉ๋ก ๋ฐ ๋ผ์ธ ์
find . -type f -name "*.sql" | xargs wc -l | sort -n
# ํ
์ด๋ธ ์์ฑ ๊ด๋ จ SQL ํ์ผ ์ฐพ๊ธฐ
find . -type f -name "*.sql" | xargs grep -l "CREATE TABLE" | head -10Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 241 ๐ Script executed: # seed.sql๋ ํ์ธ (ํ
์ด๋ธ ์์ฑ ๊ฐ๋ฅ์ฑ)
cat docs/sql/seed.sql
# ProductMetricsHourly ์ ์ฒด ์ฝ๋
cat infrastructure/jpa/src/main/java/com/loopers/infrastructure/metrics/ProductMetricsHourly.java
# ProductMetricsDaily ์ ์ฒด ์ฝ๋
cat infrastructure/jpa/src/main/java/com/loopers/infrastructure/metrics/ProductMetricsDaily.javaRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 5510 ๐ Script executed: # application ์ค์ ํ์ผ ์ฐพ๊ธฐ
find . -type f \( -name "application*.yml" -o -name "application*.yaml" -o -name "application*.properties" \)
# ๋ค์ด๋ฐ ์ ๋ต ์ค์ ํ์ธ
rg -nP 'physical-naming-strategy|implicit-naming-strategy|hibernate.*naming|ddl-auto' -g '*.yml' -g '*.yaml' -g '*.properties'
# application.yml ๋ด์ฉ (์์ผ๋ฉด ์ ์ฒด ํ์ธ)
find . -type f -name "application*.yml" -o -name "application*.yaml" | head -1 | xargs cat 2>/dev/nullRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 1625 ๐ Script executed: # jpa.yml ์ ์ฒด ๋ด์ฉ
cat infrastructure/jpa/src/main/resources/jpa.yml
# ๋ค์ด๋ฐ ์ ๋ต ๊ด๋ จ ๋ ๊ตฌ์ฒด์ ๊ฒ์
rg -nP 'naming-strategy|PhysicalNamingStrategy|ImplicitNamingStrategy' --type java --type ymlRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java Length of output: 2277 @UniqueConstraint/indexes ์ปฌ๋ผ๋ช ์ด ์ค์ DB ์ปฌ๋ผ๋ช ๊ณผ ๋ถ์ผ์นํ๋ค. Spring Boot ๊ธฐ๋ณธ ๋ค์ด๋ฐ ์ ๋ต(
์์ ๋ฐฉ๋ฒ `@Entity`
`@Table`(name = "mv_product_rank_monthly",
- uniqueConstraints = `@UniqueConstraint`(columnNames = {"productId", "calculatedDate"}),
- indexes = `@Index`(name = "idx_monthly_calculated_date", columnList = "calculatedDate"))
+ uniqueConstraints = `@UniqueConstraint`(columnNames = {"product_id", "calculated_date"}),
+ indexes = `@Index`(name = "idx_monthly_calculated_date", columnList = "product_id", "calculated_date"))๋๋ ๋ชจ๋ ํ๋์ ๋์ผ ๋ฌธ์ ๊ฐ ๐ค Prompt for AI Agents |
||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class MvProductRankMonthly extends BaseTimeEntity { | ||
|
|
||
| @Column(nullable = false) | ||
| private Long productId; | ||
|
|
||
| @Column(nullable = false) | ||
| private long viewCount; | ||
|
|
||
| @Column(nullable = false) | ||
| private long likesCount; | ||
|
|
||
| @Column(nullable = false) | ||
| private long salesCount; | ||
|
|
||
| @Column(nullable = false) | ||
| private LocalDate calculatedDate; | ||
|
|
||
| private MvProductRankMonthly(Long productId, long viewCount, long likesCount, | ||
| long salesCount, LocalDate calculatedDate) { | ||
| this.productId = productId; | ||
| this.viewCount = viewCount; | ||
| this.likesCount = likesCount; | ||
| this.salesCount = salesCount; | ||
| this.calculatedDate = calculatedDate; | ||
| } | ||
|
|
||
| public static MvProductRankMonthly of(Long productId, long viewCount, long likesCount, | ||
| long salesCount, LocalDate calculatedDate) { | ||
| return new MvProductRankMonthly(productId, viewCount, likesCount, salesCount, calculatedDate); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package com.loopers.infrastructure.ranking; | ||
|
|
||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.data.jpa.repository.Modifying; | ||
| import org.springframework.data.jpa.repository.Query; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| public interface MvProductRankMonthlyRepository extends JpaRepository<MvProductRankMonthly, Long> { | ||
|
|
||
| List<MvProductRankMonthly> findByCalculatedDate(LocalDate calculatedDate); | ||
|
|
||
| @Modifying | ||
| @Query("DELETE FROM MvProductRankMonthly m WHERE m.calculatedDate = :calculatedDate") | ||
| void deleteByCalculatedDate(LocalDate calculatedDate); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package com.loopers.infrastructure.ranking; | ||
|
|
||
| import com.loopers.domain.BaseTimeEntity; | ||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.Index; | ||
| import jakarta.persistence.Table; | ||
| import jakarta.persistence.UniqueConstraint; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| @Entity | ||
| @Table(name = "mv_product_rank_weekly", | ||
| uniqueConstraints = @UniqueConstraint(columnNames = {"productId", "calculatedDate"}), | ||
| indexes = @Index(name = "idx_weekly_calculated_date", columnList = "calculatedDate")) | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class MvProductRankWeekly extends BaseTimeEntity { | ||
|
|
||
| @Column(nullable = false) | ||
| private Long productId; | ||
|
|
||
| @Column(nullable = false) | ||
| private long viewCount; | ||
|
|
||
| @Column(nullable = false) | ||
| private long likesCount; | ||
|
|
||
| @Column(nullable = false) | ||
| private long salesCount; | ||
|
|
||
| @Column(nullable = false) | ||
| private LocalDate calculatedDate; | ||
|
|
||
| private MvProductRankWeekly(Long productId, long viewCount, long likesCount, | ||
| long salesCount, LocalDate calculatedDate) { | ||
| this.productId = productId; | ||
| this.viewCount = viewCount; | ||
| this.likesCount = likesCount; | ||
| this.salesCount = salesCount; | ||
| this.calculatedDate = calculatedDate; | ||
| } | ||
|
|
||
| public static MvProductRankWeekly of(Long productId, long viewCount, long likesCount, | ||
| long salesCount, LocalDate calculatedDate) { | ||
| return new MvProductRankWeekly(productId, viewCount, likesCount, salesCount, calculatedDate); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package com.loopers.infrastructure.ranking; | ||
|
|
||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.data.jpa.repository.Modifying; | ||
| import org.springframework.data.jpa.repository.Query; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| public interface MvProductRankWeeklyRepository extends JpaRepository<MvProductRankWeekly, Long> { | ||
|
|
||
| List<MvProductRankWeekly> findByCalculatedDate(LocalDate calculatedDate); | ||
|
|
||
| @Modifying | ||
| @Query("DELETE FROM MvProductRankWeekly m WHERE m.calculatedDate = :calculatedDate") | ||
| void deleteByCalculatedDate(LocalDate calculatedDate); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| api.version=1.44 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| api.version=1.44 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ถ๋์์์ ๋๋ฑ ๋น๊ต๋ ํ๋ํค ์ํ์ด ์์ด ์คํ์ ๋น๊ต๋ก ์ ํํด์ผ ํ๋ค.
calculateWithDecay๊ฐ ๋ด๋ถ์์Math.pow(0.85, daysAgo)์log10์กฐํฉ์ ์ฌ์ฉํ๋ค๋ฉด, ํฉ์ฐ ์์์ ์ต์ ํ์ ๋ฐ๋ผcombined๊ณผscore1 + score2๊ฐ ๋นํธ ๋จ์๋ก ์ผ์นํ์ง ์์ ์ ์๋ค. ์ด์ ๊ด์ ์์ CI์์ ๊ฐํ์ ์คํจ๊ฐ ๋ฐ์ํ๋ฉด ๋ฐฐ์น/๋๋ฉ์ธ ํ๊ท ๊ฐ์ง ์ ๋ขฐ๋๊ฐ ๋จ์ด์ง๋ค.isCloseTo(expected, within(1e-9))๋ก ์ ํ์ ๊ถ๊ณ ํ๋ค.์ ์ ์์ ์
์ถ๊ฐ ํ ์คํธ ์ ์: (1)
daysAgo == 0(today ๋ณธ์ธ)์ผ ๋ ๊ฐ์ ๊ณ์ 1.0์ด ์ ์ฉ๋๋์ง, (2) ์๋๋ณด๋ค ์ค๋๋ ๋ ์ง๊ฐ ์์์ ๋์ ๊ธฐ๋ ๋์(์ ์ธ vs ํฌํจ), (3)date๊ฐtoday๋ณด๋ค ๋ฏธ๋์ธ ๊ฒฝ์ฐ์ ์ ์ฑ ์ ๊ฐ๊ฐ ๋ช ์ํ ํ ์คํธ๋ฅผ ์ถ๊ฐํ์ฌ ๋ฐฐ์น ๊ฒฝ๊ณ ๋ฒ๊ทธ๋ฅผ ์ฌ์ ์ ๋๋ฌ๋ธ๋ค.๐ค Prompt for AI Agents