Repository navigation
fix(dockerfile-utils): keep Python digit classes ASCII-only - #2132
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🦋 Changeset detectedLatest commit: 357b67f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
TASTE.md review: complies, 0 violations. I checked parity (T-1: the Python matcher's \d is now ASCII-only, which matches the JS dockerignore.ts regex built with the u flag) and public-surface rules T-3 to T-25 and T-57 to T-63. None of them are affected because the change is internal to _compile, with no new API, options or error types.
|
/accept |
|
Thank you! |
74f903b
into
e2b-dev:devin/1794583693-accept-pr-2132
## Summary Brings in community PR #2132 by @fhgffy (squash-merged into this branch as 74f903b), accepted via `/accept` by @mishushakov, plus a follow-up for JS/Python parity. Python's `\d` is a Unicode digit class, so a `.dockerignore` pattern like `[\d]` excluded `١` (U+0661), unlike Moby's matcher and the JS utility, which use ASCII digit semantics. `dockerignore.py` now compiles patterns with `re.ASCII`. `re.ASCII` also narrows Python's `\s`. JS `\s` still matched Unicode spaces, so JS `translateClass` now expands `\s` → `\t-\r ` and `\S` → its complement. Both SDKs now treat every class escape as ASCII, as Go/Moby does. Ranges with a whitespace escape endpoint (`[\s-x]`) are still rejected. ```python from e2b_dockerfile_utils import PatternMatcher PatternMatcher([r"[\d]"]).matches("\u0661") # False PatternMatcher([r"[\s]"]).matches("\u00a0") # False (same in JS) PatternMatcher([r"[\S]"]).matches("\u00a0") # True ``` Includes patch changesets for `@e2b/dockerfile-utils-python` and `@e2b/dockerfile-utils`. Link to Devin session: https://app.devin.ai/sessions/3f7fc785862843c38122d687b28c86bf Open in Devin Desktop: https://app.devin.ai/desktop/session/3f7fc785862843c38122d687b28c86bf?variant=devin <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/e2b-dev/e2b/pull/2139" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a> <!-- devin-review-badge-end --> --------- Co-authored-by: fhgffy <102001626+fhgffy@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Python treats
\das a Unicode digit class, so a Dockerignore pattern such as[\d]excludes the file١(U+0661). Moby's matcher and the JavaScript utility use ASCII digit semantics and keep that file. Compile Python patterns withre.ASCII, and cover the public matcher with an ASCII digit, a non-ASCII digit and an ordinary letter.The expected class follows Go regexp syntax and the Moby pattern compiler. Existing non-ASCII literals and ranges remain covered by the package suite.
Validation on Windows / Python 3.12.2:
ty check e2b_dockerfile_utilspass.The Python run uses the checkout on
PYTHONPATHbecause Python 3.12 does not resolve the Unicode editable.pthpath in this Windows environment. The skipped BuildKit fixture is the existing quote-aware ADD/COPY case. Includes a patch changeset for@e2b/dockerfile-utils-python.