Skip to content

FEAT: Add TapCodeConverter (tap_code converter) - #4444

Open
Roman Lutz (romanlutz) wants to merge 7 commits into
microsoft:mainfrom
romanlutz:gap1-tapcode
Open

Roman Lutz (romanlutz) wants to merge 7 commits into
microsoft:mainfrom
romanlutz:gap1-tapcode

Conversation

@romanlutz

@romanlutz Roman Lutz (romanlutz) commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Adds this converter as part of the gap-1 converter series (splitting the esoteric cipher / encoder set into per-converter and per-base PRs). Includes a unit test and garak Encoding-scenario registration; CI-validated locally.

Sibling PRs will be cross-linked once the series is open.

🤖 Generated with Claude Code

gap-1 converter series — splitting the esoteric cipher / encoder set into reviewable PRs (open each independently; they touch the same four registration files, so later ones rebase as earlier ones merge):

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 19, 2026 23:35

Copilot AI left a comment

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.

🟡 Changes recommended

The converter silently changes some non-ASCII characters into tap sequences because it uppercases them before checking for ASCII, violating its promised pass-through behavior.

1 open issue
What changed in this PR

Adds TapCodeConverter to PyRIT’s text transformation library and makes it available in the Garak Encoding scenario.

Changes:

  • Implements tap-code encoding with configurable symbols and separators.
  • Exports the converter and registers tap_code as an ALL-only encoding technique.
  • Adds converter tests, updates scenario expectations, and includes a Python documentation example.
File Description
tests/​unit/​scenario/​garak/​test_encoding.py Updates technique counts and ALL-only expectations.
tests/​unit/​converter/​test_tap_code_converter.py Tests encoding, configuration, identifiers, and input validation.
pyrit/​scenario/​scenarios/​garak/​encoding.py Registers the tap-code technique and converter variant.
pyrit/​converter/​tap_code_converter.py Implements configurable tap-code conversion.
pyrit/​converter/​__init__.py Adds the converter to public lazy exports.
doc/​code/​converters/​1_text_to_text_converters.py Adds a tap-code usage example.

Review effort: Balanced

Comment thread pyrit/converter/tap_code_converter.py Resolved

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.

Reviewed head bda1b5e. The converter is a welcome named leaf. Three P2 issues need changes: unneeded unvalidated rendering options, the K to C fold that makes correct decodes score as failures in the Encoding scenario, and the non-ASCII lookup (reply in the existing thread). The P3 comments are smaller test and docs fixes. The branch also conflicts with main.

Comment thread pyrit/converter/tap_code_converter.py Resolved
Comment thread pyrit/converter/tap_code_converter.py Resolved
Resolve garak encoding conflicts take-BOTH (TapCode + Pigpen/Disemvowel/
UbbiDubbi); set EncodingTechnique ALL count to 23. Bump garak doc technique
count to 23 (+TapCode). Regenerate 0_converters.ipynb modality table.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add test_tap_code_technique_builds_registered_row to guard the registered
tap_code row in Encoding._converter_variants. Sync the TapCodeConverter demo
(import, print, rendered output) into 1_text_to_text_converters.ipynb.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…C fold)

Restrict the tap-code lookup to ASCII letters so non-ASCII whose upper-case is
ASCII (Turkish 'ı'->'I', 'ſ'->'S') passes through verbatim. Remove the unused
tap_symbol/group_separator/letter_separator options (registry-constructed with
user input) in favor of fixed, uniquely-decodable constants. Add
to_ascii_equivalent so the Encoding scenario attaches the K->C decode as
decoded_text and DecodingScorer accepts a faithful decode of K payloads.
Parametrize the converter letter tests and add non-ASCII and K-fold tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

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.

Automated review completed. No blocking concerns remain. This review records source coverage; merging is handled separately.

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.

3 participants