Repository navigation
Fix incorrect last bytes sent API timing data from nested requests - #65449
Andrew Branch (andrewbranch) merged 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the nested-request sent-byte timing fix.
No open issues 🎉
What changed in this PR
Fixes sent-byte timing data in the synchronous TypeScript API when a callback issues a nested request.
Changes:
- Restores the outer request’s sent-byte count when its response arrives.
- Adds a regression test verifying that a larger nested request does not overwrite the outer request’s recorded size.
| File | Description |
|---|---|
packages/typescript/test/sync/timing.test.ts |
Tests sent-byte timing for nested synchronous requests. |
packages/typescript/src/api/syncChannel.ts |
Recalculates sent bytes from the current request payload before returning its response. |
Review effort: Balanced
Daniel Rosenwasser (DanielRosenwasser)
left a comment
There was a problem hiding this comment.
Seems good, just wondering about the test.
| let api: API | undefined; | ||
| using instance = new API({ |
There was a problem hiding this comment.
Why can't we use a single variable? Is this model just confused about how using works?
(am I just confused about how using works?)
There was a problem hiding this comment.
Uh yeah this is weird
There was a problem hiding this comment.
Fusion chose Luna 😑
| // A callback may have issued a nested request while waiting for this response. | ||
| this.lastBytesSent = typeof payload === "string" |
There was a problem hiding this comment.
And payload itself is the source of truth for the current request?
| readFile: path => { | ||
| if (!nested) { | ||
| nested = true; | ||
| if (!api) throw new Error("API is not initialized"); |
There was a problem hiding this comment.
Oh, it was spooked by the prospect of this running during initialization, but that's not what happens
Noticed while working on something totally unrelated