Repository navigation
Expand file tree
/
Copy pathchatv3_heldmove_test.go
More file actions
44 lines (40 loc) · 1.75 KB
/
Copy pathchatv3_heldmove_test.go
File metadata and controls
44 lines (40 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"errors"
"testing"
"github.com/Agent-Field/codeaf/internal/session"
)
// THE MOVE THAT COULD NOT WORK (2026-09-23). A window on today's build pressed
// enter on a conversation an older in-process window was holding. Its engine
// refused the journal with the sentence below, the surface's open door handed
// that sentence back as a bare string, and home — which takes the asking road
// only on [session.ErrSessionLocked] — printed "open codeaf here and press
// enter on it to move it here" instead of asking. The request was never
// written; nothing ever moved. The refusal has to arrive as the lock it is.
func TestAnEngineRefusingAHeldJournalOpensAsTheLockItIs(t *testing.T) {
workspace := "/home/somebody/api"
said := errors.New("engine: " + sessionHeldElsewhereSentence(workspace))
fleet := &engineFleet{
workspace: workspace,
dial: func(engineAsk) (*engineConn, error) {
return nil, said
},
}
_, err := fleet.open(workspace, workspace+"/conversation/transcript.jsonl")
if err == nil {
t.Fatal("a refused journal opened")
}
if !errors.Is(err, session.ErrSessionLocked) {
t.Fatalf("the engine's held-journal refusal reached the surface as %q, not as the lock home asks the holder about", err)
}
// AND IT STILL READS AS WRITTEN, for every door that prints it.
if err.Error() != said.Error() {
t.Fatalf("the refusal was reworded: %q", err)
}
// Every other refusal is left exactly as it came.
other := errors.New("engine: the workspace could not be opened")
fleet.dial = func(engineAsk) (*engineConn, error) { return nil, other }
if _, err := fleet.open(workspace, workspace+"/c/transcript.jsonl"); errors.Is(err, session.ErrSessionLocked) {
t.Fatalf("an unrelated refusal was read as a held journal: %v", err)
}
}