Skip to content

Conversation

@jason-lynch
Copy link
Member

Summary

Fixes a bug where the last_entry_id is empty when after_entry_id is the last entry in the log. Instead of performing an exclusive get in Etcd, we perform an inclusive get and then filter out the entry with entry_id == after_entry_id in the service layer.

Testing

To test this change:

# perform an async operation, such as creating a db
# note that the follow-task helper should continue to work as expected
cp1-req create-database < ./.scratch/requests/db.json | cp-follow-task

# once the task is complete, list tasks
cp1-req list-database-tasks <db id>

# get the task logs
cp1-req get-database-task-log <db id> <task id>

# take the last entry id from the previous response and use it as the
# after-entry-id argument
cp1-req get-database-task-log <db id> <task id> --after-entry-id <entry id>

# note that the entries list is empty, but the last_entry_id is still
# populated.

# if needed, you can further validate that the correct entries and number of
# entries is returned by comparing with the contents in etcd:
cp-etcdctl get --sort-by key --prefix /task_log_messages/<db id>/<task id> --keys-only | sort -u | tail -n +2

PLAT-367

Fixes a bug where the `last_entry_id` is empty when `after_entry_id` is
the last entry in the log. Instead of performing an exclusive get in
Etcd, we perform an inclusive get and then filter out the entry with
`entry_id == after_entry_id` in the service layer.

To test this change:

```sh
# perform an async operation, such as creating a db
# note that the follow-task helper should continue to work as expected
cp1-req create-database < ./.scratch/requests/db.json | cp-follow-task

# once the task is complete, list tasks
cp1-req list-database-tasks <db id>

# get the task logs
cp1-req get-database-task-log <db id> <task id>

# take the last entry id from the previous response and use it as the
# after-entry-id argument
cp1-req get-database-task-log <db id> <task id> --after-entry-id <entry id>

# note that the entries list is empty, but the last_entry_id is still
# populated.

# if needed, you can further validate that the correct entries and number of
# entries is returned by comparing with the contents in etcd:
cp-etcdctl get --sort-by key --prefix /task_log_messages/<db id>/<task id> --keys-only | sort -u | tail -n +2
```

PLAT-367
@jason-lynch jason-lynch requested a review from mmols December 19, 2025 15:46
@jason-lynch jason-lynch merged commit b739f61 into main Dec 19, 2025
2 checks passed
@jason-lynch jason-lynch deleted the fix/PLAT-367/task-log-pagination branch December 19, 2025 17:08
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.

3 participants