apache / apache/couchdb

Requests to `_changes` with `descending=true` ignore `since`

Open
#2,733 1 comment 2 reactions 0 assignees View on GitHub
enhancement needs-triage
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

## Description

When passing `descending=true` to `_changes`, CouchDB completely ignores the `since` parameter and always resolves with results as if `since=now`. It even ignores a malformed seq.

## Steps to Reproduce

```
curl "http:////_changes?limit=1&descending=true&since=NOT_A_SEQ"
```

## Expected Behaviour

According to the documentation, `descending` means:
> Return the change results in descending sequence order (most recent change first). Default is false.

No other interactions are documented. I would expect it to respect the `since` parameter.

## Your Environment

* CouchDB version used: 3.0, 2.3.1, 2.2, 2.1, 1.7 **
* Operating system and version: Manjaro 19

** Couch 1.7 does return a badarg when passing a malformed `since` , but a correct `since` is ignored.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported request with descending=true and since=NOT_A_SEQ, then trace the _changes request handling in CouchDB. Done means descending results respect a supplied since value and malformed sequences are handled consistently, with regression coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
api, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.