Skip to content

fix: resolve 4 bugs in iloveAgents - #880

Open
saurabhhhcodes wants to merge 1 commit into
AditthyaSS:mainfrom
saurabhhhcodes:fix/iloveAgents-89381
Open

fix: resolve 4 bugs in iloveAgents#880
saurabhhhcodes wants to merge 1 commit into
AditthyaSS:mainfrom
saurabhhhcodes:fix/iloveAgents-89381

Conversation

@saurabhhhcodes

@saurabhhhcodes saurabhhhcodes commented Aug 3, 2026

Copy link
Copy Markdown

Description

This PR fixes real bugs found in the codebase:

  • Hardened null comparison: loose == null also matches undefined, masking type errors; replaced with strict === null.
  • Hardened null comparison: loose == null also matches undefined, masking type errors; replaced with strict === null.
  • Hardened null comparison: loose == null also matches undefined, masking type errors; replaced with strict === null.
  • Fixed default sort: .sort() coerces elements to strings, so [10, 9, 2] sorts as [10, 2, 9]; numeric comparator sorts correctly.

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: #854

Summary by CodeRabbit

  • Bug Fixes
    • Improved Enter-key handling when answering wizard questions.
    • Corrected display behavior for trace payload values.
    • Fixed sorting for longest-streak dates.
    • Improved session cost handling when input costs are unavailable.

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the aditthyass' projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "issues"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

The changes update three strict null checks and replace lexicographic date sorting with numeric sorting. They affect SuiteWizard navigation, TraceViewer payload rendering, session cost estimation, and longest-streak analytics.

Changes

Behavior Corrections

Layer / File(s) Summary
Strict null handling
src/components/SuiteWizard.jsx, src/components/TraceViewer.jsx, src/lib/useSessionSpend.js
Answer advancement, trace payload rendering, and input-cost estimation now distinguish null from undefined.
Numeric streak sorting
src/lib/useAnalytics.js
Longest-streak date values now use arithmetic sorting before streak calculation.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: needs-fix

Suggested reviewers: aditthyass, anshul23102

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the pull request's primary change: fixing four bugs in iloveAgents.
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 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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.

@mergify

mergify Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hey @saurabhhhcodes! 👋
Wow — your first contribution to iloveAgents! This is a big deal and I want you to know it means a lot. 🎊
Every agent on this platform started exactly like this — someone like you deciding to spend their time building something useful for everyone. That is something to be proud of.
A few things while you wait for the review:

  • Star the repo if you haven't already. Star it here
  • 📖 Check the Contributing Guide
  • 💬 Drop a comment if you get stuck — I reply within 24 hours
    Can't wait to ship this with you. 🚀
    Welcome to the iloveAgents family. 🙏
    @AditthyaSS

@mergify

mergify Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

hey @saurabhhhcodes! 👋
Your PR doesn't seem to be linked to an issue.
Please add this line to your PR description:
Closes #issue_number
Replace issue_number with the actual issue number you are solving.
This helps us track what each PR is fixing! 🔗
@AditthyaSS

@mergify mergify Bot added the needs-fix label Aug 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@src/lib/useAnalytics.js`:
- Line 209: Update the sortedDays construction in the streak-processing flow to
sort the YYYY-MM-DD date keys lexicographically, replacing the numeric
subtraction comparator with the default sort or a.localeCompare-based comparator
so chronological ordering is guaranteed.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: adf45178-4fad-4b97-9cde-525bcc5d0e1c

📥 Commits

Reviewing files that changed from the base of the PR and between 5f712bc and 9dc09a2.

📒 Files selected for processing (4)
  • src/components/SuiteWizard.jsx
  • src/components/TraceViewer.jsx
  • src/lib/useAnalytics.js
  • src/lib/useSessionSpend.js

Comment thread src/lib/useAnalytics.js

// Longest streak ever
const sortedDays = [...allDayKeys].sort()
const sortedDays = [...allDayKeys].sort((a, b) => a - b)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 4 'allDayKeys|sortedDays|function toDateKey' src/lib/useAnalytics.js

node - <<'NODE'
const days = ['2026-08-02', '2026-08-01']
const sorted = [...days].sort((a, b) => a - b)

if (sorted[0] !== '2026-08-01') {
  console.error('Unexpected result:', sorted)
  process.exit(1)
}

console.error('The arithmetic comparator does not sort YYYY-MM-DD strings.')
process.exit(1)
NODE

Repository: AditthyaSS/iloveAgents

Length of output: 2171


Sort the date keys with a comparator that produces a valid ordering.

allDayKeys contains YYYY-MM-DD strings from toDateKey, so a - b returns NaN. Array.prototype.sort keeps the insertion order when the comparator does not return a valid comparison result. Since streak processing needs chronological order, use sorted = [...allDayKeys].sort() or a comparator such as a.localeCompare(b).

🤖 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 `@src/lib/useAnalytics.js` at line 209, Update the sortedDays construction in
the streak-processing flow to sort the YYYY-MM-DD date keys lexicographically,
replacing the numeric subtraction comparator with the default sort or
a.localeCompare-based comparator so chronological ordering is guaranteed.

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.

1 participant