feat: strengthen risk controls and review workflows

This commit is contained in:
hectorzhao
2026-07-26 13:08:12 +08:00
parent b461532075
commit 2ce682c3fc
34 changed files with 2167 additions and 390 deletions
+26
View File
@@ -173,6 +173,32 @@ func TestDisconnectChannelStopsSupplierPool(t *testing.T) {
}
}
func TestDisconnectDownstreamAccountEndpointIsAccountScoped(t *testing.T) {
handler := handlerWithServer(Server{})
resp := httptest.NewRecorder()
req := httptest.NewRequest(
http.MethodPost,
"/downstream/connections/disconnect",
strings.NewReader(`{"account":"100001","reason":"application_disabled"}`),
)
handler.ServeHTTP(resp, req)
if resp.Code != http.StatusOK {
t.Fatalf("unexpected response status: %d body=%s", resp.Code, resp.Body.String())
}
var payload struct {
Account string `json:"account"`
Disconnected int `json:"disconnected"`
}
if err := json.Unmarshal(resp.Body.Bytes(), &payload); err != nil {
t.Fatalf("decode response: %v", err)
}
if payload.Account != "100001" || payload.Disconnected != 0 {
t.Fatalf("unexpected downstream disconnect response: %+v", payload)
}
}
func TestRecoveryCandidatesEndpointReturnsView(t *testing.T) {
handler := handlerWithServer(Server{
RecoveryCandidates: func(context.Context) ([]inbound.DownstreamPresence, error) {