Skip to content

fix(relay): Bound all span expansions/deserializations - #6651

Open
klochek wants to merge 7 commits into
masterfrom
christopherklochek/ingest-1351-bound-spans
Open

klochek wants to merge 7 commits into
masterfrom
christopherklochek/ingest-1351-bound-spans

Conversation

@klochek

@klochek klochek commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@klochek
klochek requested a review from a team as a code owner November 5, 2026 20:15
@linear-code

linear-code Bot commented Nov 5, 2026

Copy link
Copy Markdown

INGEST-1351

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

}
};

let mut cur_results = Vec::new();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I can't tell what storing spans first in cur_results achieves, can you clarify?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's that we don't want to run the 'record' on items that we'll end up rejecting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good observation; removed

@klochek
klochek force-pushed the christopherklochek/ingest-1351-bound-spans branch from 0bc0dae to db653a9 Compare November 9, 2026 22:14

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants