Skip to content

Fixes for 3 code quality findings#76

Merged
admdly merged 3 commits intomainfrom
ai-findings-autofix/test-utils-d1-mock.ts
Mar 17, 2026
Merged

Fixes for 3 code quality findings#76
admdly merged 3 commits intomainfrom
ai-findings-autofix/test-utils-d1-mock.ts

Conversation

@admdly
Copy link
Contributor

@admdly admdly commented Mar 17, 2026

This PR applies 3/4 suggestions from code quality AI findings. 1 suggestion was skipped to avoid creating conflicts.

admdly and others added 3 commits March 17, 2026 12:56
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@admdly admdly changed the title Potential fixes for 3 code quality findings Fixes for 3 code quality findings Mar 17, 2026
@admdly admdly marked this pull request as ready for review March 17, 2026 12:56
Copilot AI review requested due to automatic review settings March 17, 2026 12:56
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 17, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
api-worker 18b5533 Commit Preview URL

Branch Preview URL
Mar 17 2026, 12:58 PM

@admdly admdly merged commit 87cc7e5 into main Mar 17, 2026
11 checks passed
@admdly admdly deleted the ai-findings-autofix/test-utils-d1-mock.ts branch March 17, 2026 12:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Cloudflare D1 test mock to address code-quality findings and make the mock’s behavior more robust/accurate when parsing versions and reporting mutation metadata.

Changes:

  • Make semantic version comparison more defensive by safely parsing numeric parts.
  • Normalize bound id values to strings in one query path (WHERE id = ?) to improve matching.
  • Report DELETE “changes”/“rows_written” based on the actual number of deleted rows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 134 to 136
if (query.includes("WHERE id = ?")) {
const id = params[0];
const id = String(params[0]);
const alert = this.alerts.find((a) => a.id === id);
Comment on lines 215 to +219
const id = params[0] as string;
const initialLength = this.alerts.length;
this.alerts = this.alerts.filter((a) => a.id !== id);
const wasDeleted = this.alerts.length < initialLength;
const deletedCount = initialLength - this.alerts.length;
const wasDeleted = deletedCount > 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants