Skip to content

Commit cdcc0a4

Browse files
committed
cmd/loop: drop legacy text payload shim
Remove the temporary reader fallback that accepted the old text-based stdout and stderr payloads now that the recorded session corpus has been rewritten. The remaining code only handles the line-based layout and keeps the replay and recorder path focused on the final schema. Drop the transition-only test coverage alongside the shim. The steady-state tests continue to cover replay, blessing, and timestamp normalization against the converted fixtures.
1 parent 9bba6f0 commit cdcc0a4

2 files changed

Lines changed: 0 additions & 71 deletions

File tree

cmd/loop/session_fixture_update_test.go

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -571,32 +571,6 @@ func TestRewriteSessionFixtureSkipsNormalizedTimestampNoise(t *testing.T) {
571571
require.Equal(t, fixture, updated)
572572
}
573573

574-
// TestRewriteSessionFixtureCanonicalizesLegacyText verifies that bless mode
575-
// rewrites legacy text payloads into the canonical line-based layout even when
576-
// the visible output is unchanged.
577-
func TestRewriteSessionFixtureCanonicalizesLegacyText(t *testing.T) {
578-
fixture := sessionFile{
579-
Events: []sessionEvent{
580-
legacyTextEvent(t, 2, eventStdout, "hello\nworld\n"),
581-
exitEvent(t, 3, nil),
582-
},
583-
}
584-
585-
updated, changed, err := rewriteSessionFixture(fixture,
586-
replayedSessionOutput{
587-
stdout: "hello\nworld\n",
588-
stdoutChunks: []string{"hello\nworld\n"},
589-
},
590-
)
591-
require.NoError(t, err)
592-
require.True(t, changed)
593-
require.Equal(t, "hello\nworld\n", textEventText(t, updated.Events[0]))
594-
595-
var payload textPayload
596-
require.NoError(t, json.Unmarshal(updated.Events[0].Data, &payload))
597-
require.Equal(t, []string{"hello\n", "world\n"}, payload.Lines)
598-
}
599-
600574
// textEvent builds a text session event for tests.
601575
func textEvent(t *testing.T, timeMS int64, kind, text string) sessionEvent {
602576
t.Helper()
@@ -611,24 +585,6 @@ func textEvent(t *testing.T, timeMS int64, kind, text string) sessionEvent {
611585
}
612586
}
613587

614-
// legacyTextEvent builds a legacy text payload for transition tests.
615-
func legacyTextEvent(t *testing.T, timeMS int64, kind, text string) sessionEvent {
616-
t.Helper()
617-
618-
data, err := json.Marshal(struct {
619-
Text string `json:"text"`
620-
}{
621-
Text: text,
622-
})
623-
require.NoError(t, err)
624-
625-
return sessionEvent{
626-
TimeMS: timeMS,
627-
Kind: kind,
628-
Data: data,
629-
}
630-
}
631-
632588
// exitEvent builds an exit session event for tests.
633589
func exitEvent(t *testing.T, timeMS int64, runError *string) sessionEvent {
634590
t.Helper()

cmd/loop/session_recorder.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -107,33 +107,6 @@ func (p textPayload) text() string {
107107
return joinTextLines(p.Lines)
108108
}
109109

110-
// UnmarshalJSON accepts the current line-based layout and the previous
111-
// text-based layout so fixtures can be transitioned in place.
112-
func (p *textPayload) UnmarshalJSON(data []byte) error {
113-
var payload struct {
114-
Lines []string `json:"lines"`
115-
Text *string `json:"text"`
116-
}
117-
if err := json.Unmarshal(data, &payload); err != nil {
118-
return err
119-
}
120-
121-
switch {
122-
case payload.Lines != nil:
123-
p.Lines = append([]string(nil), payload.Lines...)
124-
125-
return nil
126-
127-
case payload.Text != nil:
128-
p.Lines = splitTextLines(*payload.Text)
129-
130-
return nil
131-
132-
default:
133-
return errors.New("missing text payload lines")
134-
}
135-
}
136-
137110
// stdinPayload records stdin chunks.
138111
type stdinPayload struct {
139112
Text string `json:"text"`

0 commit comments

Comments
 (0)