Repository navigation
Bound the first transcript read in bytes and make it cancellable #32652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
austinywang
wants to merge
8
commits into
main
Choose a base branch
from
issue-31300-transcript-backfill-bounds
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,283
−96
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
304681b
Add failing tests for bounding the first transcript read
austinywang 84eef64
Bound the first transcript read in bytes and make it cancellable
austinywang e67b68e
Share one artifact snapshot build across concurrent requests
austinywang 9e97cc3
Test shared artifact builds, batched backlogs and escaped JSON strings
austinywang 0c864dc
Keep shared artifact builds to one transcript and working directory
austinywang 1ade115
Charge the tail fragment to the byte budget, honor maxLines 0, keep t…
austinywang dc19936
Make CacheKey internal so InFlightBuild can hold it; note maxRecordBy…
austinywang 12a7f8e
Bound the test's waiter poll by a clock deadline
austinywang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
Packages/Shared/CmuxAgentChat/Tests/CmuxAgentChatTests/TranscriptJSONValueParityTests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import Foundation | ||
| import Testing | ||
|
|
||
| @testable import CmuxAgentChat | ||
|
|
||
| /// `init?(jsonLine:)` must read every line the way the `Decodable` path does. | ||
| @Suite("TranscriptJSONValue parity") | ||
| struct TranscriptJSONValueParityTests { | ||
| private func decoded(_ line: String) -> TranscriptJSONValue? { | ||
| try? JSONDecoder().decode(TranscriptJSONValue.self, from: Data(line.utf8)) | ||
| } | ||
|
|
||
| @Test( | ||
| "the line parser matches the Decodable path", | ||
| arguments: [ | ||
| #"null"#, #"true"#, #"false"#, #"0"#, #"1"#, #"-1"#, #"1.5"#, #"1.0"#, #"1e3"#, #"-0"#, | ||
| #"9007199254740993"#, #"9223372036854775807"#, #"-9223372036854775808"#, | ||
| #"9223372036854775808"#, #"18446744073709551616"#, #"1e30"#, | ||
| #""""#, #""text""#, #""é\u00e9\n\"\\""#, #""\ud83d\ude00""#, #""\ud83d""#, #""\ude00x""#, "\"\u{1F600}\"", | ||
| #"{}"#, #"[]"#, #"[1,"a",null,true,{"k":[2.5]}]"#, | ||
| #"{"a":1,"a":2}"#, #"{"bool":true,"one":1,"zero":0,"float":0.25}"#, | ||
| #"{"type":"response_item","payload":{"type":"message","content":[{"text":"hi"}]}}"#, | ||
| #" {"spaced" : [ 1 , 2 ] } "#, | ||
| "", "{", "[1,", "{\"a\":}", "tru", "01", "'a'", "[1,]", "{\"a\":1,}", "\u{1}", | ||
| ] | ||
| ) | ||
| func parity(line: String) { | ||
| #expect(TranscriptJSONValue(jsonLine: line) == decoded(line), "line: \(line)") | ||
| } | ||
|
|
||
| @Test("booleans and the integers zero and one stay distinct") | ||
| func booleansAreNotNumbers() { | ||
| #expect(TranscriptJSONValue(jsonLine: "true") == .bool(true)) | ||
| #expect(TranscriptJSONValue(jsonLine: "1") == .integer(1)) | ||
| #expect(TranscriptJSONValue(jsonLine: "0") == .integer(0)) | ||
| } | ||
|
|
||
| @Test("an integer past Int's range reads as a number without trapping") | ||
| func integerPastIntRange() { | ||
| #expect(TranscriptJSONValue(jsonLine: "9223372036854775808")?.int == nil) | ||
| #expect(TranscriptJSONValue(jsonLine: "1e30")?.int == nil) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.