You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "Subham-KRLX (via GitHub)" <gi...@apache.org> on 2026/01/30 17:13:45 UTC

[PR] feat: Implement inverted range check for _all_docs [couchdb]

Subham-KRLX opened a new pull request, #5874:
URL: https://github.com/apache/couchdb/pull/5874

   This PR implements a validation check for _all_docs requests to ensure that start_key is not greater than end_key (or vice versa when descending=true).
   
   Previously, _all_docs queries with inverted ranges would return empty results without a clear indication of the error. This change aligns the behavior of _all_docs with _view, which already rejects inverted ranges with a 400 Bad Request.
   
   Users providing an invalid range will now receive the following error: {"error":"query_parse_error","reason":"No rows can match your key range, reverse your start_key and end_key or set descending=true"}
   
   Testing recommendations
   I have added a new EUnit test suite 
   src/chttpd/test/eunit/chttpd_all_docs_range_test.erl
    which verifies the fix.
   
   To test manually:
   
   Create a database.
   Issue a request with an inverted range:
   bash
   curl -v "http://localhost:5984/db/_all_docs?startkey=\"z\"&endkey=\"a\""
   Verify that the response is 400 Bad Request with the error message described above.
   Related Issues or Pull Requests
   Fixes #5866
   
   Checklist
    This is my own work, I did not use AI, LLM's or similar technology
    Code is written and works correctly
    Changes are covered by tests
    Any new configurable parameters are documented in 
   rel/overlay/etc/default.ini
    Documentation changes were made in the src/docs folder
    Documentation changes were backported (separated PR) to affected branches


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Implement inverted range check for _all_docs [couchdb]

Posted by "Subham-KRLX (via GitHub)" <gi...@apache.org>.
Subham-KRLX commented on PR #5874:
URL: https://github.com/apache/couchdb/pull/5874#issuecomment-3827396433

   I have addressed both of your concerns by confirming in the PR template that this is my own work and moving the tests into the existing 
   chttpd_view_test.erl
    suite as requested. However iam unable to properly debug the remaining test failures without a local Erlang environment to run and verify the changes. I will close this PR for now and may revisit this issue once I have the proper development setup to test changes locally Thank you for your time reviewing this contribution.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Implement inverted range check for _all_docs [couchdb]

Posted by "rnewson (via GitHub)" <gi...@apache.org>.
rnewson commented on PR #5874:
URL: https://github.com/apache/couchdb/pull/5874#issuecomment-3825131993

   Please complete the PR template correctly, and specifically to confirm that this is your work and not the output of an LLM tool. 
   
   The tests should be added to existing test suites, the one you have written (or generated) contains a lot of duplication from elsewhere and will not be accepted.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: Implement inverted range check for _all_docs [couchdb]

Posted by "Subham-KRLX (via GitHub)" <gi...@apache.org>.
Subham-KRLX closed pull request #5874: feat: Implement inverted range check for _all_docs
URL: https://github.com/apache/couchdb/pull/5874


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org