Skip to content

Conversation

@rishikrc3
Copy link
Contributor

Proposed change

Resolves #2622

Add the PR description here.
Added redirect rules in redirect.conf

Checklist

  • I've read and followed the contributing guidelines.
  • I've run make check-test locally; all checks and tests passed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Summary by CodeRabbit

  • Chores
    • Reorganized snapshots feature under the community namespace. Snapshots content has been relocated from /snapshots to /community/snapshots. Automatic permanent (301) redirects ensure all existing bookmarks, external links, and references seamlessly redirect to the new location, maintaining complete backward compatibility without disruption to your existing workflows or integrations.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Moved snapshot pages and API route under the /community prefix and added permanent Nginx redirects from /snapshots and /snapshots/* to the new paths. Updated backend router mapping, backend tests, frontend imports, pages, and SEO metadata to use /community/snapshots.

Changes

Cohort / File(s) Summary
Nginx redirects
proxy/redirects.conf
Added two redirect blocks: location = /snapshots/community/snapshots$is_args$args (301) and location ^~ /snapshots//community$request_uri (301).
API router mapping
backend/apps/api/rest/v0/__init__.py
Changed ROUTERS key for the snapshot router from "/snapshots" to "/community/snapshots".
Backend tests
backend/tests/apps/api/rest/v0/urls_test.py
Updated EXPECTED_ROUTERS to expect the snapshot router under "/community/snapshots".
Frontend pages & imports
frontend/src/app/community/snapshots/page.tsx, frontend/src/app/community/snapshots/layout.tsx, frontend/src/app/community/snapshots/[id]/layout.tsx
Updated navigation targets and metadata canonicalPath to use /community/snapshots instead of /snapshots.
Frontend tests
frontend/__tests__/unit/pages/Snapshots.test.tsx, frontend/__tests__/unit/pages/SnapshotDetails.test.tsx
Updated imports to app/community/snapshots/... paths (no test logic changes).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Verify consistency between Nginx redirects and application routing (exact vs prefix behavior).
  • Check any remaining references to /snapshots elsewhere (reverse URLs, sitemaps, links).
  • Confirm frontend navigation, SEO metadata, and tests correctly reflect the new paths.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Added Redirection Rules' accurately describes the primary change of adding redirect rules in the proxy configuration to handle snapshot path redirects.
Description check ✅ Passed The description mentions adding redirect rules in redirect.conf and links to issue #2622, which aligns with the changeset that implements redirects for snapshot pages.
Linked Issues check ✅ Passed The pull request fully addresses both objectives from issue #2622: moving snapshot pages under /community/snapshots and adding permanent 301 redirects from /snapshots paths to their /community/snapshots equivalents.
Out of Scope Changes check ✅ Passed All changes directly support the linked issue objectives: redirect rules in proxy config, router path updates, test path updates, and SEO metadata changes for the snapshot page relocation are all in scope.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8adbf4b and 0ba6657.

📒 Files selected for processing (5)
  • frontend/__tests__/unit/pages/SnapshotDetails.test.tsx (1 hunks)
  • frontend/__tests__/unit/pages/Snapshots.test.tsx (1 hunks)
  • frontend/src/app/community/snapshots/[id]/layout.tsx (1 hunks)
  • frontend/src/app/community/snapshots/layout.tsx (1 hunks)
  • frontend/src/app/community/snapshots/page.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-07-12T17:36:57.255Z
Learnt from: Rajgupta36
Repo: OWASP/Nest PR: 1717
File: frontend/__tests__/unit/pages/createProgram.test.tsx:70-86
Timestamp: 2025-07-12T17:36:57.255Z
Learning: When testing React page components that use mocked form components, validation logic should be tested at the form component level, not the page level. Page-level tests should focus on authentication, role checking, submission handling, and navigation logic.

Applied to files:

  • frontend/__tests__/unit/pages/Snapshots.test.tsx
  • frontend/__tests__/unit/pages/SnapshotDetails.test.tsx
📚 Learning: 2025-11-17T16:47:05.578Z
Learnt from: anurag2787
Repo: OWASP/Nest PR: 2671
File: frontend/__tests__/unit/components/MultiSearch.test.tsx:427-427
Timestamp: 2025-11-17T16:47:05.578Z
Learning: In the frontend test files for the OWASP/Nest repository, `expect(true).toBe(true)` no-op assertions may be intentionally added as workarounds when ESLint rule jest/expect-expect doesn't detect expectations inside helper functions or waitFor callbacks. These can be resolved by configuring the ESLint rule's assertFunctionNames option to recognize custom assertion helpers instead of flagging them as redundant.

Applied to files:

  • frontend/__tests__/unit/pages/Snapshots.test.tsx
  • frontend/__tests__/unit/pages/SnapshotDetails.test.tsx
📚 Learning: 2025-11-17T17:30:42.139Z
Learnt from: anurag2787
Repo: OWASP/Nest PR: 2671
File: frontend/__tests__/unit/components/MultiSearch.test.tsx:169-171
Timestamp: 2025-11-17T17:30:42.139Z
Learning: In the OWASP/Nest frontend tests (PR #2671 context), wrapper functions like `expectChaptersCountEqualsThree` that simply call another helper with a fixed parameter (e.g., `expectChaptersCountEquals(3)`) are intentionally used to avoid arrow function callbacks in `waitFor` calls. This pattern prevents adding nesting depth that would trigger rule typescript:S2004. Example: `await waitFor(expectChaptersCountEqualsThree)` avoids the extra nesting from `await waitFor(() => expectChaptersCountEquals(3))`.

Applied to files:

  • frontend/__tests__/unit/pages/Snapshots.test.tsx
📚 Learning: 2025-07-13T07:31:06.511Z
Learnt from: Rajgupta36
Repo: OWASP/Nest PR: 1717
File: frontend/src/components/ModuleCard.tsx:53-55
Timestamp: 2025-07-13T07:31:06.511Z
Learning: In Next.js 13+ app router, useRouter from 'next/navigation' does not provide asPath or query properties. Use useParams to extract route parameters and usePathname to get the current pathname instead.

Applied to files:

  • frontend/src/app/community/snapshots/page.tsx
🧬 Code graph analysis (1)
frontend/src/app/community/snapshots/layout.tsx (1)
frontend/src/utils/metaconfig.ts (1)
  • getStaticMetadata (68-81)
🔇 Additional comments (5)
frontend/__tests__/unit/pages/SnapshotDetails.test.tsx (1)

6-6: LGTM!

The import path correctly reflects the relocated component under the /community/snapshots route structure.

frontend/src/app/community/snapshots/page.tsx (1)

38-40: LGTM!

The navigation path correctly routes to the new /community/snapshots structure, maintaining consistency with the SEO metadata and layout changes across the PR.

frontend/__tests__/unit/pages/Snapshots.test.tsx (1)

6-6: LGTM!

The import path correctly reflects the relocated component under the /community/snapshots route structure.

frontend/src/app/community/snapshots/[id]/layout.tsx (1)

19-26: LGTM!

The canonical path correctly reflects the new /community/snapshots structure for SEO purposes, maintaining consistency with the routing changes across the PR.

frontend/src/app/community/snapshots/layout.tsx (1)

4-4: LGTM!

The metadata path correctly reflects the new /community/snapshots structure, ensuring proper SEO configuration for the relocated snapshots pages.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

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)
proxy/redirects.conf (1)

8-10: Functionally correct; consider style consistency.

The redirect logic works correctly. Using $request_uri properly handles all /snapshots/* paths and preserves query strings.

However, for style consistency with lines 1-3 and lines 4-6, consider this alternative approach:

-location ^~ /snapshots/ {
-    return 301 /community$request_uri;
-}
+location ^~ /snapshots/ {
+    return 301 /community/snapshots/$1$is_args$args;
+}

Wait, that won't work without regex capture. Actually, your current implementation using $request_uri is the cleaner approach for this use case. The minor style inconsistency is acceptable since the alternative would require a regex location with capture groups.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48fb37d and c9cc370.

📒 Files selected for processing (1)
  • proxy/redirects.conf (1 hunks)
🔇 Additional comments (1)
proxy/redirects.conf (1)

4-6: LGTM! Exact match redirect correctly implemented.

The redirect for /snapshots to /community/snapshots is correctly implemented, preserving query strings with $is_args$args and following the established pattern in this file.

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.

Please make a single PR for all issue related changes.

@rudransh-shrivastava
Copy link
Collaborator

rudransh-shrivastava commented Nov 20, 2025

Ping me when you update the PR. Thank you.

@sonarqubecloud
Copy link

Copy link
Collaborator

@rudransh-shrivastava rudransh-shrivastava left a comment

Choose a reason for hiding this comment

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

Hi, things look good, but a few points:

  • Please run make check-test and ensure all tests and checks pass.
  • The Navbar Dropdown (Community > Snapshots) still redirects to /snapshots -- please update that.
Image

"/releases": release_router,
"/repositories": repository_router,
"/snapshots": snapshot_router,
"/community/snapshots": snapshot_router,
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can revert changes to the Nest v0 API.

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.

Move /snapshots /snapshots/* pages under /community/snapshots and /community/snapshots/*

3 participants