droboticflow/internal/api/supplier_public_workflow_test.go
d-robotics 58e0e50570 🧪 Retro 2026-10-12: CI gate, known-failure baselines, devboot regression test, workbench smoke, review standards
Six follow-ups from the round8-12 hotfix retrospective:

- web-ci.yml: lint + Go/frontend tests on every push and PR (nothing ran
  app checks before; the round10 dev-mode regression shipped green)
- tests/known-failures.json + check-test-baseline.mjs: gate by exact
  failing-test id instead of hand-counted failure totals (14 frontend,
  70 Go upstream debts recorded from the dev tip)
- devboot.test.mjs: boots the real Vite dev server and pins the movi
  loader contract that broke round10 (query-less DEV url, /vendor stays
  off the module pipeline)
- scripts/local/smoke-workbench.mjs: pre-release smoke covering the
  seven recurring acceptance points (login/pool/claim/play-while-loading/
  captions/4x/playhead), 3x green against the local replica
- docs/CODING_STANDARDS.md + AGENTS pointer: eligibility flags are
  server-shipped, the UI renders them (rounds 9+12 lesson)
- vendor README host-element quirks section, HANDOFF gate pointers and
  movi-path verification rule, perf-audit report pinned with the
  post-round12 production 500 observation
- husky pre-commit: lint-staged (repo prettier scope) + tsc + gofmt
- gofmt: restore lint:go green on the dev tip (drift shipped silently
  in the perf merge and round12 because nothing gated it)
2026-10-12 18:07:02 +05:30

50 lines
2.1 KiB
Go

package api
import (
"testing"
"droboticflow/internal/domain"
"droboticflow/internal/store"
)
func TestFanyuReleaseCreatesPublicSupplierPoolEvenWithOldSupplierInput(t *testing.T) {
ctx := t.Context()
ds := store.NewMemoryStore()
s := &server{store: ds}
project := domain.ProjectRecord{ID: "project-public-flow", OrganizationID: domain.DefaultOrganizationID}
template := domain.AnnotationTemplateRecord{ID: "human-public-template", OrganizationID: project.OrganizationID, ProjectID: project.ID, HumanStages: domain.DefaultFanyuV58HumanStages()}
if err := ds.UpsertAnnotationTemplate(ctx, template); err != nil {
t.Fatal(err)
}
release := domain.WorkflowReleaseRecord{Nodes: []domain.WorkflowNode{{Data: domain.WorkflowNodeData{OperatorID: "operator-builtin-annotation-gate", Hyperparams: []domain.HyperParam{
{Key: "ANNOTATION_TEMPLATE_ID", Value: template.ID},
{Key: "ANNOTATION_SUPPLIER_ID", Value: "old-bound-supplier"},
{Key: "PROCESSING_PROFILE", Value: domain.ProcessingProfileRawHuman},
}}}}}
public, err := s.releaseUsesFanyuSupplierPool(ctx, release)
if err != nil || !public {
t.Fatalf("Fanyu release public flag=%t err=%v", public, err)
}
supplier, issues, err := s.resolveProjectWorkflowSupplier(ctx, project, release, "old-bound-supplier")
if err != nil || len(issues) != 0 || supplier != "" {
t.Fatalf("new workflow remained bound: supplier=%q issues=%+v err=%v", supplier, issues, err)
}
bound := bindAnnotationSupplier(release.Nodes, supplier)
for _, param := range bound[0].Data.Hyperparams {
if param.Key == "ANNOTATION_SUPPLIER_ID" && param.Value != "" {
t.Fatalf("new workflow node still bound: %+v", param)
}
}
legacy := release
legacy.Nodes = bindAnnotationSupplier(release.Nodes, "old-bound-supplier")
for i := range legacy.Nodes[0].Data.Hyperparams {
if legacy.Nodes[0].Data.Hyperparams[i].Key == "PROCESSING_PROFILE" {
legacy.Nodes[0].Data.Hyperparams[i].Value = ""
}
}
public, err = s.releaseUsesFanyuSupplierPool(ctx, legacy)
if err != nil || public {
t.Fatalf("non-Fanyu release expanded to public pool: %t %v", public, err)
}
}