Commit ee326e5
committed
feat(llm-obs): add datasets records-all to page past the preview cap
`pup llm-obs datasets records` posts to /api/unstable/llm-obs-mcp/v1/dataset/records, which trims
its response to a size budget and returns no cursor. On a dataset whose records carry sizeable
inputs that lands at 19 records with `truncated: true`, and because the endpoint emits no cursor
there is no way to reach the remainder — `--cursor` exists as a flag but nothing ever produces a
value for it. Confirmed against the API directly: --limit 25 and --limit 50 both return 19, and no
cursor key appears in the response at any limit. `records-full` is not a workaround either; it
caps at 3 ids per call ("record_ids has N entries; cap is 3") and you would still need the full id
list to use it.
The plain REST route has no such cap and pages properly:
GET /api/unstable/llm-obs/v1/datasets/{id}/records?page[limit]=N&page[cursor]=<meta.after>
This adds `datasets records-all`, which pages that route via meta.after and emits the aggregate
under the same records/returned keys plus pages_fetched. Verified against a 50-record dataset:
--limit 7 returns all 50 across 8 pages with 50 unique ids and no __nested_object__ placeholders,
where the existing command returns 19.
Added as a separate subcommand rather than changing `records` in place, because the two routes
return different shapes — `records` gives size-trimmed previews with __nested_object__ /
__nested_array__ placeholders, the REST route gives full records. Switching routes under the
existing flag would silently change its output shape and break callers that parse it. `records`
stays the cheap browse path; this is the explicit "give me everything" path. It takes only
--dataset-id, since the REST route does not require a project id.
Loop safety: terminates on an empty cursor or a cursor identical to the previous one (a server
returning a fixed cursor would otherwise spin), with a 200-page hard stop that warns on stdout
before returning what it has.
Tests cover the happy path (asserts BOTH pages were requested, proving the cursor is followed),
the repeated-cursor guard, and a 500 response.1 parent df43130 commit ee326e5
3 files changed
Lines changed: 176 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
203 | 268 | | |
204 | 269 | | |
205 | 270 | | |
| |||
1029 | 1094 | | |
1030 | 1095 | | |
1031 | 1096 | | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
1032 | 1196 | | |
1033 | 1197 | | |
1034 | 1198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9410 | 9410 | | |
9411 | 9411 | | |
9412 | 9412 | | |
| 9413 | + | |
| 9414 | + | |
| 9415 | + | |
| 9416 | + | |
| 9417 | + | |
| 9418 | + | |
| 9419 | + | |
9413 | 9420 | | |
9414 | 9421 | | |
9415 | 9422 | | |
| |||
16261 | 16268 | | |
16262 | 16269 | | |
16263 | 16270 | | |
| 16271 | + | |
| 16272 | + | |
| 16273 | + | |
16264 | 16274 | | |
16265 | 16275 | | |
16266 | 16276 | | |
| |||
0 commit comments