Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.

fix: preserve text literals in generated typing commands - #257

Open
Ricardo-M-L wants to merge 1 commit into
bytedance:mainfrom
Ricardo-M-L:fix/zero29-action-parser
Open

Ricardo-M-L wants to merge 1 commit into
bytedance:mainfrom
Ricardo-M-L:fix/zero29-action-parser

Conversation

@Ricardo-M-L

Copy link
Copy Markdown

Summary

Generated type scripts currently embed text between single quotes after escaping only apostrophes. Windows paths and backslash sequences are interpreted as Python escapes, while embedded newlines or a trailing backslash can produce an invalid script. Use repr for the text argument in both clipboard and direct-typing code paths so the executed script receives the original text.

This does not change terminal-newline detection/trimming. The independent rstrip issue is already covered by #248; this PR does not duplicate or close that work. Coordinate parsing, hotkeys and other action types are unchanged.

Validation

  • Seven regression groups execute the actual generated script against offline pyautogui, clipboard and clock stubs. The four failing groups on the original implementation cover Windows paths, apostrophe-plus-backslash text, embedded newlines and a trailing backslash, in both typing modes. Plain text, Unicode and the existing Enter behavior are controls.
  • The existing three parser tests plus seven new groups pass: 10 tests, repeated with the frozen project dependencies on Python 3.10.18. The focused parser/codegen tests also pass on Python 3.11.13.
  • uv build produces the sdist and wheel; new-test Ruff/format and git diff --check pass. No real keyboard/mouse/clipboard interaction or model call is made.
  • uv sync --locked reports pre-existing lock/metadata drift. uv sync --frozen installs the committed lock successfully; neither dependencies nor the lockfile were changed.
cd codes
uv sync --frozen
MPLBACKEND=Agg uv run --no-sync python -m unittest discover tests '*_test.py' -v
uv build

AI-assisted source audit, implementation and repeated offline validation with OpenAI Codex. No live GUI/model evaluation, human approval or hosted CI success is claimed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant