Skip to content

Comments

Fixed issue #1035 Correct redirection and Links have valid URLs.#1071

Merged
arkid15r merged 6 commits intoOWASP:mainfrom
KaranNegi20Feb:fix/linking-version
Mar 11, 2025
Merged

Fixed issue #1035 Correct redirection and Links have valid URLs.#1071
arkid15r merged 6 commits intoOWASP:mainfrom
KaranNegi20Feb:fix/linking-version

Conversation

@KaranNegi20Feb
Copy link
Contributor

@KaranNegi20Feb KaranNegi20Feb commented Mar 10, 2025

Fixes issue: #1035 Recent releases main page card links are broken.

Here is the fixed output:

Screen.Recording.2025-03-11.at.1.17.13.AM.mov

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2025

Summary by CodeRabbit

  • New Features
    • Release details now include additional author information, such as the author’s login.
    • Direct release URL links have been reintroduced, allowing easier navigation and access to detailed release data.

Walkthrough

The pull request updates both frontend GraphQL queries and backend GraphQL schema/model for releases. On the frontend, the GET_MAIN_PAGE_DATA query now includes the login field within the author object and reintroduces the url field in the recentReleases section. On the backend, a new url field with a resolver has been added to the ReleaseNode, a corresponding url property has been introduced in the Release model, and the tests have been updated to expect the new field.

Changes

File(s) Change Summary
frontend/.../homeQueries.ts In GET_MAIN_PAGE_DATA, added the login field to the author object and reintroduced the url field within the recentReleases section.
backend/.../nodes/release.py, backend/.../models/release.py, backend/.../release_test.py Added a new url field to ReleaseNode (with resolve_url resolver), introduced a url property in the Release model that constructs the release URL, and updated tests to include url in the expected fields.

Possibly related PRs

Suggested labels

docs

Suggested reviewers

  • kasya
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

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.

@KaranNegi20Feb KaranNegi20Feb marked this pull request as draft March 10, 2025 19:49
Copy link
Contributor

@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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31502e8 and 865215f.

📒 Files selected for processing (5)
  • frontend/src/api/queries/homeQueries.ts (1 hunks)
  • frontend/src/api/queries/projectQueries.ts (1 hunks)
  • frontend/src/components/ItemCardList.tsx (1 hunks)
  • frontend/src/components/RecentCardList.tsx (1 hunks)
  • frontend/src/pages/Home.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: Run backend tests
  • GitHub Check: Run frontend unit tests
  • GitHub Check: Run frontend e2e tests
🔇 Additional comments (8)
frontend/src/components/ItemCardList.tsx (1)

43-43: Approve UI enhancement with line break

Adding the line break after the item title improves readability by separating the title from subsequent content, creating a cleaner visual hierarchy.

frontend/src/pages/Home.tsx (1)

28-28: Approve migration to specialized component for Recent Releases

The introduction of RecentCardList component and its implementation in the Home page properly addresses the issue with recent release links. This component now specifically formats recent releases data with correctly structured GitHub URLs.

Also applies to: 229-244

frontend/src/components/RecentCardList.tsx (3)

1-58: Fix for broken release links implemented correctly

The new RecentCardList component properly constructs GitHub release URLs using repository owner, repository name, and tag name. This addresses issue #1035 by ensuring valid URLs for recent releases.


42-43: Consistent with ItemCardList rendering style

The line break after the item title maintains consistency with the ItemCardList component, which was modified with the same change.


39-39:

Details

❓ Verification inconclusive

Verify URL structure reliability

The URL construction relies on deeply nested optional chaining:

href={`https://github.com/${item?.author?.releases?.[0]?.repository?.ownerKey}/${item?.author?.releases?.[0]?.repository?.key}/releases/tag/${item.tagName}`}

While the optional chaining prevents errors, ensure this data structure is consistently available.


🏁 Script executed:

#!/bin/bash
# Check for the data structure expected by RecentCardList
echo "Checking Home query structure to verify releases data format..."
rg -A 10 "GET_MAIN_PAGE_DATA" --type ts

Length of output: 2388


Attention: Verify Nested Data Structure for GitHub Release URL

The URL construction

href={`https://github.com/${item?.author?.releases?.[0]?.repository?.ownerKey}/${item?.author?.releases?.[0]?.repository?.key}/releases/tag/${item.tagName}`}

assumes that nested data (i.e. an object at item.author.releases[0].repository) is always available. However, the output from the GET_MAIN_PAGE_DATA query does not include any fields related to releases, which suggests that this data might be coming from a different source or might not be as reliable as expected.

  • Review Data Source: Confirm whether the releases-related data is provided by another query or if it should be added to the existing GET_MAIN_PAGE_DATA response.
  • Fall-back Handling: Consider adding fallback logic or validations in case any of these nested properties are absent, to avoid constructing broken URLs.
  • Consistency Check: Verify that item.tagName is always defined as expected.

Please double-check the source of the item object to ensure that the nested structure used here can be reliably expected in all cases.

frontend/src/api/queries/homeQueries.ts (3)

47-47: Good enhancement to include author login field.

Adding the login field to the author object is a necessary improvement for generating proper links to the author's profile, which directly addresses the issue of broken links mentioned in PR #1035.


48-53: Essential repository data structure for proper URL formation.

Adding the nested releases.repository structure with key and ownerKey fields provides the necessary information to construct proper URLs for the repositories. This change is crucial for fixing the broken links in the recent releases main page card mentioned in issue #1035.


58-58:

Details

✅ Verification successful

Verify the correct usage of publishedAt field.

The addition of the publishedAt field will help display accurate publication timestamps for releases. Since the AI summary mentioned this field was previously removed but now appears added, please ensure this is consistent with the expected behavior and that related components are updated to reference this field correctly.


🏁 Script executed:

#!/bin/bash
# Check if related components reference publishedAt field
echo "Checking for components using publishedAt from recentReleases:"
rg -A 2 -B 2 "publishedAt" --glob "frontend/src/components/*.{tsx,jsx,ts,js}"
echo "Checking for usage in Home page:"
rg -A 2 -B 2 "publishedAt" --glob "frontend/src/pages/Home.{tsx,jsx,ts,js}"

Length of output: 2627


Ensure Consistent Integration of the publishedAt Field

The usage of the publishedAt field has been verified across related components:

  • ReleaseCard.tsx: The field is correctly used with a timestamp conversion (new Date(release.publishedAt * 1000).toLocaleDateString()).
  • Home.tsx: The publishedAt value is properly formatted using the formatDate function.
  • ItemCardList.tsx, RecentCardList.tsx, and CardDetailsPage.tsx: References to publishedAt are consistently implemented to display accurate publication timestamps.

Please confirm that the conversion logic and formatting meet the intended behavior as discussed in the AI summary. No discrepancies were found in the current implementation.

login
name
}
tagname
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Potential duplicate field in GraphQL query

The tagname field appears to be redundant since tagName (with camelCase) is already present at line 29. GraphQL field names are case-sensitive, so this might be unintentional.


🏁 Script executed:

#!/bin/bash
# Check if the GraphQL schema has both tagName and tagname fields
echo "Checking if GraphQL schema contains both tagName and tagname fields..."
grep -r "type.*Release" --include="*.graphql" --include="*.ts" .

# Check if the backend returns both fields
echo "Checking if both fields are being used in the codebase..."
rg "tagName|tagname" --type ts

Length of output: 3035


Action: Remove duplicate 'tagname' field from the GraphQL query

  • In frontend/src/api/queries/projectQueries.ts, the GraphQL query includes both tagName and tagname.
  • Our search confirms that everywhere else in the codebase (and in the type definitions) only tagName is used, and there’s no evidence that the lowercase tagname is intended.
  • Please remove the duplicate lowercase tagname entry to keep the query consistent and avoid unintended behavior due to case sensitivity.

@KaranNegi20Feb KaranNegi20Feb marked this pull request as ready for review March 10, 2025 20:06
@KaranNegi20Feb
Copy link
Contributor Author

Hey @arkid15r i have made all the links corrected in recent versions. Please review the changes. Thank you.

@sonarqubecloud
Copy link

@arkid15r arkid15r linked an issue Mar 11, 2025 that may be closed by this pull request
2 tasks
Copy link
Contributor

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

🧹 Nitpick comments (1)
backend/apps/github/graphql/nodes/release.py (1)

20-26: Consider updating the fields tuple in Meta

While the code works as is, the url field is defined at the class level but not included in the Meta fields tuple. For consistency and to make the code more maintainable, consider adding it there as well.

    fields = (
        "author",
        "is_pre_release",
        "name",
        "published_at",
        "tag_name",
+       "url",
    )
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb9d460 and 5630787.

📒 Files selected for processing (4)
  • backend/apps/github/graphql/nodes/release.py (2 hunks)
  • backend/apps/github/models/release.py (1 hunks)
  • backend/tests/github/graphql/nodes/release_test.py (1 hunks)
  • frontend/src/api/queries/homeQueries.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/api/queries/homeQueries.ts
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Run backend tests
  • GitHub Check: CodeQL (python)
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: Run frontend unit tests
🔇 Additional comments (4)
backend/tests/github/graphql/nodes/release_test.py (1)

28-28: Correctly updated the expected fields list to include the new url field

This update to the test case ensures that the new url field added to the ReleaseNode is properly tested, maintaining test coverage for the schema changes.

backend/apps/github/models/release.py (1)

53-57: Well implemented url property for the Release model

The implementation correctly constructs the release URL by combining the repository URL with the release tag name, following GitHub's URL structure for releases.

backend/apps/github/graphql/nodes/release.py (2)

16-16: Correctly added the url field to the ReleaseNode schema

This change properly exposes the new URL field through the GraphQL API, addressing the issue with broken links.


32-34: Appropriate resolver implementation for the url field

The resolver correctly returns the value from the model's url property. This implementation maintains a clean separation between the data model and GraphQL layer.

Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

I updated the code please see the current version that I'm going to merge.

@arkid15r arkid15r added this pull request to the merge queue Mar 11, 2025
Merged via the queue into OWASP:main with commit 639122f Mar 11, 2025
18 checks passed
arkid15r added a commit to Yashgupta9330/Nest that referenced this pull request Mar 11, 2025
…OWASP#1071)

* correct changes

* changes to the links

* corrected linking and reviews correction

* linking resolved

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
shdwcodr pushed a commit to shdwcodr/Nest that referenced this pull request Jun 5, 2025
…OWASP#1071)

* correct changes

* changes to the links

* corrected linking and reviews correction

* linking resolved

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recent releases main page card links are broken

2 participants