mavend: carry ResolvedBy through dialogue Slots bridge
Add ResolvedBy to dialogue.Slots and the toDialogueSlots/ applyDialogueSlots converters. Skip reflect-type check for this field in parity test (dialogue cannot import router: import cycle).
This commit is contained in:
@@ -31,6 +31,12 @@ func TestSlotsParity(t *testing.T) {
|
||||
t.Errorf("router.Slots.%s (%s) missing from dialogue.Slots", name, typ)
|
||||
continue
|
||||
}
|
||||
// ResolvedBy is ActionResolutionMethod in router and string in dialogue
|
||||
// (dialogue cannot import router: import cycle). The underlying type is
|
||||
// string in both; skip the reflect-type check for this field.
|
||||
if name == "ResolvedBy" {
|
||||
continue
|
||||
}
|
||||
if dt != typ {
|
||||
t.Errorf("field %s: router has %s, dialogue has %s", name, typ, dt)
|
||||
}
|
||||
@@ -47,15 +53,16 @@ func TestSlotsParity(t *testing.T) {
|
||||
// populated value and compare.
|
||||
func TestSlotsRoundTrip(t *testing.T) {
|
||||
full := router.Slots{
|
||||
Time: time.Date(2026, 8, 2, 11, 0, 0, 0, time.UTC),
|
||||
HasTime: true,
|
||||
Fn: "restart",
|
||||
Args: []string{"nginx"},
|
||||
HasFn: true,
|
||||
Key: "water",
|
||||
Value: `"drank"`,
|
||||
HasKey: true,
|
||||
Text: "выпил воды",
|
||||
Time: time.Date(2026, 8, 2, 11, 0, 0, 0, time.UTC),
|
||||
HasTime: true,
|
||||
Fn: "restart",
|
||||
Args: []string{"nginx"},
|
||||
HasFn: true,
|
||||
ResolvedBy: router.ActionResolutionGrammarMatcher,
|
||||
Key: "water",
|
||||
Value: `"drank"`,
|
||||
HasKey: true,
|
||||
Text: "выпил воды",
|
||||
}
|
||||
// Every field must be non-zero, or the round-trip proves nothing.
|
||||
rv := reflect.ValueOf(full)
|
||||
|
||||
Reference in New Issue
Block a user