Files
executus/pendingattach/pendingattach_test.go
steve ca243a2d50
executus CI / test (push) Failing after 24s
P0: stand up executus harness module above majordomo
Batteries-included agent-harness base, extracted from mort's agent layer.
This first cut establishes the module + the zero-coupling core primitives:

- lane, dispatchguard, pendingattach, run/progress.go: moved verbatim from mort
- config: host config Source seam + env-var default (nil-safe helpers)
- deliver: output-egress seam + Discard/Stdout defaults
- identity: AdminPolicy + MemberResolver seams (nil-safe)
- fanout: programmatic N×M swarm (bounded global + per-key concurrency)
- README/CLAUDE.md with the vibe-coded banner; CI with Go gates +
  the "core stays majordomo+stdlib only" invariant

Core builds with stdlib only today; majordomo enters at P1 (model/structured).
go build/vet/test -race all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 19:18:37 -04:00

36 lines
896 B
Go

package pendingattach
import "testing"
func TestDedupe_CollapsesByFileID(t *testing.T) {
rows := []Attachment{
{ID: "1", FileID: "a", Ord: 0},
{ID: "2", FileID: "b", Ord: 1},
{ID: "3", FileID: "a", Ord: 2}, // dup of file a
}
out := Dedupe(rows)
if len(out) != 2 {
t.Fatalf("want 2 rows, got %d: %+v", len(out), out)
}
if out[0].ID != "1" || out[1].ID != "2" {
t.Fatalf("first-wins order not preserved: %+v", out)
}
}
func TestDedupe_EmptyFileIDNeverCollapsed(t *testing.T) {
rows := []Attachment{
{ID: "1", FileID: ""},
{ID: "2", FileID: ""},
}
if got := Dedupe(rows); len(got) != 2 {
t.Fatalf("empty FileID rows must not collapse, got %d", len(got))
}
}
func TestDedupe_ShortInputPassthrough(t *testing.T) {
rows := []Attachment{{ID: "1", FileID: "a"}}
if got := Dedupe(rows); len(got) != 1 {
t.Fatalf("single row should pass through, got %d", len(got))
}
}