fix(frontend): make dev footer version link to commit#3914
fix(frontend): make dev footer version link to commit#3914arkid15r merged 3 commits intoOWASP:mainfrom
Conversation
- 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
Summary by CodeRabbit
WalkthroughThe 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
arkid15r
left a comment
There was a problem hiding this comment.
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 |
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 |



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
make check-testlocally: all warnings addressed, tests passed