[CHORE] If no source was found, return -1 instead of 0 #6

Merged
TomPlanche merged 1 commit from feat/source-endpoint into main 2025-09-10 11:32:38 +02:00
TomPlanche commented 2025-09-10 11:28:41 +02:00 (Migrated from github.com)
No description provided.
cursor[bot] (Migrated from github.com) reviewed 2025-09-10 11:31:03 +02:00
cursor[bot] (Migrated from github.com) left a comment

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, please upgrade to Bugbot Pro by visiting the Cursor dashboard. Your first 14 days will be free!

### This PR is being reviewed by Cursor Bugbot <details> <summary>Details</summary> You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle. To receive Bugbot reviews on all of your PRs, please upgrade to Bugbot Pro by visiting the [Cursor dashboard](https://www.cursor.com/dashboard?tab=bugbot). Your first 14 days will be free! </details>
@ -98,3 +98,3 @@
.await
.unwrap_or(0);
.unwrap_or(-1);
cursor[bot] (Migrated from github.com) commented 2025-09-10 11:31:03 +02:00

Bug: API Success Masking Database Failures

After a successful source increment, the API now returns -1 in a success response if the subsequent count query fails. This is logically inconsistent with a successful increment and creates inconsistent error handling, potentially masking an underlying database issue.

Fix in Cursor Fix in Web

### Bug: API Success Masking Database Failures <!-- DESCRIPTION START --> After a successful source increment, the API now returns -1 in a success response if the subsequent count query fails. This is logically inconsistent with a successful increment and creates inconsistent error handling, potentially masking an underlying database issue. <!-- DESCRIPTION END --> <!-- LOCATIONS START src/source.rs#L94-L103 LOCATIONS END --> <a href="https://cursor.com/open?data=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImJ1Z2JvdC12MSJ9.eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjIwYzI0NDgzLTJmNWYtNDU5NC05MzEwLTFmYjQwMTE4ZmQxMCIsImVuY3J5cHRpb25LZXkiOiI4SUs3QTRhdk5BMkYxenZuTkNyY3JpQUxiSzUxc0VEdXNPOG9venBWRGpZIiwiYnJhbmNoIjoiZmVhdC9zb3VyY2UtZW5kcG9pbnQifSwiaWF0IjoxNzU3NDk2NjYyLCJleHAiOjE3NTgxMDE0NjJ9.dpG2-UJkyEx81L9GY41rD-VjKpPr7-p7RrFqxY1o185sBso1kVuTGGLW3QE4o4ZgIskp4RZQmch7iU46Jl1edFRt6LkpeGuttd77EvQMIi0dfarj_H4P-LxnOqXsllh2WQWL4ccRIsCXvThenDond797wZNsO4je50Aks5h_i9V0a57Nw2koV1oNzVvxJICbRNBkR_ct_owt3kpZ4MIS_pJpjlA4IHUCTgOj2rOL2NwsfNs9E4Vpc8PHwVd6-SptrxDwEnzVLCOpkSAcdslryaVhK_1huCp7Q6vbRDjpK9Optl764fXhyGtLvvA7wQT13vCZJBzfo0lXCcVUdHdPrw"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/fix-in-cursor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/fix-in-cursor-light.svg"><img alt="Fix in Cursor" src="https://cursor.com/fix-in-cursor.svg"></picture></a>&nbsp;<a href="https://cursor.com/agents?data=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImJ1Z2JvdC12MSJ9.eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjIwYzI0NDgzLTJmNWYtNDU5NC05MzEwLTFmYjQwMTE4ZmQxMCIsImVuY3J5cHRpb25LZXkiOiI4SUs3QTRhdk5BMkYxenZuTkNyY3JpQUxiSzUxc0VEdXNPOG9venBWRGpZIiwiYnJhbmNoIjoiZmVhdC9zb3VyY2UtZW5kcG9pbnQiLCJyZXBvT3duZXIiOiJUb21QbGFuY2hlIiwicmVwb05hbWUiOiJ2cHNfYmFjayIsInByTnVtYmVyIjo2LCJjb21taXRTaGEiOiJlNTI0MDE4ZjdlNjhjZDc4Njg2ZGMxM2Y0Mzc1OTcyOWJjZDkwMWJlIn0sImlhdCI6MTc1NzQ5NjY2MiwiZXhwIjoxNzU4MTAxNDYyfQ.CZDc8B0jmrqZSLHewh4VaJcMP9VLBQ7_O5KxJLQdNP5C-Z2zghGdjz4gHrc4sheyrC-2e50FMkG4ryZ6EQAzCe3oP3HDa44zGSbPnrc_FH2OsGeTSvZCieI1Z2x37EbB9zan1wvMceI-ZyQY1AaM811XDzvEKDASX2dyC59cZtFgW_0KbJX-5OUV3toO5kpAZxaD7d5mfxBWtr7HBhwDy-RBcXGCTHmwkvvk0sroc7cieibNxPeqfWZJBDBGmbZcgwftdTj-I9n4m-d6yHWrSzgqQ1_AJoUs_RmA1cVBo6JxrptJzMIlKo2tvYS8cgLC7AULvElDuWs3fnwIrQyJWg"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/fix-in-web-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/fix-in-web-light.svg"><img alt="Fix in Web" src="https://cursor.com/fix-in-web.svg"></picture></a>
Sign in to join this conversation.
No description provided.