fix(IW-517): the GitLab CI gate reads every pipeline at a commit #559
No reviewers
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli!559
Loading…
Reference in a new issue
No description provided.
Delete branch "IW-517"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The GitLab CI gate judged a commit on one pipeline and could report
Greenwhile another pipeline on the same commit was still running.
iw phase-pr,iw phase-mergeandiw ci-gateall share that gate, so on GitLab the"CI is green, safe to merge" contract could be false.
GitLabClient.fetchCiSnapshotbuilt itsCiSnapshotfrom the merge request'shead_pipeline, which names at most one pipeline. GitLab routinely startsseveral pipelines for one push (a
pushpipeline and amerge_request_eventpipeline). Every pipeline but one was invisible to the gate, whatever its state.
GitHub and Forgejo enumerate runs and were never affected.
Defects fixed
Phase 1 — the GitLab snapshot holds at most one pipeline (PR #554, merged)
GitLabClientnow readsGET projects/:id/merge_requests/:iid/pipelines?per_page=100and maps every entry to a
CiRun.head_pipelineis no longer read.Leftrather than defaulting a field.incomplete, which the model already refuses to judge.CiRuncarries its pipeline id asworkflowLabel, so two pipelines atone commit survive
dedupeas two separate answers.core/model/CiGate.scalais unchanged by design — the model was already correct;it could not judge a pipeline it was never handed.
docs/plans/2026-08-11-ci-green-gate.md§G2 records the decision this reverses.Behaviour changes a GitLab user meets
canceledsibling pipeline at the same sha now reads as Red and stopsthe phase. This is the safe direction.
Testing
core/test/GitLabCiTest.scala; the 4 pre-existingfetchCiSnapshottests were repaired for the new endpoint, not weakened. Areviewer confirmed this by mutation.
./mill core.test.testOnly 'iw.tests.GitLabCiTest'— exit 0, 187 tests../iw ./test unit— exit 0../iw ./test lint— exit 0../iw ./test— exit 1 ontest/start.bats"the tmux session does not carryiw's internal plumbing". That failure reproduces at the phase baseline in a
clean worktree, asserts on tmux pane environment, and has no causal path to
this change. Filed as #556.
Follow-ups filed
test/start.batstmux-plumbing test fails at baseline on this machineGitLabClient.parseMrPipelinehas no production caller; removal needs approvalGitLabClient.encodedRepounder-escapes repository slugsRelease notes
project-management/issues/IW-517/release-notes.md(Czech) describes the changefor users of
phase-pr,phase-mergeandci-gate.🤖 Generated with Claude Code