Files
Tosone 5c05104720 feat(coderepos): read branches on demand and track provider push time
A sync listed the branches of every repository it saw, one API call per
repository per page. For an account with a few hundred repositories that
alone exhausts the GitHub rate limit, and the result was stale the moment a
branch was pushed.

Store the provider's push time instead, and read branches only when a build
form asks for them:

- the daemon reconciles repositories and owners only; github, gitlab and
  gitea no longer page through branches, diffBranch is gone, and the
  code_repository_branches table and model are dropped from the baseline
- CodeRepository gains pushed_at, filled from github pushed_at, gitlab
  last_activity_at (falling back to updated_at) and gitea updated_at, and
  the list orders by it so "most recently active" means the provider's view
  rather than our own row's updated_at, which every sync touched
- ListCodeRepositoryBranches and GetCodeRepositoryBranch resolve the
  binding, the decrypted token and the repository, then query the provider,
  so branch names are always current; a repository id is user input and is
  now checked against the caller's binding instead of exposing another
  account's repository
- the list response also stops filling updated_at from created_at

Existing installations need the new column and the dropped table applied by
hand, as documented for the baseline migration edit.

Verification:
- go build -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./...
- CI_DATABASE_TYPE=turso go test -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./pkg/dal/repository/coderepo/... ./pkg/service/coderepos/... ./pkg/server/handlers/coderepos/... ./pkg/background/daemon/coderepo/...
- make gormgen
- make swagen
2026-10-27 22:47:28 +08:00
..
2026-08-01 20:32:49 +08:00
2026-08-01 20:32:49 +08:00
2026-08-01 20:32:49 +08:00
2026-08-01 20:32:49 +08:00
2026-08-01 20:32:49 +08:00
2026-08-01 20:32:49 +08:00
2026-08-01 20:32:49 +08:00
2026-08-01 20:32:49 +08:00
2026-08-01 20:32:49 +08:00
2026-08-01 20:32:49 +08:00