34 lines
1.2 KiB
Go
34 lines
1.2 KiB
Go
package reconcile_test
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"git.d-ma.be/mathias/tapir/internal/domain"
|
|
"git.d-ma.be/mathias/tapir/internal/reconcile"
|
|
)
|
|
|
|
// The reason a reconciliation was skipped is stored and shown on a page about a private
|
|
// recording, so it carries a kind, never the model's error text, which can echo the
|
|
// prompt (adversarial review F3).
|
|
|
|
func TestReconcile_TheBreakerReasonCarriesAKindNotTheModelsText(t *testing.T) {
|
|
adj := &scripted{fn: func(int, reconcile.Request) (reconcile.Verdict, error) {
|
|
return reconcile.VerdictBase, errors.New("gateway echoed the prompt: zebrakaka secret words")
|
|
}}
|
|
small := opts
|
|
small.BreakAfter = 2
|
|
|
|
out, err := reconcile.Reconcile(context.Background(), tr(progBase), tr(progAlt), adj, small)
|
|
|
|
require.NoError(t, err)
|
|
require.Equal(t, domain.ReconcileSkipped, out.Reconciliation.Status)
|
|
assert.NotContains(t, out.Reconciliation.Reason, "zebrakaka", "provider text must not be stored or shown")
|
|
assert.Contains(t, out.Reconciliation.Reason, "2 times in a row", "the reason still says what happened")
|
|
assert.Contains(t, out.Reconciliation.Reason, "error", "and carries a kind")
|
|
}
|