Repository navigation
Conversation
| } | ||
| }; | ||
|
|
||
| let mut cur_results = Vec::new(); |
There was a problem hiding this comment.
Sorry, I can't tell what storing spans first in cur_results achieves, can you clarify?
There was a problem hiding this comment.
It's that we don't want to run the 'record' on items that we'll end up rejecting.
There was a problem hiding this comment.
If it's just the record-keeping, I believe
let produce = |span: SpanV2| {
let span = WithHeader::new(span.into());
results.push(WithHeader::new(span.into()));
};
[…]
match result {
Err(err) => drop(records.reject_err(err, item)),
Ok(()) => {
for result in results {
records.add(&result);
}
// Undo all the base item quantities, as they will be completely taken over by the parsed
// contents, which contains an arbitrary amount of items (even 0).
records.remove(item);
}
}achieves the same thing, right? But I'm realizing now that the behavior of expand has actually changed; previously it would either return Ok and produce all spans or Err and produce no spans. Now it can can produce some spans and then still return Err because we've run out of size. So before, results would be empty in the Err case, but now it might contain some spans.
I'm starting to wonder if it might not be cleaner to change expand to return Result<Vec<WithHeader<Span>>> directly. The produce function doesn't really do anything interesting at this point, and the interplay between the return value of expand and what it produces is complicated.
There was a problem hiding this comment.
Good observation; removed
0bc0dae to
db653a9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3df7f03. Configure here.

No description provided.