Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
b646839
feat(sdk): recognize the Ban Credit waiver claim verdicts in all six …
purpshell Oct 26, 2026
78547bf
feat(sdk): drop the referral_group_send verdict and referralGroupSend…
purpshell Nov 10, 2026
7e22072
chore(sdk): pin the Ban Credit waiver contract to polymorfa#845 f70bfd00
purpshell Nov 10, 2026
48afadf
chore(sdk): re-pin the Ban Credit waiver contract to polymorfa#845 1c…
purpshell Nov 10, 2026
9ba1894
chore(sdk): re-pin the Ban Credit waiver contract to polymorfa#845 38…
purpshell Nov 10, 2026
998ecf7
docs(sdk): mark the pinned polymorfa#845 source as merged
purpshell Nov 10, 2026
0e2bee6
Merge origin/main into t3/ban-credit-waiver-verdicts
purpshell Nov 12, 2026
f04b326
Rebind documentation snippets to merged source
purpshell Nov 12, 2026
e04ea88
Format the ban credit waiver verdict test with rustfmt 1.85
purpshell Nov 12, 2026
70dd6e1
Rebind documentation snippets to formatted source
purpshell Nov 12, 2026
a2b30e3
Merge origin/main into the Ban Credit waiver verdict branch
purpshell Nov 16, 2026
9482b1d
Replace the single-element verdict loop in the Rust waiver test
purpshell Nov 16, 2026
8273e4e
Rebind documentation snippets to the merged source
purpshell Nov 16, 2026
9b3e5ff
Merge remote-tracking branch 'origin/main' into t3/ban-credit-waiver-…
purpshell Nov 16, 2026
d51d0b0
Rebind documentation snippets to the main merge
purpshell Nov 16, 2026
f8a64f8
Merge remote-tracking branch 'origin/main' into t3/ban-credit-waiver-…
purpshell Nov 16, 2026
da64515
Rebind documentation snippets to the main merge
purpshell Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@
defaults where available. Go callers should use keyed struct literals. Appended
.NET record fields also change the positional deconstruction shape.

- All six server SDKs recognize the Ban Credit claim verdict
`linked_device_interactive` on claim reads and `bansafe.claim` webhooks, and
type claim evidence `linkedDeviceInteractive`. Rust's closed verdict enums
previously rejected this value. Source compatibility: Rust exhaustive
`match` on the verdict enums and `ClaimEvidence` struct literals, Go unkeyed `BanSafeClaimEvidence`
literals and the C# `BanSafeClaimEvidence` constructor/Deconstruct need the
added members. Pinned to API contract revision `f180dc1ee2` (merged to API `dev` as
`a3db53e74c`), which contains merged API #845. Package publication follows the existing release
process.

- UI Kit: keep a 320px thread beside the Inbox list in narrow two-pane layouts, and include the linked guides in the package.

- Breaking: the browser UI packages are now one package, the UI Kit
Expand Down Expand Up @@ -113,7 +123,6 @@
- Add the read-only nullable call-settings exclusion-end response field across all six SDKs. Rust response struct literals require the new optional field; C# positional construction remains compatible. Bound to accepted API source `77e9ce31`, which also clarifies when a ban is excluded; unreleased.

- TypeScript, Python and PHP call-settings updates now refuse keys the API does not accept, including the response-only `simultaneousCallsCoverageExcludedUntil`, before sending. Go, Rust and .NET requests already serialize only writable fields.

- All six server SDKs expose optional automatic-pause `reason`/`code` and
optional recipient-skip `messageIndex`/`followUpId` from accepted API source
`9bb1e2ed`. Future reason/code strings and raw envelope fields are retained;
Expand Down
11 changes: 11 additions & 0 deletions contracts/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Contract coverage

## Ban Credit claim waivers

`ban-credit-waivers.json` pins the `BanSafeClaim` and `BanSafeClaimPayload`
verdict enums and the `linkedDeviceInteractive` claim evidence field to API contract revision `f180dc1ee2bd45dbecf01702f73bdd75c664634b`
(polymorfa/polymorfa#845, merged; that revision merged to API `dev` as
`a3db53e74c` with byte-identical specifications). It is held with `published: false`.
`ban-credit-waivers-contract.test.ts` checks the TypeScript types against it;
each native package has a decoding test. No operation is added. The full
snapshots here already contain the verdict, so this supplement stays as the
explicit pin that the decoding tests read.

## Number-scoped Test phone and events

The full Messaging snapshot at API `f180dc1ee2bd45dbecf01702f73bdd75c664634b`
Expand Down
65 changes: 65 additions & 0 deletions contracts/ban-credit-waivers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"repository": "polymorfa/polymorfa",
"sourceCommit": "f180dc1ee2bd45dbecf01702f73bdd75c664634b",
"published": false,
"scope": "Ban Credit claim waivers: verdict linked_device_interactive and claim evidence linkedDeviceInteractive (polymorfa/polymorfa#845, merged; contained in contract revision f180dc1ee2, merged to API dev as a3db53e74c). Other SDK contracts retain their recorded source revisions.",
"sources": {
"platform": {
"sourcePath": "apps/api/docs/openapi.management.json",
"sha256": "bee9be6cc08d2ec78f5eb5e05135bea3751f93af917b8dd6983b26029feac485"
},
"messaging": {
"sourcePath": "apps/api/docs/openapi.json",
"sha256": "0c66f1ee93923cf57425ac29c01a84c5c140b703ace2160e1b899ee6dad0b071"
}
},
"verdicts": {
"BanSafeClaim": {
"family": "platform",
"enum": [
"other_device",
"customer_conduct",
"shared_network",
"ours",
"inconclusive",
"simultaneous_calls",
"linked_device_interactive"
]
},
"BanSafeClaimPayload": {
"family": "messaging",
"enum": [
"other_device",
"customer_conduct",
"shared_network",
"ours",
"inconclusive",
"simultaneous_calls",
"linked_device_interactive"
]
}
},
"evidence": {
"BanSafeClaimEvidence": {
"family": "platform",
"required": [
"attributionRuleVersion",
"windowDays",
"deviceEvidence",
"otherDevices",
"restrictedInWindow",
"criticalFindingDays",
"sharedConnection",
"measuredHours",
"simultaneousCalls",
"linkedDeviceInteractive"
],
"properties": {
"linkedDeviceInteractive": {
"type": "boolean",
"description": "Whether this number sent an interactive message (buttons, lists, product messages, Flows and similar) from a linked device inside the window. When true, Ban Credit does not cover the ban and the claim is denied when filed. False can also mean not recorded: earlier claims report false, and sends before recording began are not backfilled."
}
}
}
}
}
4 changes: 2 additions & 2 deletions contracts/doc-snippets.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"sourceCommit": "1e6fd9952e8183497a28f43c3987d960d9bf52eb",
"sourceFilesSha256": "536a8c44342cf6a09e6a47d37f6f3239b8a083471a33743a2b8b0cfa32a73792",
"sourceCommit": "f8a64f81955e87f7a3ff64c3f15061a1e967bd0c",
"sourceFilesSha256": "a470c775eb94e39111bd251c255076caad4236ed1b5ecb4284d7b620aa2e54fa",
"apiVersion": "2026-09-22",
"apiSourceCommit": "f180dc1ee2bd45dbecf01702f73bdd75c664634b",
"specs": {
Expand Down
6 changes: 6 additions & 0 deletions packages/dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,12 @@ when the 30-day claim window overlaps an enabled period. Claim verdicts and
`bansafe.claim` webhook verdicts recognize `simultaneous_calls`. Claim evidence
includes `simultaneousCalls`; the webhook does not acquire an evidence object.

Ban Credit claims also recognize `linked_device_interactive` (the Number sent
an interactive message from a linked device in the 30 days before the ban), on
claim reads and `bansafe.claim` webhooks. It opens `denied` with amount 0.
Claim evidence includes `linkedDeviceInteractive`; claims filed before it was
recorded report `false`.

No browser/client-token authority, call media behavior, automatic state read,
retry policy or feature availability is added by these SDK fields.

Expand Down
2 changes: 1 addition & 1 deletion packages/dotnet/src/Polymorfa.Sdk/BanSafe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public sealed record BanSafeEnforcementSummary : BanSafeNumber
public sealed record BanSafeIncident(string Id, string SessionId, string Session, string PhoneNumber, string ProjectId, string Kind, string Source, string Resolution, bool Ambiguous, string StartedAt, string? EndsAt, string? ClosedAt, string? ClosedBy, string? ClaimId, string? Note, string? ReportedBy, string CreatedAt);
public sealed record ReportBanSafeIncidentRequest(string Session, string? OccurredAt = null, string? Note = null);
public sealed record BanSafeIncidentReceipt(string IncidentId, bool Created, string SessionId, string Session, string OccurredAt);
public sealed record BanSafeClaimEvidence(long? AttributionRuleVersion, int WindowDays, bool DeviceEvidence, long OtherDevices, bool RestrictedInWindow, long CriticalFindingDays, bool SharedConnection, decimal MeasuredHours, bool SimultaneousCalls);
public sealed record BanSafeClaimEvidence(long? AttributionRuleVersion, int WindowDays, bool DeviceEvidence, long OtherDevices, bool RestrictedInWindow, long CriticalFindingDays, bool SharedConnection, decimal MeasuredHours, bool SimultaneousCalls, bool LinkedDeviceInteractive);
public sealed record BanSafeClaim(string Id, string IncidentId, string SessionId, string Session, string PhoneNumber, string ProjectId, string Status, string Verdict, string WindowStart, string WindowEnd, decimal MeasuredCents, decimal CapCents, decimal AmountCents, BanSafeClaimEvidence Evidence, string Summary, string Reason, string? DecidedAt, string? PaidAt, string CreatedAt);
public sealed record BanSafeSignalDefinition(string Key, string Label, string Group, string Kind, string Unit, string Description);
public sealed record BanSafeCodeCount(long Code, long Count);
Expand Down
16 changes: 15 additions & 1 deletion packages/dotnet/tests/Polymorfa.Sdk.Tests/BanSafeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ internal static class BanSafeTests
{
private const string Health = """{"sessionId":"s1","session":"support","phoneNumber":"+15550001111","projectId":"p1","health":null,"band":"unknown","healthSource":"unavailable","healthEstimatorVersion":null,"healthModelVersion":null,"healthEvaluatedAt":null,"healthFeatureCoverage":null,"healthReliability":"unavailable","healthUnavailableReason":"no_active_model","healthProbabilities":null,"mostLikelyHealthState":null,"healthExplanation":null,"observedAccountState":{"state":"limited","observedAt":"2026-09-22","source":"restriction_event"},"enforcement":null}""";
private const string Incident = """{"id":"i1","sessionId":"s1","session":"support","phoneNumber":"+15550001111","projectId":"p1","kind":"customer_report","source":"customer","resolution":"retracted","ambiguous":true,"startedAt":"2026-09-22","endsAt":null,"closedAt":null,"closedBy":"owner","claimId":null,"note":null,"reportedBy":null,"createdAt":"2026-09-22"}""";
private const string Claim = """{"id":"c1","incidentId":"i1","sessionId":"s1","session":"support","phoneNumber":"+15550001111","projectId":"p1","status":"paid","verdict":"ours","windowStart":"2026-09-01","windowEnd":"2026-09-22","measuredCents":1.123456,"capCents":2.123456,"amountCents":0.123456,"evidence":{"attributionRuleVersion":1,"windowDays":21,"deviceEvidence":false,"otherDevices":0,"restrictedInWindow":false,"criticalFindingDays":0,"sharedConnection":false,"simultaneousCalls":false,"measuredHours":1.5},"summary":"Reviewed","reason":"ours","decidedAt":null,"paidAt":null,"createdAt":"2026-09-22"}""";
private const string Claim = """{"id":"c1","incidentId":"i1","sessionId":"s1","session":"support","phoneNumber":"+15550001111","projectId":"p1","status":"paid","verdict":"ours","windowStart":"2026-09-01","windowEnd":"2026-09-22","measuredCents":1.123456,"capCents":2.123456,"amountCents":0.123456,"evidence":{"attributionRuleVersion":1,"windowDays":21,"deviceEvidence":false,"otherDevices":0,"restrictedInWindow":false,"criticalFindingDays":0,"sharedConnection":false,"simultaneousCalls":false,"linkedDeviceInteractive":false,"measuredHours":1.5},"summary":"Reviewed","reason":"ours","decidedAt":null,"paidAt":null,"createdAt":"2026-09-22"}""";
private const string Collection = """{"state":"fresh","latestFlushedAt":"2026-09-22","latestReceivedAt":"2026-09-22","freshUntil":null,"recordVersion":1,"collectorVersion":1,"partial":false,"droppedRecords":0}""";
private const string Snapshot = """{"bucketStart":"2026-09-22","flushedAt":"2026-09-22","receivedAt":"2026-09-22","partial":false,"recordVersion":1,"signals":[{"key":"latency","label":"Latency","group":"delivery","kind":"histogram","unit":"milliseconds","description":"Latency","measured":true,"value":[1.25,2.5],"sampleSize":2,"codes":null},{"key":"ready","label":"Ready","group":"connection","kind":"boolean","unit":"none","description":"Ready","measured":true,"value":false,"sampleSize":0,"codes":[{"code":403,"count":1}]}]}""";
public static async Task RunAsync()
Expand All @@ -26,6 +26,20 @@ public static async Task RunAsync()
await Team("POST", "/platform/bansafe/incidents/i1/retract", null, Envelope(Incident), async c => ResourceTests.Equal((await c.BanSafe.RetractIncidentAsync("i1")).Data.Data.ClosedBy, "owner"));
await Team("GET", "/platform/bansafe/claims?session=support&status=paid", null, Page(Claim), async c => ResourceTests.Equal((await c.BanSafe.ListClaimsAsync(new(Session: "support", Status: "paid"))).Items[0].AmountCents, 0.123456m));
await Team("GET", "/platform/bansafe/claims/c1", null, Envelope(Claim), async c => ResourceTests.Equal((await c.BanSafe.GetClaimAsync("c1")).Data.Data.Evidence.MeasuredHours, 1.5m));
// Ban Credit waiver: the verdict and evidence flag decode from the claim read.
foreach (var (verdict, linked) in new[] { ("linked_device_interactive", true) })
{
var waived = Claim.Replace("\"status\":\"paid\",\"verdict\":\"ours\"", $"\"status\":\"denied\",\"verdict\":\"{verdict}\"").Replace("\"attributionRuleVersion\":1", "\"attributionRuleVersion\":3").Replace("\"linkedDeviceInteractive\":false", $"\"linkedDeviceInteractive\":{(linked ? "true" : "false")}");
await Team("GET", "/platform/bansafe/claims/c1", null, Envelope(waived), async c =>
{
var claim = (await c.BanSafe.GetClaimAsync("c1")).Data.Data;
ResourceTests.Equal(claim.Verdict, verdict);
ResourceTests.Equal(claim.Evidence.AttributionRuleVersion, 3L);
ResourceTests.True(claim.Evidence.LinkedDeviceInteractive == linked);
});
var payload = JsonSerializer.Deserialize<BanSafeClaimPayload>($$"""{"id":"c1","incidentId":"i1","phoneNumber":"+15550001111","status":"denied","verdict":"{{verdict}}","windowStart":"a","windowEnd":"b","measuredCents":0,"capCents":0,"amountCents":0,"summary":"s","reason":"r","decidedAt":null,"paidAt":null}""", new JsonSerializerOptions(JsonSerializerDefaults.Web))!;
ResourceTests.Equal(payload.Verdict, verdict);
}
var options = new JsonSerializerOptions(); foreach (var json in new[] { "null", "0", "false", "\"unknown\"", "[]", "[1.5,2.25]" }) { var v = JsonSerializer.Deserialize<BanSafeSignalValue>(json, options); ResourceTests.Equal(JsonSerializer.Serialize(v, options), json); }
foreach (var json in new[] { "{}", "[true]" }) { try { JsonSerializer.Deserialize<BanSafeSignalValue>(json, options); throw new Exception("Invalid signal value accepted"); } catch (JsonException) { } catch (InvalidOperationException) { } }
Console.WriteLine("PASS 15 BanSafe routes, health authority/nulls, closed signal variants and six-decimal claims");
Expand Down
2 changes: 1 addition & 1 deletion packages/dotnet/tests/Polymorfa.Sdk.Tests/CallsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static async Task RunAsync()
await Invalid(() => client.Calls.UpdateCallSettingsAsync("s", new(AcknowledgeRisk: true)));
await Invalid(() => client.Calls.ReportAsync("call", new("quality", "connection1", new("polymorfa-dotnet", "0.1.0", "other"), Quality: new(RttMs: -1))));
var json = new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase };
var claim = System.Text.Json.JsonSerializer.Deserialize<BanSafeClaimEvidence>("""{"attributionRuleVersion":null,"windowDays":30,"deviceEvidence":false,"otherDevices":0,"restrictedInWindow":false,"criticalFindingDays":0,"sharedConnection":false,"simultaneousCalls":true,"measuredHours":0}""", json)!;
var claim = System.Text.Json.JsonSerializer.Deserialize<BanSafeClaimEvidence>("""{"attributionRuleVersion":null,"windowDays":30,"deviceEvidence":false,"otherDevices":0,"restrictedInWindow":false,"criticalFindingDays":0,"sharedConnection":false,"simultaneousCalls":true,"linkedDeviceInteractive":false,"measuredHours":0}""", json)!;
True(claim.SimultaneousCalls);
Console.WriteLine("PASS Calls routes, simultaneous-call presence, evidence and validation");
}
Expand Down
2 changes: 2 additions & 0 deletions packages/dotnet/tests/Polymorfa.Sdk.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

if (args.Contains("--simultaneous-calls-only")) { await CallsTests.RunAsync(); return; }

if (args.Contains("--bansafe-only")) { await BanSafeTests.RunAsync(); Console.WriteLine("PASS BanSafe routes and Ban Credit waiver claims"); return; }

if (args.Contains("--official-round2-only")) { await OfficialRound2Tests.RunAsync(); return; }

OpaqueCredentialTests.Run();
Expand Down
6 changes: 6 additions & 0 deletions packages/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,12 @@ when the 30-day claim window overlaps an enabled period. Claim verdicts and
`bansafe.claim` webhook verdicts recognize `simultaneous_calls`. Claim evidence
includes `simultaneousCalls`; the webhook does not acquire an evidence object.

Ban Credit claims also recognize `linked_device_interactive` (the Number sent
an interactive message from a linked device in the 30 days before the ban), on
claim reads and `bansafe.claim` webhooks. It opens `denied` with amount 0.
Claim evidence includes `linkedDeviceInteractive`; claims filed before it was
recorded report `false`.

No browser/client-token authority, call media behavior, automatic state read,
retry policy or feature availability is added by these SDK fields.

Expand Down
39 changes: 39 additions & 0 deletions packages/go/ban_credit_waivers_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package polymorfa

import (
"encoding/json"
"testing"
)

func TestBanCreditWaiverVerdictsAndEvidence(t *testing.T) {
for _, tc := range []struct {
verdict string
evidence string
linked bool
}{
{"linked_device_interactive", `{"attributionRuleVersion":3,"linkedDeviceInteractive":true}`, true},
} {
var claim BanSafeClaim
if err := json.Unmarshal([]byte(`{"status":"denied","amountCents":0,"verdict":"`+tc.verdict+`","evidence":`+tc.evidence+`}`), &claim); err != nil {
t.Fatal(err)
}
if claim.Verdict != tc.verdict || claim.Evidence.AttributionRuleVersion == nil || *claim.Evidence.AttributionRuleVersion != 3 {
t.Fatalf("decoded %+v", claim)
}
if claim.Evidence.LinkedDeviceInteractive != tc.linked {
t.Fatalf("evidence %+v", claim.Evidence)
}
encoded, err := json.Marshal(claim.Evidence)
if err != nil {
t.Fatal(err)
}
var round map[string]any
if err := json.Unmarshal(encoded, &round); err != nil || round["linkedDeviceInteractive"] != tc.linked {
t.Fatalf("round trip %s", encoded)
}
var payload BanSafeClaimPayload
if err := json.Unmarshal([]byte(`{"verdict":"`+tc.verdict+`"}`), &payload); err != nil || payload.Verdict != tc.verdict {
t.Fatalf("webhook payload %+v %v", payload, err)
}
}
}
19 changes: 10 additions & 9 deletions packages/go/bansafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,16 @@ type BanSafeIncidentReceipt struct {
OccurredAt string `json:"occurredAt"`
}
type BanSafeClaimEvidence struct {
SimultaneousCalls bool `json:"simultaneousCalls"`
AttributionRuleVersion *int `json:"attributionRuleVersion"`
WindowDays int `json:"windowDays"`
DeviceEvidence bool `json:"deviceEvidence"`
OtherDevices int `json:"otherDevices"`
RestrictedInWindow bool `json:"restrictedInWindow"`
CriticalFindingDays int `json:"criticalFindingDays"`
SharedConnection bool `json:"sharedConnection"`
MeasuredHours int `json:"measuredHours"`
SimultaneousCalls bool `json:"simultaneousCalls"`
LinkedDeviceInteractive bool `json:"linkedDeviceInteractive"`
AttributionRuleVersion *int `json:"attributionRuleVersion"`
WindowDays int `json:"windowDays"`
DeviceEvidence bool `json:"deviceEvidence"`
OtherDevices int `json:"otherDevices"`
RestrictedInWindow bool `json:"restrictedInWindow"`
CriticalFindingDays int `json:"criticalFindingDays"`
SharedConnection bool `json:"sharedConnection"`
MeasuredHours int `json:"measuredHours"`
}
type BanSafeClaim struct {
ID string `json:"id"`
Expand Down
6 changes: 6 additions & 0 deletions packages/php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,12 @@ when the 30-day claim window overlaps an enabled period. Claim verdicts and
`bansafe.claim` webhook verdicts recognize `simultaneous_calls`. Claim evidence
includes `simultaneousCalls`; the webhook does not acquire an evidence object.

Ban Credit claims also recognize `linked_device_interactive` (the Number sent
an interactive message from a linked device in the 30 days before the ban), on
claim reads and `bansafe.claim` webhooks. It opens `denied` with amount 0.
Claim evidence includes `linkedDeviceInteractive`; claims filed before it was
recorded report `false`.

No browser/client-token authority, call media behavior, automatic state read,
retry policy or feature availability is added by these SDK fields.

Expand Down
Loading
Loading