detached 65c7d3d

report the running version on every poll (#35)

commit
65c7d3d730202ff2b67b0393de6e8046b67ba6da
author
brice · · 2026-10-16 09:04 UTC
committer
bnema · · 2026-10-16 09:04 UTC
parent
9517f29
signature
SSH UnverifiedSHA256:VOCA5lYARHcbKDZ7GhTV45VmcjWnJ6ZQIBazj17LivA The key is unknown
2 files · +25 -1
M internal/host/runner.go +1 -1
@@ -142,7 +142,7 @@ func (r *Runner) Run(ctx context.Context) error {
142142 pollID = newPollID()
143143 }
144144 pctx, cancel := context.WithTimeout(ctx, t.PollTimeout)
145- resp, err := r.Poll.FetchJob(pctx, connect.NewRequest(&ermite.FetchJobRequest{PollId: pollID}))
145+ resp, err := r.Poll.FetchJob(pctx, connect.NewRequest(&ermite.FetchJobRequest{PollId: pollID, Version: r.Cfg.Version}))
146146 cancel()
147147 if err != nil {
148148 <-slots
@@ -142,7 +142,7 @@ func (r *Runner) Run(ctx context.Context) error {
142 pollID = newPollID()142 pollID = newPollID()
143 }143 }
144 pctx, cancel := context.WithTimeout(ctx, t.PollTimeout)144 pctx, cancel := context.WithTimeout(ctx, t.PollTimeout)
145- resp, err := r.Poll.FetchJob(pctx, connect.NewRequest(&ermite.FetchJobRequest{PollId: pollID}))145+ resp, err := r.Poll.FetchJob(pctx, connect.NewRequest(&ermite.FetchJobRequest{PollId: pollID, Version: r.Cfg.Version}))
146 cancel()146 cancel()
147 if err != nil {147 if err != nil {
148 <-slots148 <-slots
M internal/host/runner_test.go +24 -0
@@ -13,6 +13,7 @@ import (
1313 "regexp"
1414 "strconv"
1515 "strings"
16+ "sync"
1617 "testing"
1718 "time"
1819 "unicode/utf8"
@@ -1326,3 +1327,26 @@ func TestUnitMountNamespaceCheckSeesOptions(t *testing.T) {
13261327 t.Fatalf("%q", got)
13271328 }
13281329 }
1330+
1331+// Every poll carries the version of the running binary, so that the server's
1332+// runner list shows what runs now and not what registered.
1333+func TestPollReportsTheRunningVersion(t *testing.T) {
1334+ h := newHarness(t, simpleScript("x"))
1335+ var mu sync.Mutex
1336+ var seen []string
1337+ h.srv.pollHook = func(_ int, req *ermite.FetchJobRequest) (*ermite.FetchJobResponse, error) {
1338+ mu.Lock()
1339+ seen = append(seen, req.GetVersion())
1340+ mu.Unlock()
1341+ return nil, nil
1342+ }
1343+ h.run(t)
1344+ eventually(t, "two polls", func() bool { mu.Lock(); defer mu.Unlock(); return len(seen) >= 2 })
1345+ mu.Lock()
1346+ defer mu.Unlock()
1347+ for _, v := range seen {
1348+ if v != "test" {
1349+ t.Fatalf("poll versions %v, want the runner's own", seen)
1350+ }
1351+ }
1352+}
@@ -13,6 +13,7 @@ import (
13 "regexp"13 "regexp"
14 "strconv"14 "strconv"
15 "strings"15 "strings"
16+ "sync"
16 "testing"17 "testing"
17 "time"18 "time"
18 "unicode/utf8"19 "unicode/utf8"
@@ -1326,3 +1327,26 @@ func TestUnitMountNamespaceCheckSeesOptions(t *testing.T) {
1326 t.Fatalf("%q", got)1327 t.Fatalf("%q", got)
1327 }1328 }
1328 }1329 }
1330+
1331+// Every poll carries the version of the running binary, so that the server's
1332+// runner list shows what runs now and not what registered.
1333+func TestPollReportsTheRunningVersion(t *testing.T) {
1334+ h := newHarness(t, simpleScript("x"))
1335+ var mu sync.Mutex
1336+ var seen []string
1337+ h.srv.pollHook = func(_ int, req *ermite.FetchJobRequest) (*ermite.FetchJobResponse, error) {
1338+ mu.Lock()
1339+ seen = append(seen, req.GetVersion())
1340+ mu.Unlock()
1341+ return nil, nil
1342+ }
1343+ h.run(t)
1344+ eventually(t, "two polls", func() bool { mu.Lock(); defer mu.Unlock(); return len(seen) >= 2 })
1345+ mu.Lock()
1346+ defer mu.Unlock()
1347+ for _, v := range seen {
1348+ if v != "test" {
1349+ t.Fatalf("poll versions %v, want the runner's own", seen)
1350+ }
1351+ }
1352+}

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 4

Tags 11

↑↓ moveenter openesc close