Skip to content

링크 유효 검증 추가#67

Merged
reddevilmidzy merged 3 commits intorookfrom
test-url
May 19, 2025
Merged

링크 유효 검증 추가#67
reddevilmidzy merged 3 commits intorookfrom
test-url

Conversation

@reddevilmidzy
Copy link
Owner

♟️ What’s this PR about?

github repository struct를 정의하여 요청 파라미터의 검증 로직을 추가하였고 테스트도 추가하였습니다.

🔗 Related Issues / PRs

part of #54

Copilot AI review requested due to automatic review settings May 19, 2025 09:57
@vercel
Copy link

vercel bot commented May 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
v0-queensac ❌ Failed (Inspect) May 19, 2025 10:01am

@reddevilmidzy reddevilmidzy added test Adding or improving or fixing tests and removed test Adding or improving or fixing tests labels May 19, 2025
@reddevilmidzy reddevilmidzy changed the title 테스트 추가 링크 유효 검증 추가 May 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances request parameter validation by introducing a RepositoryURL type and updates associated handlers, plus it adds tests to verify URL deserialization logic.

  • Switched from raw String URLs to a RepositoryURL struct with built-in validation.
  • Implemented custom Deserialize for RepositoryURL and its validate method.
  • Added unit tests for valid/invalid GitHub URLs and updated link validation tests.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
rook/src/main.rs Replaced repo_url: String with RepositoryURL, implemented deserialization and validation.
rook/src/main_test.rs Added comprehensive tests for RepositoryURL deserialization covering valid and invalid cases.
rook/src/link/mod.rs Updated existing link test input from .com to .ai and maintained invalid-check test.
Comments suppressed due to low confidence (1)

rook/src/link/mod.rs:42

  • Consider adding a complementary test case for a valid link scenario to ensure check_link correctly accepts valid URLs.
let link = "https://redddy.ai";

rook/src/main.rs Outdated
Comment on lines 81 to 86
if !self.url.starts_with("https://github.com/") {
return Err("URL must start with https://github.com/".to_string());
}
let parts: Vec<&str> = self
.url
.trim_start_matches("https://github.com/")
Copy link

Copilot AI May 19, 2025

Choose a reason for hiding this comment

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

Consider extracting the GitHub URL prefix "https://github.com/" into a constant to avoid magic strings and improve maintainability.

Suggested change
if !self.url.starts_with("https://github.com/") {
return Err("URL must start with https://github.com/".to_string());
}
let parts: Vec<&str> = self
.url
.trim_start_matches("https://github.com/")
if !self.url.starts_with(GITHUB_URL_PREFIX) {
return Err(format!("URL must start with {}", GITHUB_URL_PREFIX));
}
let parts: Vec<&str> = self
.url
.trim_start_matches(GITHUB_URL_PREFIX)

Copilot uses AI. Check for mistakes.
@reddevilmidzy
Copy link
Owner Author

아 버셀 너무 어려운데 ㅠ 왜 여서 돌아감,,

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link

?? Blunder 😵‍💫
Your CI made a critical mistake on the board.

❌ Failure Details

=== Formatting Log ===
Diff in /home/runner/work/queensac/queensac/rook/src/main.rs:60:
 }
 
 /// Represents a GitHub repository URL.
-/// 
+///
 /// This struct ensures that the URL is valid and follows the format
 /// `https://github.com/{owner}/{repo_name}`. It includes validation logic
 /// to enforce this format.

See the full battle logs here: View Logs

Time to rethink your next move!

@reddevilmidzy reddevilmidzy requested a review from Copilot May 19, 2025 10:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds URL validation for GitHub repository links by introducing a RepositoryURL struct with custom deserialization logic and accompanying tests. Key changes include:

  • Changing request parameters from a plain URL string to a validated RepositoryURL object.
  • Updating the check and cancel handlers to use the new RepositoryURL.
  • Adding tests to ensure proper URL validation.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
rook/src/main_test.rs New tests added to verify repository URL deserialization and validation.
rook/src/main.rs Updated request types and handler functions to use RepositoryURL with validation logic.
rook/src/link/mod.rs Updated test data for link validation.

@reddevilmidzy reddevilmidzy merged commit 90e013e into rook May 19, 2025
2 checks passed
@reddevilmidzy reddevilmidzy deleted the test-url branch May 19, 2025 10:09
@reddevilmidzy reddevilmidzy mentioned this pull request May 19, 2025
4 tasks
@reddevilmidzy reddevilmidzy added this to the 2차 MVP 구현 milestone Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants