5.6 KiB
5.6 KiB
id, title, status, wave, depends_on, plan, requirements, acceptance_criteria, system_design
| id | title | status | wave | depends_on | plan | requirements | acceptance_criteria | system_design | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01-pr-base-identity | Preserve qualified PR base identity | done | 1 | plan.md |
|
|
|
Task 01: Preserve qualified PR base identity
Summary
Preserve provider repository, branch, and base OID through the PR base resolver. Resolve the namespace from the exact attachment instead of assuming origin.
In scope
- Introduce a typed resolver result that reuses validated
ComparisonTargetidentity and carries a transient optional observed OID. - Retain
base.sha/baseRefOidacross REST and GraphQL conversion. Keepgh pr view/list --jsonwithin the supported CLI field set; read the base OID throughgh apiREST becausebaseRefOidis not a supported CLI field. - Validate namespace, number, head repository, and checkout branch together. Use existing exact task-PR associations for legacy attachments. For a contribution attached to the PR base, validate the head against its source repository and the target against the attachment.
- Preserve validated stored targets on provider outage. Reject known cross- repository inputs that lack a valid target. Preserve same-repository fallback.
- Add the failing executor regression before changing the resolver contract.
Out of scope
Git materialization, recovery mutation, database migrations, and public UI.
Acceptance
TestResolveTaskRepoInfo_PRBaseUsesTargetRepositoryqueries upstream, even when the fork has an unrelated PR with the same number.- Provider conversion tests retain target branch/OID and reject incomplete or mismatched identity. Same-repository and non-PR tests still pass.
- A legacy attachment with no stored
comparison_targetrejects a same-number, same-branch PR from another head repository. gh pr view/list --jsonrequests contain no unsupportedbaseRefOidfield;GetPRreads the base SHA throughgh apiwithout losing the PR on a non-cancellation OID-read error.- A live retarget changes only the intended launch target. An ambiguous or historical association cannot change another attachment.
Verification
(cd apps/backend && go test ./internal/github ./internal/backendapp ./internal/orchestrator/executor -run 'Test(PRBase|ResolveTaskRepoInfo|GithubPRBase)' -count=1)
(cd apps/backend && go test ./internal/github ./internal/orchestrator/executor -count=1)
git diff --check
Use the named prefixes for new tests so the focused command executes them. Record the expected red regression before the implementation and green results.
Files likely touched
apps/backend/internal/github/models.goapps/backend/internal/github/pat_client.goapps/backend/internal/github/gh_client.goapps/backend/internal/github/graphql.goapps/backend/internal/github/pr_base_identity_test.go(new)apps/backend/internal/backendapp/orchestrator.goapps/backend/internal/backendapp/pr_base_resolver_test.go(new)apps/backend/internal/orchestrator/executor/executor.goapps/backend/internal/orchestrator/executor/executor_resume.goapps/backend/internal/orchestrator/executor/executor_pr_base_resolver_test.goapps/backend/internal/task/models/pr_base.go(new transient contract)
Dependencies
None. Read the current task-PR matching and comparison reconciliation helpers.
Risks
A bare PR number can identify an unrelated fork PR. Query success is not proof of ownership. Custom REST decoding must preserve the new SHA field.
Parallelism
sequential
Inputs
- Worktree base refresh design: Identity and provider lookup.
github/service_comparison_target.goandtask/models/comparison_target.go.- Existing executor PR-base tests and the plan's temporary reproduction.
Results
- The initial fork/upstream regression failed as expected: the resolver queried
fork-owner/widgetsinstead ofupstream/widgetsfor PR #42. - The permanent tests cover upstream lookup, live retargeting, rejection of a
colliding PR with a different head repository, exact TaskPR selection, and
REST/GraphQL base OID conversion. GH CLI command-contract tests verify its
supported
pr view/list --jsonfields and REST base SHA/ref/repository read. go test ./internal/github ./internal/backendapp ./internal/orchestrator/executor -run 'Test(PRBase|ResolveTaskRepoInfo|GithubPRBase)' -count=1: passed.go test ./internal/github ./internal/backendapp ./internal/orchestrator/executor -count=1: passed.git diff --check: passed.- Review correction: the GH CLI does not support
baseRefOidin its JSON field list.GetPRreads base SHA, ref, and repository identity throughgh api; PR view/list keep the existing supported fields, and a REST read failure does not discard otherwise usable PR details. Command-contract tests cover these paths. - Review correction: live legacy PR data must match both the attached head repository and checkout branch. Contribution bindings use the validated source repository for that head check and the attachment for the target.
- Review correction: GitHub repository records store
ProviderHostas an HTTPS URL. Identity normalization accepts that canonical form without accepting custom ports, paths, or lookalike domains; regression tests cover both the supported host and rejected variants.