Skip to content

Test Issue branch selection in-process behind a seam for its reads - #377

Merged
JacobStephens2 merged 2 commits into
mainfrom
issue-376
Oct 4, 2026
Merged

JacobStephens2 merged 2 commits into
mainfrom
issue-376

Conversation

@JacobStephens2

Copy link
Copy Markdown
Owner

Summary

Issue branch selection now reads origin, GitHub and the Launch directory through one private, read-only seam in src/branch.rs. ADR-0002's rules run in-process against an in-memory adapter.

 branch::select(launch, issue)        # public, unchanged
+  select_through(&GitHubAndOrigin { launch }, issue)
 branch::started(launch, issue)       # public, unchanged
+  started_through(&GitHubAndOrigin { launch }, issue)
 Selection::pr_base(given, checked_out)
+  pr_base_to(given, checked_out, progress::step)

+trait Reads                          # private
+  on_origin(first_branch)            # one `git ls-remote`, parsed to name + head
+  pull_requests(issue, first_branch) # one `gh pr list`
+  local_head(branch)                 # `git rev-parse --verify --quiet`

The branch-number rule stays in the rules, so issue-50 not counting for #5 is tested in-process. The cfg(test) InMemory adapter answers each listing by prefix, as git and GitHub do, and records every read.

The Run, the Ready issue search and the Claim are unchanged, and so are the git and gh calls.

Evidence

  • Before: every selection rule could only be checked by running the binary against a fake git and gh, end to end.
    After: 20 unit tests in branch::tests cover branch numbers, Fresh, Continuation, Refusals, Reads, Started and the PR's base. 8 end-to-end tests that checked only a rule or a refusal's wording were deleted:

    • tests/numbered_branches.rs: 6
    • tests/continuation.rs: 2

    Every required end-to-end keep is still there. cargo test, cargo clippy --all-targets -- -D warnings and cargo fmt --check pass.

Merge Danger

Door: two-way

The change is internal to one module and the public interfaces are unchanged, so a revert is clean.

Blast Radius: selection

A mistake in the production adapter would change which Issue branch a Run picks. The kept end-to-end tests cover each production read.

Unaddressed findings

Standards

  • InMemory owns its RefCell of reads and the read enum is Read, where src/ready.rs borrows seen and calls it Seen. Skipped: the owned form is simpler here because no progress sink shares the record. The adapter name now matches ready.rs (GitHubAndOrigin).
  • The test-only Pr and Picked types repeat PullRequest and Selection. Skipped: PullRequest and Selection derive neither Clone nor PartialEq, and adding derives to production types only for tests would widen them.
  • Both adapters must copy git's and GitHub's prefix matching. Skipped: the issue requires this, and the kept end-to-end tests check the production adapter against real output.

Spec

  • Deleting an_open_pr_on_branch_2_after_a_merged_issue_branch_is_continued drops a numbered-branch variant of the Continuation prompt check. Skipped: with_an_open_pr_the_continuation_prompt_asks_to_update_it still covers that prompt. What the deleted test added was a selection rule, which is now unit-tested.

Closes #376

🤖 Generated with Claude Code

JacobStephens2 and others added 2 commits October 4, 2026 18:47
)

Selection, the started check and the open pull request's base now read
origin, GitHub and the Launch directory through a private read-only seam,
with a production adapter making the same git and gh calls and an in-memory
adapter for unit tests. End-to-end tests that only checked a selection rule
or a refusal's wording are replaced by the unit tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2
JacobStephens2 merged commit ebd6ba7 into main Oct 4, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-376 branch October 4, 2026 23:02
@JacobStephens2 JacobStephens2 mentioned this pull request Oct 5, 2026
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.

Test Issue branch selection in-process behind a seam for its reads of origin, GitHub and the Launch directory

1 participant