Skip to content

Conversation

@thezz9
Copy link
Collaborator

@thezz9 thezz9 commented Jul 2, 2025

깃 푸시 경로 수정 및 커밋 메세지 수정

Summary by CodeRabbit

  • 신규 기능

    • 문제 ID와 제목을 결합한 새로운 정보 표시 기능이 추가되었습니다.
  • 스타일

    • GitHub 커밋 메시지와 파일 경로에 문제 난이도, ID, 제목이 보다 명확하게 표시됩니다.

@thezz9 thezz9 self-assigned this Jul 2, 2025
@thezz9 thezz9 added the enhancement New feature or request label Jul 2, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 2, 2025

Walkthrough

GitHubPushRequestgetProblemInfo() 메서드가 추가되었고, 이를 활용하여 GitHub 관련 파일 경로와 커밋 메시지 구성 방식이 변경되었습니다. 기존에는 problemId만 사용하던 부분을 problemId. problemTitle 형식의 문자열로 대체하였습니다.

Changes

파일/경로 변경 요약
src/main/java/org/ezcode/codetest/application/submission/dto/request/github/GitHubPushRequest.java getProblemInfo() 메서드 추가
src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java
src/main/java/org/ezcode/codetest/infrastructure/github/GitHubContentBuilder.java
파일 경로 및 커밋 메시지 생성 시 getProblemInfo() 사용으로 변경

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 사용
Loading

Possibly related PRs

Suggested reviewers

  • NCookies
  • minjee2758

Poem

🐇
문제 번호와 제목이 한데 모여
파일 경로 따라 깡총깡총 뛰네
커밋 메시지도 더 똑똑해졌지!
깔끔한 코드, 깡총한 마음
오늘도 토끼는 기쁨에 춤추네
📝✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 151fcd0 and 6eb9b28.

📒 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: 커밋 메시지 구조화 개선 승인

커밋 메시지 포맷이 더 체계적으로 개선되었습니다. 난이도를 대괄호로 구분하고 문제 정보, 성능 지표를 명확하게 표시하는 구조가 좋습니다. 한국 사용자 대상 서비스 특성에 맞게 한국어로 작성된 것도 적절합니다.

Comment on lines +63 to +65
public String getProblemInfo() {
return problemId + ". " + problemTitle;
}
Copy link

@coderabbitai coderabbitai bot Jul 2, 2025

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.

Suggested change
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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

이건 확인했어 테스트로

Copy link

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)
Copy link

@coderabbitai coderabbitai bot Jul 2, 2025

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 java

Length of output: 3493


파일 경로 변경 시 호환성 주의

현재 GitHubContentBuilder.javaGitHubApiClient.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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

새로운 경로로 계속 이어지면 되는 겨~

Copy link

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.

@thezz9 thezz9 merged commit 3afa582 into dev Jul 2, 2025
2 checks passed
@thezz9 thezz9 deleted the refactor/git-push-path branch July 2, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants