-
Notifications
You must be signed in to change notification settings - Fork 3
refactor: 깃 푸시 경로 수정 및 커밋 메세지 수정 #132
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
Conversation
Walkthrough
Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant GitHubPushRequest
participant GitHubApiClient
participant GitHubContentBuilder
Client->>GitHubPushRequest: getProblemInfo()
GitHubPushRequest-->>Client: 반환 (problemId. problemTitle)
Client->>GitHubApiClient: fetchSourceBlobSha(req)
GitHubApiClient->>GitHubPushRequest: getProblemInfo()
GitHubApiClient-->>GitHub: 파일 경로에 problemInfo 사용
Client->>GitHubApiClient: createCommit(req)
GitHubApiClient->>GitHubPushRequest: getProblemInfo()
GitHubApiClient-->>GitHub: 커밋 메시지에 problemInfo 사용
Client->>GitHubContentBuilder: buildGitTreeEntriesFromMap(req)
GitHubContentBuilder->>GitHubPushRequest: getProblemInfo()
GitHubContentBuilder-->>GitHub: 파일 경로에 problemInfo 사용
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/java/org/ezcode/codetest/application/submission/dto/request/github/GitHubPushRequest.java(1 hunks)src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java(2 hunks)src/main/java/org/ezcode/codetest/infrastructure/github/GitHubContentBuilder.java(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:159-165
Timestamp: 2025-06-28T02:03:38.693Z
Learning: User thezz9's service (ezcode) targets Korean users exclusively ("찐 한국인밖에 안 옴"), so Korean language hardcoding in commit messages and UI elements is intentional and appropriate for their use case.
Learnt from: chat26666
PR: ezcode-my/backend#37
File: src/main/java/org/ezcode/codetest/infrastructure/elasticsearch/repository/ProblemElasticsearchRepositoryDsl.java:10-10
Timestamp: 2025-06-06T19:56:27.759Z
Learning: When user chat26666 mentions that code was implemented in a previous PR but explanation was missing, they may submit a follow-up PR just to add documentation/explanation without the actual implementation code.
Learnt from: thezz9
PR: ezcode-my/backend#75
File: src/main/java/org/ezcode/codetest/application/submission/aop/CodeReviewLockAspect.java:25-41
Timestamp: 2025-06-19T06:37:57.845Z
Learning: User thezz9 tends to skip validation for scenarios they consider unlikely to occur, but is willing to implement defensive programming practices when suggested for code robustness.
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:93-96
Timestamp: 2025-06-28T02:04:24.957Z
Learning: User thezz9 sometimes temporarily uses less secure or inconsistent exception handling (like RuntimeException with raw error bodies) for debugging purposes when error messages are being hidden in the normal application flow, but acknowledges this as technical debt and fixes it once debugging is complete.
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (2)
src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java (2)
46-46: GitHubContentBuilder와 일관성 유지 확인
GitHubContentBuilder.buildGitTreeEntriesFromMap에서와 동일하게req.getProblemInfo()를 사용하여 경로 구성의 일관성이 유지되었습니다. 좋은 변경사항입니다.단, 앞서 언급한 파일 경로의 특수 문자 및 길이 제한 문제는 여전히 적용됩니다.
155-161: 커밋 메시지 구조화 개선 승인커밋 메시지 포맷이 더 체계적으로 개선되었습니다. 난이도를 대괄호로 구분하고 문제 정보, 성능 지표를 명확하게 표시하는 구조가 좋습니다. 한국 사용자 대상 서비스 특성에 맞게 한국어로 작성된 것도 적절합니다.
| public String getProblemInfo() { | ||
| return problemId + ". " + problemTitle; | ||
| } |
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.
🛠️ Refactor suggestion
파일 경로 사용 시 문제 제목 검증 필요
getProblemInfo() 메서드가 파일 경로 구성에 사용되는데, 문제 제목에 파일 시스템에서 허용되지 않는 특수 문자(/, \, :, *, ?, ", <, >, |)가 포함될 수 있습니다. 또한 경로 길이 제한을 초과할 가능성도 있습니다.
파일 경로용 안전한 문자열을 반환하는 별도 메서드를 추가하거나, 이 메서드에서 문자 치환/제한을 고려해보세요.
public String getProblemInfo() {
- return problemId + ". " + problemTitle;
+ return problemId + ". " + sanitizeForPath(problemTitle);
+}
+
+private String sanitizeForPath(String title) {
+ return title.replaceAll("[/\\\\:*?\"<>|]", "_")
+ .substring(0, Math.min(title.length(), 50));
}📝 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.
| public String getProblemInfo() { | |
| return problemId + ". " + problemTitle; | |
| } | |
| public String getProblemInfo() { | |
| return problemId + ". " + sanitizeForPath(problemTitle); | |
| } | |
| private String sanitizeForPath(String title) { | |
| return title | |
| .replaceAll("[/\\\\:*?\"<>|]", "_") | |
| .substring(0, Math.min(title.length(), 50)); | |
| } |
🤖 Prompt for AI Agents
In
src/main/java/org/ezcode/codetest/application/submission/dto/request/github/GitHubPushRequest.java
around lines 63 to 65, the getProblemInfo() method returns a string combining
problemId and problemTitle, which is used in file paths but does not sanitize or
validate the problemTitle. To fix this, create a new method that returns a
file-system-safe version of the problem info by replacing or removing invalid
characters such as / \ : * ? " < > | and ensure the resulting string respects
typical path length limits. Use this sanitized string for file path construction
instead of the current getProblemInfo() output.
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.
이건 확인했어 테스트로
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.
@thezz9 네, 테스트로 확인하셨다니 다행입니다! 현재 구현이 실제 사용 환경에서 잘 동작하고 있다면 문제없겠네요.
혹시 나중에 특수 문자가 포함된 문제 제목으로 인한 파일 경로 이슈가 발생한다면 그때 고려해보시면 될 것 같습니다.
🧠 Learnings used
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:159-165
Timestamp: 2025-06-28T02:03:38.693Z
Learning: User thezz9's service (ezcode) targets Korean users exclusively ("찐 한국인밖에 안 옴"), so Korean language hardcoding in commit messages and UI elements is intentional and appropriate for their use case.
Learnt from: thezz9
PR: ezcode-my/backend#75
File: src/main/java/org/ezcode/codetest/application/submission/aop/CodeReviewLockAspect.java:25-41
Timestamp: 2025-06-19T06:37:57.845Z
Learning: User thezz9 tends to skip validation for scenarios they consider unlikely to occur, but is willing to implement defensive programming practices when suggested for code robustness.
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:93-96
Timestamp: 2025-06-28T02:04:24.957Z
Learning: User thezz9 sometimes temporarily uses less secure or inconsistent exception handling (like RuntimeException with raw error bodies) for debugging purposes when error messages are being hidden in the normal application flow, but acknowledges this as technical debt and fixes it once debugging is complete.
Learnt from: chat26666
PR: ezcode-my/backend#37
File: src/main/java/org/ezcode/codetest/infrastructure/elasticsearch/repository/ProblemElasticsearchRepositoryDsl.java:10-10
Timestamp: 2025-06-06T19:56:27.759Z
Learning: When user chat26666 mentions that code was implemented in a previous PR but explanation was missing, they may submit a follow-up PR just to add documentation/explanation without the actual implementation code.
| FileType fileType = FileType.valueOf(s); | ||
| String path = String.format("%s/%s/%s/%s", | ||
| repoRootFolder, req.difficulty(), req.problemId(), fileType.resolveFilename(req) | ||
| repoRootFolder, req.difficulty(), req.getProblemInfo(), fileType.resolveFilename(req) |
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.
💡 Verification agent
🧩 Analysis chain
기존 레포지토리 구조와의 호환성 문제
파일 경로에 문제 제목을 포함시키는 변경으로 인해 기존 폴더 구조가 깨질 수 있습니다. 기존 문제ID 폴더와 새로운 문제ID. 문제제목 폴더가 공존하게 되어 일관성 문제가 발생할 수 있습니다.
GitHubApiClient.fetchSourceBlobSha 메서드에서도 동일한 경로 구성 방식을 사용하는지 확인하고, 기존 파일을 찾지 못하는 문제가 없는지 검토가 필요합니다.
다음 스크립트로 경로 구성의 일관성을 확인해보세요:
🏁 Script executed:
#!/bin/bash
# GitHubApiClient에서 동일한 경로 구성을 사용하는지 확인
rg -A 3 -B 3 "req\.getProblemInfo\(\)" --type java
rg -A 3 -B 3 "req\.problemId\(\)" --type javaLength of output: 3493
파일 경로 변경 시 호환성 주의
현재 GitHubContentBuilder.java와 GitHubApiClient.java 모두
String.format("%s/%s/%s/%s", repoRootFolder, req.difficulty(), req.getProblemInfo(), …) 형태로
난이도/문제ID.문제제목/파일명 경로를 생성하여 내부 구현은 일관적입니다.
하지만 기존에 난이도/문제ID/파일명 구조로 저장된 레포지토리와는 호환되지 않아,
변경 후에는 파일을 찾지 못하는 문제가 발생할 수 있습니다.
– 검토 사항
• 기존 레포지토리 마이그레이션 방안 마련 (디렉터리명을 일괄 변경 스크립트 제공 등)
• 이전 구조를 임시로 지원하는 로직 추가 검토
• 문서 또는 릴리스 노트에 경로 구조 변경 안내 포함
🤖 Prompt for AI Agents
In
src/main/java/org/ezcode/codetest/infrastructure/github/GitHubContentBuilder.java
at line 72, the file path format was changed to include the problem title in the
directory structure, which breaks compatibility with existing repositories using
the old path format. To fix this, implement a migration strategy such as
providing a script to rename existing directories, add temporary support in the
code to handle both old and new path formats when locating files, and update
documentation or release notes to clearly communicate the path structure change
to users.
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.
새로운 경로로 계속 이어지면 되는 겨~
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.
@thezz9 네, 알겠습니다! 새로운 경로 구조로 진행하시는 것으로 이해했습니다.
기존 호환성 문제에 대한 우려는 접어두고, 난이도/문제ID.문제제목/파일명 형태의 새로운 경로 구조로 깔끔하게 정리되겠네요. 👍
✏️ Learnings added
Learnt from: thezz9
PR: ezcode-my/backend#132
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubContentBuilder.java:72-72
Timestamp: 2025-07-02T09:39:31.475Z
Learning: User thezz9 prefers to proceed with breaking changes to path structures when it improves the organization, rather than maintaining backward compatibility or implementing migration strategies.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: thezz9
PR: ezcode-my/backend#75
File: src/main/java/org/ezcode/codetest/application/submission/aop/CodeReviewLockAspect.java:25-41
Timestamp: 2025-06-19T06:37:57.845Z
Learning: User thezz9 tends to skip validation for scenarios they consider unlikely to occur, but is willing to implement defensive programming practices when suggested for code robustness.
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:93-96
Timestamp: 2025-06-28T02:04:24.957Z
Learning: User thezz9 sometimes temporarily uses less secure or inconsistent exception handling (like RuntimeException with raw error bodies) for debugging purposes when error messages are being hidden in the normal application flow, but acknowledges this as technical debt and fixes it once debugging is complete.
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:159-165
Timestamp: 2025-06-28T02:03:38.693Z
Learning: User thezz9's service (ezcode) targets Korean users exclusively ("찐 한국인밖에 안 옴"), so Korean language hardcoding in commit messages and UI elements is intentional and appropriate for their use case.
Learnt from: chat26666
PR: ezcode-my/backend#37
File: src/main/java/org/ezcode/codetest/infrastructure/elasticsearch/repository/ProblemElasticsearchRepositoryDsl.java:10-10
Timestamp: 2025-06-06T19:56:27.759Z
Learning: When user chat26666 mentions that code was implemented in a previous PR but explanation was missing, they may submit a follow-up PR just to add documentation/explanation without the actual implementation code.
깃 푸시 경로 수정 및 커밋 메세지 수정
Summary by CodeRabbit
신규 기능
스타일