Skip to content

fix: advance log cursor when next_page is null in follow mode#19

Merged
ClayMav merged 2 commits intomainfrom
fix/follow-logs-no-reprint
Apr 8, 2026
Merged

fix: advance log cursor when next_page is null in follow mode#19
ClayMav merged 2 commits intomainfrom
fix/follow-logs-no-reprint

Conversation

@ClayMav
Copy link
Copy Markdown
Member

@ClayMav ClayMav commented Apr 8, 2026

Summary

  • Bug: job-runs logs <id> --follow reprinted all logs from the current cursor on every poll when the API returned next_page: null, instead of only printing new lines.
  • Root cause: followLogs only advanced the cursor when next_page was present and non-null. When the API had no more pages (null), the cursor stayed unchanged, causing the same logs to be re-fetched and reprinted on the next iteration.
  • Fix: Advance cursor by the count of items received when next_page is absent, so subsequent polls start after already-printed lines.

Commits

  1. fix: advance log cursor when next_page is null in follow mode — the one-line fix in followLogs
  2. test: add regression test for follow-logs cursor advancement — verifies each log line is printed exactly once

Testing

  • New test TestJobsLogsFollowDoesNotReprintWhenNextPageNull covers the exact scenario
  • Full test suite passes (make test)

Fixes BUG-1930

ClayMav added 2 commits April 8, 2026 09:55
When `followLogs` polled for logs and the API returned items with
`next_page: null` (no more pages available yet), the cursor stayed
unchanged. On the next poll iteration the same logs were re-fetched
and reprinted. Fix by advancing cursor by the number of items received
when next_page is absent.

Fixes BUG-1930
Verifies that `job-runs logs --follow` prints each log line exactly
once when the API returns items with next_page=null, preventing the
re-print regression.
@ClayMav ClayMav marked this pull request as ready for review April 8, 2026 17:06
@ClayMav ClayMav requested a review from a team as a code owner April 8, 2026 17:06
@ClayMav ClayMav requested a review from kcheng486 April 8, 2026 17:06
@ClayMav ClayMav merged commit 57415c2 into main Apr 8, 2026
1 check passed
@ClayMav ClayMav deleted the fix/follow-logs-no-reprint branch April 8, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants