Skip to content

fix: resolve 2 bugs - #745

Merged
roshankumar0036singh merged 3 commits into
roshankumar0036singh:mainfrom
saurabhhhcodes:fix/Uni-Event-85795
Aug 3, 2026
Merged

fix: resolve 2 bugs#745
roshankumar0036singh merged 3 commits into
roshankumar0036singh:mainfrom
saurabhhhcodes:fix/Uni-Event-85795

Conversation

@saurabhhhcodes

@saurabhhhcodes saurabhhhcodes commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes real bugs found in the codebase:

  • Added null-safety guard: .map() on an undefined collection threw TypeError; now falls back to [].
  • Added null-safety guard: .map() on an undefined collection threw TypeError; now falls back to [].

Type of Change

  • Bug fix (non-breaking change fixing an issue)

How Has This Been Tested?

  • Local manual testing

Checklist

  • My code follows the style guidelines
  • I have performed a self-review

Related Issue

Ref: #752

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@saurabhhhcodes, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 25 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 87546e21-7087-48a5-b7a0-7f2e2e847942

📥 Commits

Reviewing files that changed from the base of the PR and between 091947d and 5f35f9b.

📒 Files selected for processing (2)
  • app/src/screens/ProfileScreen.js
  • app/src/screens/UserFeed.js
📝 Walkthrough

Walkthrough

The PR adds promise rejection logging to Cypress setup and attendance event retrieval, specifies radix 10 for year parsing in profile and feed screens, and changes migration filename sorting to numeric order.

Changes

Runtime consistency updates

Layer / File(s) Summary
Promise error logging
app/cypress/e2e/critical_flows.cy.js, app/src/screens/AttendanceDashboard.js
Cypress setup and attendance event retrieval now log promise failures.
Explicit decimal year parsing
app/src/screens/ProfileScreen.js, app/src/screens/UserFeed.js
Profile and feed year conversions now specify radix 10.
Numeric migration ordering
cloud-functions/migrations/migrate.ts
Migration filenames are sorted by numeric filename-derived values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: quality:clean, type:refactor

Suggested reviewers: atul-upadhyay-7, riddhima25bet10005-a11y

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title indicates bug fixes but does not identify the affected behavior, while the changes include several code-quality and safety updates. Name the main fixes, such as radix parsing, numeric migration sorting, and fetch or test error handling.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/cypress/e2e/critical_flows.cy.js`:
- Line 6: Restore the removed implementations at
app/cypress/e2e/critical_flows.cy.js:5-6 and
app/src/screens/AttendanceDashboard.js:167. In critical_flows.cy.js, reinstate
setMockUser and the critical-flow assertions, close cy.window().then(...), and
rely on Cypress failure handling rather than appending .catch. In
AttendanceDashboard.js, restore event-data fetching, listeners, UI, routing,
component/request closure, and preserve getAttendanceStats returning null on
errors.

In `@cloud-functions/migrations/migrate.ts`:
- Line 51: Update the migration sorting logic in the migration discovery flow to
extract and numerically compare each filename’s leading migration number rather
than subtracting complete filenames. Validate every migration name matches the
expected numeric-prefix format and reject malformed names before sorting or
execution.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d71a9da6-4014-45bd-8048-d3de4fbbd7b8

📥 Commits

Reviewing files that changed from the base of the PR and between ecf85dc and 091947d.

📒 Files selected for processing (5)
  • app/cypress/e2e/critical_flows.cy.js
  • app/src/screens/AttendanceDashboard.js
  • app/src/screens/ProfileScreen.js
  • app/src/screens/UserFeed.js
  • cloud-functions/migrations/migrate.ts

cy.get('[data-testid="clear-search-button"]').should('exist');
});
});
.catch(err => console.error(err)) No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

for file in \
  app/cypress/e2e/critical_flows.cy.js \
  app/src/screens/AttendanceDashboard.js
do
  ast-grep outline "$file" --items all
done

rg -n -C 10 'setMockUser|cy\.window\(\)|getDoc|getAttendanceStats|\.catch\(' \
  app/cypress/e2e/critical_flows.cy.js \
  app/src/screens/AttendanceDashboard.js \
  app/src/lib/AuthContext.js \
  app/src/lib/checkInService.js \
  app/src/screens/EventDetail.js

Repository: roshankumar0036singh/Uni-Event

Length of output: 28298


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
wc -l app/cypress/e2e/critical_flows.cy.js app/src/screens/AttendanceDashboard.js app/src/lib/checkInService.js app/src/screens/EventDetail.js

echo "== critical_flows.cy.js =="
cat -n app/cypress/e2e/critical_flows.cy.js

echo "== AttendanceDashboard.js relevant end scope =="
sed -n '120,220p' app/src/screens/AttendanceDashboard.js | cat -n -v

echo "== AttendanceDashboard.js imports/functions outline snippets =="
sed -n '1,130p' app/src/screens/AttendanceDashboard.js | cat -n -v

Repository: roshankumar0036singh/Uni-Event

Length of output: 8093


Restore the deleted code before merging the rejection logging.

Both files leave behind a dangling .catch after removing the callback body, so the files fail parsing and lose existing behavior.

  • app/cypress/e2e/critical_flows.cy.js:5: Restore setMockUser and the critical-flow assertions, close cy.window().then(...), and use Cypress failure behavior instead of appending .catch to the Cypress chain.
  • app/src/screens/AttendanceDashboard.js:165: Restore the event-data fetch, listeners, UI, and route behavior, close the component/request scope, and preserve getAttendanceStats null-on-error behavior.
🧰 Tools
🪛 Biome (2.5.5)

[error] 6-6: Expected a statement but instead found '.catch(err => console.error(err))'.

(parse)


[error] 6-6: expected } but instead the file ends

(parse)

📍 Affects 2 files
  • app/cypress/e2e/critical_flows.cy.js#L6-L6 (this comment)
  • app/src/screens/AttendanceDashboard.js#L167-L167
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/cypress/e2e/critical_flows.cy.js` at line 6, Restore the removed
implementations at app/cypress/e2e/critical_flows.cy.js:5-6 and
app/src/screens/AttendanceDashboard.js:167. In critical_flows.cy.js, reinstate
setMockUser and the critical-flow assertions, close cy.window().then(...), and
rely on Cypress failure handling rather than appending .catch. In
AttendanceDashboard.js, restore event-data fetching, listeners, UI, routing,
component/request closure, and preserve getAttendanceStats returning null on
errors.

Source: Linters/SAST tools

.readdirSync(__dirname)
.filter(f => f.endsWith('.ts') && f !== 'migrate.ts')
.sort();
.sort((a, b) => a - b);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Parse the numeric migration prefix before sorting.

The comparator subtracts complete filenames. For 001_add_feedbackRequestSent_to_events.ts, this produces NaN, so Array.sort treats the comparison as equal and does not apply numeric ordering. Migrations can therefore run in filesystem order instead of migration order.

Parse the numeric prefix and reject malformed migration names.

Proposed fix
-        .sort((a, b) => a - b);
+        .sort((a, b) => {
+            const aNumber = Number.parseInt(a.split('_', 1)[0], 10);
+            const bNumber = Number.parseInt(b.split('_', 1)[0], 10);
+            if (Number.isNaN(aNumber) || Number.isNaN(bNumber)) {
+                throw new Error(`Invalid migration filename: ${a} or ${b}`);
+            }
+            return aNumber - bNumber;
+        });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cloud-functions/migrations/migrate.ts` at line 51, Update the migration
sorting logic in the migration discovery flow to extract and numerically compare
each filename’s leading migration number rather than subtracting complete
filenames. Validate every migration name matches the expected numeric-prefix
format and reject malformed names before sorting or execution.

@saurabhhhcodes saurabhhhcodes changed the title fix: code quality and safety improvements fix: resolve 2 bugs Aug 2, 2026
@sonarqubecloud

sonarqubecloud Bot commented Aug 2, 2026

Copy link
Copy Markdown

@roshankumar0036singh
roshankumar0036singh merged commit f7157f8 into roshankumar0036singh:main Aug 3, 2026
5 of 6 checks passed
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.

2 participants