DependencyTrack / DependencyTrack/dependency-track

Changing pageSize also changes the ordering of a few items

Open
#3,162 0 comments 0 reactions 0 assignees View on GitHub
defect in triage
Dominant language
Java
Stars
4.2k
Forks
811
Avg merge
8h 39m
Merged PRs (30d)
237

Description

### Current Behavior

Looks like there's something wrong when using different values for `pageSize` when calling `project/classifier/{classifier}`:

I have about 300 projects in my DT instance.

To see the problem, I created some files. One uses pageSize=400 to get all projects having the `classifier = CONTAINER`, and the others use 5, 10 and so on.

Below, you can see a script that helps in reproducing the problem:

```shell
pageSize=400 # try 10 or other value and see the differences.
page=0
while ((++page)); do
resp="$(
curl -LSs -H "X-Api-Key: $DT_API_KEY" \
-G -d pageSize=$pageSize -d pageNumber=$page \
"$DT_API_URL/project/classifier/CONTAINER"
)"
test "$resp" = '[]' && echo '########### Ended' && break
echo "$resp" | jq -r ".[] | [.name, .version] | @csv" | tr -d '"'
done > /tmp/projects-by-$pageSize.csv
```

Not only the ordering of a few rows is different, but some items are missing as well.

However, for any given `pageSize`, the resulting file is the same, no matter how many times I generate the file for that same `pageSize`.

Also, for any `pageSize > (the total number of projects)`, the results don't change.

The resulting file only changes if I select different values for `pageSize` and the `pageSize < (total number of projects)`.

### Steps to Reproduce

Please check the previous field.

### Expected Behavior

I'd expect that the contents would be the same, regardless of the value used for `pageSize`.

### Dependency-Track Version

4.7.x

### Dependency-Track Distribution

Container Image

### Database Server

PostgreSQL

### Database Server Version

_No response_

### Browser

N/A

### Checklist

- [X] I have read and understand the [contributing guidelines](https://github.com/DependencyTrack/dependency-track/blob/master/CONTRIBUTING.md#filing-issues)
- [X] I have checked the [existing issues](https://github.com/DependencyTrack/dependency-track/issues) for whether this defect was already reported

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.