fix: address session adopt review findings · Entire
fix: address session adopt review findings
Sessions
b7f863b91041View transcript
Changes
2
cmd/entire/cli
Msession_adopt.go+8/-1
Msession_adopt_test.go+6/-2
96 unmodified lines
97
98
99
100
101
102
103
129 unmodified lines
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
1 unmodified line
249
250
251
245
252
253
254
255
96 unmodified lines
return nil
}
fmt.Fprintf(w, "Tracking %d file(s): %s\n", len(filesTouched), strings.Join(filesTouched, ", "))
fmt.Fprintln(w, "Review tracked files before committing; adoption attributes current changes in this repo to the adopted session.")
return nil
}
129 unmodified lines
adopted.Branch = branch
adopted.LastInteractionTime = &now
adopted.FilesTouched = filesTouched
// Reset target-local checkpoint bookkeeping. Source checkpoint IDs can point
// at metadata in another repository or checkpoint branch; carrying them into
// this repo would let amend and turn-finalization paths operate on unrelated
// checkpoints.
adopted.TurnCheckpointIDs = nil
adopted.LastCheckpointID = id.EmptyCheckpointID
adopted.LastCheckpointCommitHash = ""
adopted.FullyCondensed = false
adopted.DivergenceNoticeShown = false
adopted.UntrackedFilesAtStart = nil
1 unmodified line
adopted.PendingPromptAttribution = nil
adopted.PromptWindowBase = 0
adopted.PromptWindowResetPending = false
adopted.AttachedManually = true
adopted.AttachedManually = false
return &adopted, filesTouched, nil
}
Mcmd/entire/cli/session_adopt.go+8/-1
42 unmodified lines
43
44
45
46
47
48
49
30 unmodified lines
80
81
82
82
83
83
84
85
86
87
4 unmodified lines
92
93
94
95
96
97
98
99
100
42 unmodified lines
LastPrompt: "update target file",
FilesTouched: []string{"source-only.txt"},
TurnCheckpointIDs: []string{"abc123def456"},
AttachedManually: true,
}); err != nil {
t.Fatal(err)
}
30 unmodified lines
if adopted.TranscriptPath != transcriptPath {
t.Fatalf("TranscriptPath = %q, want %q", adopted.TranscriptPath, transcriptPath)
}
if !adopted.AttachedManually {
t.Fatal("expected adopted session to be marked manual")
}
if adopted.AttachedManually {
t.Fatal("adopted active sessions should not be marked manually attached")
}
if len(adopted.FilesTouched) != 1 || adopted.FilesTouched[0] != "feature.txt" {
t.Fatalf("FilesTouched = %v, want [feature.txt]", adopted.FilesTouched)
}
4 unmodified lines
if !bytes.Contains(out.Bytes(), []byte("Adopted session")) {
t.Fatalf("output = %q, want adoption confirmation", out.String())
}
if !bytes.Contains(out.Bytes(), []byte("Review tracked files before committing")) {
t.Fatalf("output = %q, want tracked-file attribution warning", out.String())
}
}
func TestSessionAdopt_EnablesPrepareCommitMsgTrailer(t *testing.T) {