The GitLab baseline lookup listed the project's 100 most recent
successful jobs and filtered them client-side by name and ref. GitLab's
jobs endpoint has no server-side ref or name filter, so that single page
is the entire search space -- and on a busy project it covers very little
wall-clock time. On a self-hosted instance the window measured 82
minutes, while baselines were published roughly once a day. The lookup
therefore returned null almost always, and every developer silently fell
back to recording a local baseline.
Query pipelines instead, which does filter by ref and status server-side,
then walk the default branch's successful pipelines newest-first until
one contains a successful job with the configured name.
This also aligns the lookup with what the download actually resolves.
`glab job artifact <ref> <job>` reads from the latest successful
*pipeline* for the ref, so a successful job inside a failed pipeline was
never downloadable even when the old lookup returned it.
Extract BaselineSync into a provider architecture with an abstract
BaseRemote class and concrete GitHubRemote/GitLabRemote implementations.
GitLab support uses the glab CLI to fetch TIA baselines from CI
pipelines. The GitLabRemote queries the GitLab API for the latest
successful job matching the configured name on the default branch,
then downloads artifacts via `glab job artifact`.
Self-hosted GitLab instances are supported automatically: any
non-GitHub remote is detected as GitLab when the glab CLI is
installed, with authentication validated at fetch time.
Key changes:
- BaseRemote abstract class holds shared logic: CLI existence/auth
checks, error classification, git remote URL parsing, and default
branch resolution
- GitHubRemote extracts existing gh CLI logic unchanged
- GitLabRemote adds glab CLI support with default job name
`tia-baseline`, configurable via `->baselined(job: "name")`
- BaselineSync becomes a provider-agnostic orchestrator that iterates
registered remotes to detect the matching CI provider
- Configuration::baselined() accepts optional `job` parameter for
GitLab job name customization
- GitLab job query filters by both job name and default branch ref
to ensure cache key matches downloaded artifact