Himanshu Kumar describes a regression test for the GitLab CLI in A job retry should not hide the next job in GitLab CI. The example asks what happens to the rest of a pipeline view when two entries represent attempts at the same job.
Check the rows that follow a retry
The test feeds the view helper a unit test job, a second attempt at that job, and an entry standing in for a downstream pipeline trigger. The expected display contains the second attempt followed by the trigger. The old helper produced the second attempt alone. A test that inspected just the first output row would have missed the missing trigger.
The helper used the first duplicate's index to size its output. That index made sense as a cutoff only if every subsequent row was also a retry. In the example, the downstream entry falls after the cutoff even though it has its own identity.
Test order and identity separately
The revised helper assigns an output position the first time it encounters a stage and job name. A later entry for the same pair replaces the value at that position. A distinct pair receives its own position wherever it appears in the input. This preserves first-seen order while retaining the last supplied value for each pair. The ordering guarantee applies to the sequence handed to the helper.
A separate test deals with job identity. Stage names and job names are now stored in separate fields of a Go struct. That means stage ab with job c and stage a with job bc can both appear even though joining their names yields the same string.
Keep the regression in context
GitLab's pipeline jobs endpoint excludes prior attempts by default, and the CLI uses that default. The regression uses synthetic input to establish how the helper should behave if it receives prior attempts. The merge request records both the test for the downstream entry and the test for colliding names. GitLab CLI merge request