User authorized lifting CURRENT FAV whole-branch merge protection on 2026-09-23. Keep FAV_DEGRADED_READ/FAV_PUBLISHER_ENABLED default false. Drop duplicate goose 00034 (local_dev already has 00036). Preserve agentx workspace admin routes and pin-export wiring.
40 lines
1.3 KiB
Go
40 lines
1.3 KiB
Go
package artifactvault
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestBackfillIdempotentNoWorkspace(t *testing.T) {
|
|
ctx := context.Background()
|
|
reg := NewMemoryRegistry()
|
|
now := time.Now().UTC()
|
|
row := TerminalRow{
|
|
Facts: Facts{ArtifactType: TypeSealedVersion, VersionStatus: "sealed", SealedAt: &now, HeadSnapshotID: 1, Classification: ClassificationOK, Payload: []byte("snap")},
|
|
Request: PublishRequest{ArtifactType: TypeSealedVersion, Environment: "dev", ProjectExternalKey: "p", LogicalResourceID: "doc1", SourceEventKind: "seal", SourceEventID: "e1", Payload: []byte("snap"), TerminalState: "sealed"},
|
|
}
|
|
r1, err := Backfill(ctx, reg, []TerminalRow{row, row}, nil)
|
|
if err != nil || r1.Created != 1 || r1.Reused != 1 {
|
|
t.Fatalf("%+v %v", r1, err)
|
|
}
|
|
r2, _ := Backfill(ctx, reg, []TerminalRow{row}, nil)
|
|
if r2.Created != 0 && r2.Reused == 0 {
|
|
t.Fatalf("rerun %+v", r2)
|
|
}
|
|
missing := row
|
|
missing.MissingEvidence = true
|
|
missing.Request.LogicalResourceID = "doc-missing"
|
|
r3, _ := Backfill(ctx, reg, []TerminalRow{missing}, nil)
|
|
if r3.Quarantine != 1 {
|
|
t.Fatalf("quarantine %+v", r3)
|
|
}
|
|
ex := row
|
|
ex.Request.LogicalResourceID = "doc-ex"
|
|
ex.Request.SourceEventID = "e-ex"
|
|
r4, _ := Backfill(ctx, reg, []TerminalRow{ex}, map[string]string{"doc-ex": "approved-old"})
|
|
if r4.Excluded != 1 {
|
|
t.Fatalf("exclude %+v", r4)
|
|
}
|
|
}
|