Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Remove repository tab polling and rename Code to Source

cc7faea36a31373079df8fce68c1bc20a44873a0 · Keenan Nemetz · 3d ago · parent 0a12642f

Remove repository tab polling and rename Code to Source

The tab row no longer polls its open counts, so the /{name}/counts endpoint, its htmx trigger, and the badge animation are gone. The unfocused-window note has been removed while the other live regions still pause.

The Code tab is now Source, served at /{name}/source; links, sitemap entries, markdown tree links, and tests follow the new route.

server/issues_changes_test.go −59

@@ -1366,65 +1366,6 @@ func TestLandingRedirectsToTheRequestPage(t *testing.T) {
1366 1366 }
1367 1367 }
1368 1368
1369 // The header polls the two tab counts so a reader watching a repository sees new
1370 // issues and changes arrive without a reload. The poll must answer with the two
1371 // badges alone: an out-of-band update leaves the page, its current tab and
1372 // anything the reader typed where they were.
1373 func TestRepoTabCountsPollOutOfBand(t *testing.T) {
1374 t.Parallel()
1375 f := newFixture(t)
1376 f.publish(f.repo)
1377 files := map[string]string{
1378 "issues/01M5JR2JK29KKMAA1T9MDNTPD1/issue.md": issueFile("Open thing", "keenan", "open", "2026-10-22T21:00:00Z", []string{"bug"}, "body\n"),
1379 "issues/01M5JR2JK29KKMAA1T9MDNTPD2/issue.md": issueFile("Closed thing", "keenan", "closed", "2026-10-22T21:00:00Z", []string{"bug"}, "body\n"),
1380 }
1381 work := f.issuesRepo(t, files)
1382 if _, errs, err := f.git(work, "push", f.sshURL(f.repo), "HEAD:refs/heads/vole"); err != nil {
1383 t.Fatalf("push: %s", errs)
1384 }
1385
1386 // The page is what the poll has to keep in step: the badges it names, and the
1387 // request that refreshes them while the page is visible.
1388 code, page := f.get("/" + f.repo + "/issues")
1389 if code != http.StatusOK {
1390 t.Fatalf("issue page: %d", code)
1391 }
1392 for _, want := range []string{
1393 `id="repo-issue-count"`,
1394 `id="repo-request-count"`,
1395 `hx-get="/` + f.repo + `/counts"`,
1396 `hx-trigger="every 30s, vole-refresh from:body"`,
1397 } {
1398 if !strings.Contains(page, want) {
1399 t.Fatalf("the repository header does not show %q:\n%s", want, page)
1400 }
1401 }
1402
1403 // The answer is only the badges, each replacing itself out of band. Both are
1404 // present on every poll, so a count that did not move is not left stale.
1405 resp, body := f.htmxGet(t, "/"+f.repo+"/counts", "")
1406 if resp.StatusCode != http.StatusOK || strings.Contains(body, "<!doctype html>") {
1407 t.Fatalf("counts poll = %d:\n%s", resp.StatusCode, body)
1408 }
1409 for _, want := range []string{
1410 `id="repo-issue-count" hx-swap-oob="outerHTML">1<`,
1411 `id="repo-request-count" hx-swap-oob="outerHTML">0<`,
1412 } {
1413 if !strings.Contains(body, want) {
1414 t.Fatalf("counts poll does not replace %q:\n%s", want, body)
1415 }
1416 }
1417 if got := strings.Count(body, "hx-swap-oob"); got != 2 {
1418 t.Fatalf("counts poll replaced %d elements, want 2:\n%s", got, body)
1419 }
1420
1421 // A repository the reader cannot see answers like a missing one, so the poll
1422 // cannot be used to discover private repositories.
1423 if resp, _ := f.htmxGet(t, "/no-such-repo/counts", ""); resp.StatusCode != http.StatusNotFound {
1424 t.Fatalf("counts for an unknown repository = %d, want 404", resp.StatusCode)
1425 }
1426 }
1427
1428 1369 // TestIssueListShowsActivityColumnsAndSortsByUpdated: the list is read for what
1429 1370 // moved, so the row carries the opening under the title, labels in their own
1430 1371 // column, people as people, and the time of the last edit or comment.