Skip to content

feat: input-source abstraction — local + GitLab repos (capability-gated) - #63

Merged
adithya-s-k merged 3 commits into
mainfrom
feat/input-source-abstraction
Jun 15, 2026
Merged

feat: input-source abstraction — local + GitLab repos (capability-gated)#63
adithya-s-k merged 3 commits into
mainfrom
feat/input-source-abstraction

Conversation

@adithya-s-k

Copy link
Copy Markdown
Collaborator

Closes #59. Foundation for #62 (GitLab MR mining).

Summary

Introduces a source contract so --repo is no longer GitHub-only:

sources.py defines a Capability set per source (pull_requests / issues / commit_api) and each pipeline declares required_capabilities. cmd_generate gates incompatible combos up front with a clear, actionable error instead of failing deep in a run:

✗ pipeline 'pr_diff' needs ['pull_requests'], which a 'local' source does not
  provide. Pipelines that work on a 'local' source: ['code_instruct',
  'commit_runtime', 'equivalence_tests']. For PR/CVE-based pipelines, point
  --repo at a GitHub repo.

So: commit_runtime, code_instruct, equivalence_tests run on any source; pr_diff, pr_runtime, cve_patches require GitHub (PRs/CVEs don't exist in a bare clone).

Mechanics

  • RepoSpec.normalize_url accepts local paths + GitLab; adds source_kind and local-aware owner_name (('local', <dir>)).
  • resolve_repo_token dispatches by source: local → None (and no gh shell-out, so local works without gh installed); gitlab → $GITLAB_TOKEN; github → the existing chain.
  • auth_clone_url injects GitLab oauth2:<token>@; local/public pass through.
  • The GitHub-API language pre-flight is skipped for non-GitHub sources (bootstrap detects language from files).

Backwards compatibility

Bare owner/name and github.com URLs resolve to GitHub with the full capability set — identical behavior to before. No version bump.

Test plan

  • uv run pytest -q669 passed (+14 new in tests/test_sources.py), incl. a real local git-clone round-trip and the capability-gating contract. The lone unrelated failure (test_e2e_public_trl) fails identically on main.
  • Manual CLI smoke: generate --repo <local> --pipeline pr_diff is blocked with the message above; git-based pipelines accept the local path.
  • ruff check + ruff format --check clean.

Out of scope

  • GitLab MR mining for pr_diff/pr_runtime (Add GitLab support via a source-provider abstraction #62) — needs a GitLab MR API client.
  • Bitbucket — REST-only + scarce public-OSS test corpus; deferred.
  • Provenance reference links for local repos point at a synthetic github.com/local/<dir>/… — cosmetic, can refine later.

Adds a RepoSource contract so --repo accepts a GitHub owner/name, a
gitlab.com URL, or a local path (/abs, ./rel, ~, file://). RepoSpec
classifies the source; sources.py declares per-source Capabilities
(pull_requests / issues / commit_api) and each pipeline's
required_capabilities. cmd_generate gates incompatible combos up front
with a clear message — so pr_diff/pr_runtime/cve_patches are blocked on
local/GitLab (PRs/CVEs don't exist in a bare clone), while the git/source
pipelines (commit_runtime, code_instruct, equivalence_tests) run on any
source.

resolve_repo_token dispatches by source (local → no token + no `gh`
shell-out; gitlab → GITLAB_TOKEN; github → unchanged chain), and
auth_clone_url injects GitLab oauth2 tokens. The GitHub-API language
pre-flight is skipped for non-GitHub sources (bootstrap detects locally).

Fully backwards compatible: bare owner/name and github URLs resolve to
GitHub with the full capability set, exactly as before. GitLab MR mining
(pr_diff/pr_runtime on GitLab) is tracked in #62. Closes #59.
Make per-pipeline source support visible where users pick a pipeline:
'GitHub · GitLab · local' for the git/source pipelines, 'GitHub' for the
PR/CVE ones that the capability gate restricts.
commit_runtime is allowed on local/GitLab sources, but it called the
gh-based fetch_issue() unconditionally for any commit with a 'Closes #N'
trailer — which would crash on a non-GitHub source (bogus owner/name).
Gate the fetch on the ISSUES capability (GitHub-only) and wrap it
defensively so a missing/private issue falls back to the commit message
instead of aborting the run.
@adithya-s-k
adithya-s-k merged commit 9b2fc92 into main Jun 15, 2026
5 checks passed
@adithya-s-k
adithya-s-k deleted the feat/input-source-abstraction branch June 15, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repo2RLEnv on a Local Repository

1 participant