Repository navigation
FIX: Fix CodeChameleonConverter decryption functions in binary_tree and length modes - #3165
Merged
Roman Lutz (romanlutz) merged 4 commits intoOct 13, 2026
Conversation
…nd length modes (fixes microsoft#3164)
Contributor
|
#3072 was technically here first but author didn't accept the CLA so happy to merge this. |
Roman Lutz (romanlutz)
approved these changes
Oct 13, 2026
Roman Lutz (romanlutz)
left a comment
Contributor
There was a problem hiding this comment.
I'll make a couple of improvements and then merge. Thank you!
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40dcbc75-65c2-470f-8978-3b7f95ae03a7
Cover boundary inputs across all built-in modes and preserve length decoding of already parsed lists. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40dcbc75-65c2-470f-8978-3b7f95ae03a7
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40dcbc75-65c2-470f-8978-3b7f95ae03a7
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #3164. Incorporates the binary-tree fix previously proposed in #3072 and preserves its boundary regression coverage.
The generated
CodeChameleonConverterdecryption instructions contained two runtime failures:binary_tree: The initialjson.loads(problem_description)already parses nested child dictionaries. Removing the redundant recursivejson.loadscalls avoidsTypeErrorwhen a tree has children.length: The encoder emits a JSON string, but the decoder expected a list of dictionaries. The instructions now importjsonand parse string inputs before decoding, while continuing to accept already parsed lists.No constructor, encryption format, or supported modality changes. Merged
mainthroughd3a04c8d7496e0cb4fa5a80df616132d1d9169ffbefore pushing.Tests and Documentation
Updated the instruction snapshots and expanded the generated-code execution regression to 12 inputs across all four built-in modes. Coverage includes empty and whitespace-only inputs, single nodes, both child branches, nested odd/even trees, whitespace normalization, escaped values, repeated words, and Unicode. The
lengthcases also exercise already parsed lists. The tests run the actual emitted decryption code against real converter output without provider calls.Local validation on the pushed head:
uv run --no-sync pytest tests\unit\converter\test_code_chameleon_converter.py -q: 54 passed.uv run --no-sync ruff check pyrit\converter\codechameleon_converter.py tests\unit\converter\test_code_chameleon_converter.py: passed.uv run --no-sync ruff format --check pyrit\converter\codechameleon_converter.py tests\unit\converter\test_code_chameleon_converter.py: passed, both files already formatted.uv run --no-sync ty check pyrit\converter\codechameleon_converter.py: passed.maindecoders in memory caused all four selected binary-tree/length regression cases to fail, confirming that the tests catch both original bugs.All six source-head workflows passed on
b17480428e36a7fb893ffb4cd3d9749b0e35ffb3, with all 36 required check contexts verified. One failed-job-only retry was needed for an unrelated two-second Copilot target test setup timeout on macOS/Python 3.11; the retry passed without unrelated code changes. Merge-queue integration checks are separate from these source-head results.No documentation API or modality-table updates are needed for these instruction corrections.
JupyText was not run locally; no notebook or documentation source files changed.