Skip to content

Comments

fix(frontend): make dev footer version link to commit#3914

Merged
arkid15r merged 3 commits intoOWASP:mainfrom
preeeetham:fix/3892-footer-version-link-v2
Feb 11, 2026
Merged

fix(frontend): make dev footer version link to commit#3914
arkid15r merged 3 commits intoOWASP:mainfrom
preeeetham:fix/3892-footer-version-link-v2

Conversation

@preeeetham
Copy link
Contributor

@preeeetham preeeetham commented Feb 11, 2026

Proposed change

Resolves #3892

Makes the release version at the bottom of https://nest.owasp.dev/ a clickable link to the corresponding Git commit, while keeping the existing behavior on https://nest.owasp.org/.

Changes:

  • frontend/src/components/Footer.tsx: Version is now always a clickable link. In production → links to release tag; in non-production → links to commit (parses short SHA from RELEASE_VERSION when it contains a dash). Falls back to release tag URL when RELEASE_VERSION has no dash.
  • frontend/__tests__/unit/components/Footer.test.tsx: Added tests for non-production commit link and no-dash fallback.

Checklist

  • Required: I followed the contributing workflow
  • Required: I verified that my code works as intended and resolves the issue as described
  • Required: I ran make check-test locally: all warnings addressed, tests passed
  • I used AI for code, documentation, tests, or communication related to this PR

- Footer version is now always a clickable link
- Production: links to release tag (unchanged)
- Non-production with dash in RELEASE_VERSION: links to commit
- Non-production without dash: falls back to release tag URL
- Added unit tests for Version Link Behavior
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Summary by CodeRabbit

  • Improvements

    • Version links in the footer now correctly resolve to environment-specific GitHub URLs. In production, they direct to official release pages; in staging and non-production environments, they reference specific commits.
  • Tests

    • Added comprehensive test coverage for version link rendering across different deployment environments to verify proper URL resolution and link behavior consistency.

Walkthrough

The pull request adds test coverage and updates Footer component logic to make the release version link clickable. Tests verify version links render correctly in different environments (staging uses commit URL, production uses release tag URL). Component implementation refactored from environment-conditional branching to single Link with dynamic href computation.

Changes

Cohort / File(s) Summary
Version Link Tests
frontend/__tests__/unit/components/Footer.test.tsx
New test suite "Version Link Behavior" verifying Footer renders version links with correct GitHub URLs based on environment, including link attributes (target blank, noopener noreferrer) and text formatting.
Footer Component Logic
frontend/src/components/Footer.tsx
Refactored release version link rendering from environment-conditional branching to single Link component with computed href: GitHub release URL for production, commit URL for non-production environments derived from RELEASE_VERSION.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • kasya
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: making the dev footer version link to a commit rather than remaining non-clickable.
Description check ✅ Passed The description clearly relates to the changeset, explaining the purpose and detailing both the Footer component changes and test additions.
Linked Issues check ✅ Passed The PR successfully resolves issue #3892 by making the footer version link to commits in dev and release tags in production, matching the expected behavior.
Out of Scope Changes check ✅ Passed All changes in Footer.tsx and Footer.test.tsx are directly aligned with the objective to make the footer version clickable with environment-specific link targets.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

cubic-dev-ai[bot]
cubic-dev-ai bot previously approved these changes Feb 11, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@sonarqubecloud
Copy link

@arkid15r arkid15r enabled auto-merge February 11, 2026 23:26
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: 2

🤖 Fix all issues with AI agents
In `@frontend/__tests__/unit/components/Footer.test.tsx`:
- Around line 278-327: Add a unit test for the non-production fallback when
RELEASE_VERSION contains no dash: in the Footer test suite (describe 'Version
Link Behavior') add a test named like test('renders version as release tag link
in non-production when no dash in version') that sets envModule.ENVIRONMENT =
'staging' and envModule.RELEASE_VERSION = '1.2.3', renders <Footer />, queries
for the releases link (e.g., container.querySelector('a[href*="releases"]')),
and asserts the link exists and has href
'https://github.com/OWASP/Nest/releases/tag/1.2.3' (and optional target/rel/text
assertions); ensure you restore envModule.ENVIRONMENT and
envModule.RELEASE_VERSION in afterEach as done for the other tests.

In `@frontend/src/components/Footer.tsx`:
- Around line 98-102: The href generation in the Footer component builds a
commit URL using RELEASE_VERSION.split('-').pop() which produces an invalid URL
when RELEASE_VERSION contains no dash (e.g. "1.2.3"); update the ternary logic
in the Footer (the href expression that references ENVIRONMENT and
RELEASE_VERSION) to first check whether RELEASE_VERSION contains a dash (e.g.
RELEASE_VERSION.includes('-')) and only use the post-dash segment for the commit
URL when true, otherwise fall back to the release tag URL; keep ENVIRONMENT ===
'production' behavior unchanged and reference RELEASE_VERSION and ENVIRONMENT in
the updated conditional.

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.39%. Comparing base (a470db6) to head (e967796).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3914   +/-   ##
=======================================
  Coverage   95.39%   95.39%           
=======================================
  Files         463      463           
  Lines       14540    14540           
  Branches     2017     2061   +44     
=======================================
+ Hits        13870    13871    +1     
  Misses        328      328           
+ Partials      342      341    -1     
Flag Coverage Δ
backend 95.67% <ø> (ø)
frontend 94.64% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
frontend/src/components/Footer.tsx 95.83% <100.00%> (+4.16%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a470db6...e967796. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

LGTM

// btw, this could have been done in a single PR

@arkid15r arkid15r added this pull request to the merge queue Feb 11, 2026
Merged via the queue into OWASP:main with commit 00e364b Feb 11, 2026
36 checks passed
@preeeetham
Copy link
Contributor Author

LGTM

// btw, this could have been done in a single PR

Yaa sorry for the inconvenience!!, I'll be extremely careful from the next one

@arkid15r
Copy link
Collaborator

Yaa sorry for the inconvenience!!, I'll be extremely careful from the next one

I'm not sure what you mean by that. In general you don't need to close PR just to create another one with better looking code -- you can push any code into existing PR instead.

@preeeetham
Copy link
Contributor Author

Yaa sorry for the inconvenience!!, I'll be extremely careful from the next one

I'm not sure what you mean by that. In general you don't need to close PR just to create another one with better looking code -- you can push any code into existing PR instead.

Yaa it had become a bit messy for mee..soo I just re did everything. I'll not be doing this again
Thankyou for guiding

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.

Release version at bottom of https://nest.owasp.dev/ should link to relevant GitHub commit

2 participants