Skip to content

feat: implement issue #528 — SonarCloud: test assertion quality (S5906) - #548

Open
don-petry wants to merge 1 commit into
mainfrom
dev-lead/issue-528-20260818-2041
Open

feat: implement issue #528 — SonarCloud: test assertion quality (S5906)#548
don-petry wants to merge 1 commit into
mainfrom
dev-lead/issue-528-20260818-2041

Conversation

@don-petry

@don-petry don-petry commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

User description

Closes #528

Implemented by dev-lead agent. Please review.


CodeAnt-AI Description

Improve test assertion quality for SonarCloud compliance

What Changed

  • Updated test assertions to use clearer collection-length and null-value checks
  • Preserved existing performance benchmarks and calendar configuration behavior while removing assertion patterns flagged by quality checks

Impact

✅ SonarCloud test-quality checks pass
✅ Clearer test failure messages
✅ Existing benchmark and configuration coverage preserved

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@don-petry
don-petry requested a review from a team as a code owner August 18, 2026 20:44
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codeant-ai

codeant-ai Bot commented Aug 18, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 4256830 Aug 18, 2026 · 20:44 20:46

@codeant-ai

codeant-ai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 20 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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 within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 50a3ed16-b888-46fb-adff-458620dba3d0

📥 Commits

Reviewing files that changed from the base of the PR and between de9a03e and 4256830.

📒 Files selected for processing (2)
  • src/calendar-to-sheets/tests/index.test.js
  • src/gmail-ai-classifier/tests/performance-scalability.test.js

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.

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Aug 18, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates Jest test assertions across multiple test files to use more idiomatic matchers, replacing '.length' checks with 'toHaveLength()' and '.toBe(null)' with 'toBeNull()'. There are no review comments to address, and I have no additional feedback to provide.

@sonarqubecloud

Copy link
Copy Markdown

const duration = Date.now() - startTime

expect(processed.length).toBe(BATCH_SIZE)
expect(processed).toHaveLength(BATCH_SIZE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The benchmark only verifies the number of returned entries, so an implementation that duplicates one result, associates results with the wrong threads, or returns 100 unclassified entries would still pass. Assert that each result corresponds to the input thread and has the expected classified status and label so the throughput test also validates the batch-processing contract. [incomplete implementation]

Severity Level: Major ⚠️
- ⚠️ Batch benchmark can pass incorrect per-thread results.
- ⚠️ Thread-to-result association regressions may go undetected.
- ⚠️ Classification status and label regressions lack coverage.

Use CodeAnt Skill

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/gmail-ai-classifier/tests/performance-scalability.test.js
**Line:** 124:124
**Comment:**
	*Incomplete Implementation: The benchmark only verifies the number of returned entries, so an implementation that duplicates one result, associates results with the wrong threads, or returns 100 `unclassified` entries would still pass. Assert that each result corresponds to the input thread and has the expected classified status and label so the throughput test also validates the batch-processing contract.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@don-petry
don-petry enabled auto-merge (squash) August 18, 2026 20:46
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-08-18T21:46:47Z.

@donpetry-bot donpetry-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.

Automated review — APPROVED ✓

Risk: LOW
Reviewed commit: 425683015c84f8b433ddeba32e61c2613f8913cf
Review mode: triage-approved (single reviewer)

Summary

Test-only PR (2 files, +4/-4) that rewrites four Jest assertions to idiomatic matchers: three in src/calendar-to-sheets/tests/index.test.js (.length toBe(1) → toHaveLength(1); toBe(null) → toBeNull() ×2) and one in src/gmail-ai-classifier/tests/performance-scalability.test.js (.length toBe(BATCH_SIZE) → toHaveLength(BATCH_SIZE)). All replacements are semantically equivalent to the originals — no behavior change. Confirms the triage assessment: low-risk, mechanical, exactly scoped to the linked issue.

Linked issue analysis

Closes #528 (SonarCloud S5906 — test assertion quality). The issue lists exactly 4 findings: 3 in calendar-to-sheets tests, 1 in gmail-ai-classifier performance test. This PR fixes precisely those 4 assertions with real fixes (no NOSONAR suppressions). SonarCloud quality gate on this PR passed with 0 new issues, satisfying the acceptance criteria (findings resolved, no behavior change, CI green).

Findings

  • No security-relevant changes: no auth, secrets, dependencies, workflows, or executable logic touched.
  • Secret scan (MCP): run_secret_scanning tool not available in this run — noted, not blocking; gitleaks CI check passed (SUCCESS).
  • CodeAnt left one advisory inline suggestion about the benchmark only asserting result count — that weakness pre-exists this PR (the assertion was .length-based before and is semantically unchanged); out of scope here and non-blocking.
  • Advisory bots Codex, Qodo, and CodeRabbit were rate/billing-limited; Gemini Code Assist and CodeAnt did review (no blocking feedback). This sweep re-review supersedes the earlier rate-limited hold.
  • No unanswered human-reviewer questions; no human change requests.

CI status

All substantive checks green: build-and-test, Node.js Tests, coverage, Playwright UI Tests, CodeQL (actions/js-ts/python), SonarCloud (quality gate passed, 0 new issues), gitleaks secret scan, dependency audit, AgentShield — all SUCCESS. A few Dev-Lead Agent dispatch/ci-relay runs show CANCELLED, but these are superseded agent-orchestration runs (the final dev-lead dispatch at 20:46:14Z succeeded), not code checks.


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SonarCloud: test assertion quality (S5906)

2 participants