Files
archie/internal/domain/workflow/real_trees_test.go
T
sam 6ff239ee70 fix(daemon): resume a retry whose worktree is gone
prepareWorkspace chose between Manager.Prepare (refresh onto base) and a
separate Manager.Resume, and Manager.Resume only opened an
already-prepared clone. A remediation whose local worktree the terminal
cleanup removed, an expired volume dropped, or a different host never had
could therefore never be resumed, and the retry path had no way to select
the mode that continues pushed work.

Unify the two matched methods into Prepare(..., Target): Fresh resets onto
origin/<base>, a non-empty Target resets onto origin/<that branch>, and
either target clones a missing worktree. The daemon's retry path selects
the target from the task row and passes the persisted branch, so a resume
lands on the branch the open PR lives on and fails closed when it is not
on the remote.

Delete the container-mode no-op resume (hybridTrees.Resume and the
resumableTrees capability) now that the daemon owns it. The remediate
workflow no longer stages a resume, and the retired remediate.resume step
word stays resolvable as an inert stage: a stored definition is validated
as a whole collection, so a removed word would fail every workflow to
decode, not just its own.
2026-10-02 10:24:52 +10:00

21 lines
896 B
Go

package workflow
import (
"context"
"github.com/samcharles93/archie-core/internal/worktree"
)
// realTrees adapts a real worktree.Manager to the workflow's Trees contract for
// the tests that drive a stage against a real clone. Manager.Prepare carries
// the daemon's prepare target -- worktree.Fresh for a run that starts new work
// -- which the workflow's Trees contract deliberately does not expose, so the
// manager no longer satisfies Trees directly. Embedding keeps every other
// method; these tests never call Prepare, they only need the manager's git
// reads (Diff, ChangedFiles, ChangedFileStats).
type realTrees struct{ *worktree.Manager }
func (t realTrees) Prepare(ctx context.Context, owner, repo, base string, issue int, title, body, labels string) (string, string, error) {
return t.Manager.Prepare(ctx, owner, repo, base, issue, title, body, labels, worktree.Fresh)
}