detached 1e8ab59

test(workflow): pin Ancestors on cycles and unknown needs, describe the cut-down fixture

commit
1e8ab595185801f4fbf95ee8f49075975ab8dcdd
author
brice · · 2026-10-13 03:30 UTC
committer
brice · · 2026-10-18 14:59 UTC
parent
8e90c04
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +15 -1
M workflow/job_eval_test.go +15 -1
@@ -202,7 +202,9 @@ jobs:
202202 }
203203 }
204204
205-// needsFailedDependency is the workflow of the recorded scenario of that name.
205+// needsFailedDependency is a cut-down workflow of the recorded scenario of
206+// that name (without with-failure, with-success and broken's outputs), plus a
207+// made-up diamond job that GitHub did not run.
206208 const needsFailedDependency = `on:
207209 push:
208210 branches: ['scn/**']
@@ -254,3 +256,15 @@ func TestAncestors(t *testing.T) {
254256 }
255257 }
256258 }
259+
260+// TestAncestorsCycleAndUnknownNeed covers what Parse rejects but a hand-built
261+// Workflow may hold: a cycle ends, the start job and unknown ids are left out.
262+func TestAncestorsCycleAndUnknownNeed(t *testing.T) {
263+ w := &Workflow{Jobs: []*Job{
264+ {ID: "a", Needs: []string{"b", "ghost"}},
265+ {ID: "b", Needs: []string{"a"}},
266+ }}
267+ if got := w.Ancestors("a"); !reflect.DeepEqual(got, []string{"b"}) {
268+ t.Errorf("Ancestors(a) = %q, want [b]", got)
269+ }
270+}
@@ -202,7 +202,9 @@ jobs:
202 }202 }
203 }203 }
204 204
205-// needsFailedDependency is the workflow of the recorded scenario of that name.205+// needsFailedDependency is a cut-down workflow of the recorded scenario of
206+// that name (without with-failure, with-success and broken's outputs), plus a
207+// made-up diamond job that GitHub did not run.
206 const needsFailedDependency = `on:208 const needsFailedDependency = `on:
207 push:209 push:
208 branches: ['scn/**']210 branches: ['scn/**']
@@ -254,3 +256,15 @@ func TestAncestors(t *testing.T) {
254 }256 }
255 }257 }
256 }258 }
259+
260+// TestAncestorsCycleAndUnknownNeed covers what Parse rejects but a hand-built
261+// Workflow may hold: a cycle ends, the start job and unknown ids are left out.
262+func TestAncestorsCycleAndUnknownNeed(t *testing.T) {
263+ w := &Workflow{Jobs: []*Job{
264+ {ID: "a", Needs: []string{"b", "ghost"}},
265+ {ID: "b", Needs: []string{"a"}},
266+ }}
267+ if got := w.Ancestors("a"); !reflect.DeepEqual(got, []string{"b"}) {
268+ t.Errorf("Ancestors(a) = %q, want [b]", got)
269+ }
270+}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 3

↑↓ moveenter openesc close