Commit dba441a
committed
fix(types): make AutohighlightResult.rank Optional to tolerate missing field
Closes #148.
The Auto Highlights API has been observed in production to return
individual `auto_highlights_result.results` entries with no `rank`
field set. The SDK currently declares `rank: float` as required, so
the Pydantic validator raises a `ValidationError` while parsing the
overall `TranscriptResponse` — turning a missing-field-on-one-entry
into a hard failure that loses the entire transcript (text,
utterances, words, sentiment, every other audio-intelligence result).
Make `rank` Optional with a default of `None` so a missing rank parses
through cleanly. The absence is observable to callers via `rank is
None` — no silent default-value substitution.
The change is narrowly scoped to the single field surfaced by the
reporter. The other fields on `AutohighlightResult` (count, text,
timestamps) remain required.
Regression test deletes `rank` from the first highlight in the mock
response, asserts the TranscriptResponse parses, the affected
entry's rank is None, and other entries still have their rank set.
Verified that the new test fails on master (the existing required-rank
contract) and passes on this commit.1 parent 7407e85 commit dba441a
2 files changed
Lines changed: 42 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2140 | 2140 | | |
2141 | 2141 | | |
2142 | 2142 | | |
2143 | | - | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
2144 | 2149 | | |
2145 | 2150 | | |
2146 | 2151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 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 | + | |
0 commit comments