Commit 385dc80
feat(client): looks_like_v3_capabilities — drop the v2-downgrade footgun on capabilities-validation failure (#475)
Port of JS commit 27bd79d (#1201). When `get_adcp_capabilities` fails strict
schema validation but the response is structurally v3-shaped, surface the
v3 validation error loudly instead of silently re-classifying the agent as
v2 — which downstream tooling turns into a cascade of confusing
"AdCP schema data for version v2.5 not found" errors that have nothing to
do with the original wire-shape bug.
`looks_like_v3_capabilities(data)` checks for any one v3 signal: the `adcp`
envelope, `supported_protocols` array, or any v3 protocol-level block
(`account`, `media_buy`, `signals`, `creative`, `brand`, `governance`,
`sponsored_intelligence`, `compliance_testing`). Arrays are explicitly
rejected via the `_is_plain_object` helper so `adcp: []` / `media_buy: []`
don't false-positive.
`ADCPClient.refresh_capabilities` now distinguishes parse failure (the
`_parse_response` "Failed to parse response:" prefix) from transport
failure: parse failures re-fetch the raw dict from the adapter and run
the heuristic; transport failures fall straight through to the original
"Failed to fetch capabilities" path so the existing failure-raises test
keeps passing.
Closes #461. Refs #452.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8dd5dab commit 385dc80
4 files changed
Lines changed: 401 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
90 | 154 | | |
91 | 155 | | |
92 | 156 | | |
| |||
171 | 235 | | |
172 | 236 | | |
173 | 237 | | |
174 | | - | |
| 238 | + | |
175 | 239 | | |
176 | 240 | | |
177 | 241 | | |
| |||
307 | 371 | | |
308 | 372 | | |
309 | 373 | | |
310 | | - | |
311 | | - | |
| 374 | + | |
312 | 375 | | |
313 | 376 | | |
314 | 377 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
1042 | 1042 | | |
1043 | 1043 | | |
1044 | 1044 | | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
1045 | 1053 | | |
1046 | 1054 | | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
1047 | 1061 | | |
1048 | 1062 | | |
1049 | 1063 | | |
1050 | 1064 | | |
1051 | 1065 | | |
1052 | 1066 | | |
1053 | 1067 | | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1054 | 1110 | | |
1055 | 1111 | | |
1056 | 1112 | | |
| |||
0 commit comments