Repository navigation
Reuse a native result in the Codex byte-limit matrix #1524
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| fake_bwrap = test_runners.fake_bwrap | ||
| gh = test_cli.gh | ||
| APPROVE = test_runners.APPROVE | ||
| BYTE_LIMIT_REVIEW = test_runners._native_codex_result("a" * 40) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
|
|
@@ -595,14 +596,13 @@ def test_entire_leading_block_budget_includes_adjudication(native, monkeypatch): | |
| ["\n", "\r\n", "\r", "\v", "\f", "\x1c", "\x1d", "\x1e", "\x85", "\u2028", "\u2029"], | ||
| ) | ||
| @pytest.mark.parametrize("overflow", [0, 1, 2]) | ||
| def test_raw_leading_utf8_span_at_limit_and_overflow(native, separator, overflow): | ||
| result = native[0]() | ||
| def test_raw_leading_utf8_span_at_limit_and_overflow(separator, overflow): | ||
| result = BYTE_LIMIT_REVIEW | ||
| marker = cli.review_marker(result.head, result.kind) | ||
| header = runners.encode_codex_evidence(runners.codex_evidence(result)) | ||
| adjudication = "<!-- loopzero:adjudication v=1 replaces=1 target=" + result.head + " -->" | ||
| span = separator.join((marker, header, adjudication)) | ||
| padding = 8192 + overflow - len(span.encode("utf-8")) | ||
| padded = marker[:-3] + " " * padding + marker[-3:] | ||
| padded = marker[:-3] + " " * (8192 + overflow - len(span.encode("utf-8"))) + marker[-3:] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Unrelated inlining of the padding computation makes the line harder to read The old named |
||
| span = separator.join((padded, header, adjudication)) | ||
| assert len(span.encode("utf-8")) == 8192 + overflow | ||
| rendered = span + separator + "**approve**" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Shared result is built when the module is imported, and its provenance dict can be changed
BYTE_LIMIT_REVIEWis built when the module is collected, so every worker builds it even when these tests are deselected. If the build ever fails, the whole module fails to collect instead of just these 33 cases. The result is also shared across tests, and itsprovenancedict can be modified (runners.py:1354-1361 writes to provenance dicts during merges). The code paths these tests call today (codex_evidence,_review_body,review_projection,eligible_review) don't write to it, andparse_reviewis pure, so this is safe for now. For lazy creation and isolation, a module-scoped fixture (orfunctools.cacheon a small factory) would give the same once-per-worker reuse.