Repository navigation
fix(instructor): strip invisible Unicode chars from batch-enroll lists - #101
Merged
AliAlfaifi merged 1 commit intoOct 6, 2026
Merged
Conversation
…ll identifier lists _split_input_list splits on [\n\r\s,], and Python's \s does not match Unicode format characters (category Cf: RLM/LRM, ZWSP, ZWNJ/ZWJ, WORD JOINER, BOM, ALM, bidi embeddings/isolates). Lists pasted from Arabic Excel/Word carry them, so a token made only of such characters survived as a blank "invalid identifier" and a real email with an attached RLM was reported invalid. Remove all Cf characters before splitting, in both copies of the helper (views/api.py: batch enrollment + CCX; views/serializer.py: beta testers / access modification). They never belong in an email, username or national ID. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.
Bug (seen in prod)
Batch enrollment showed "The following email addresses and/or usernames are invalid:" with an empty bullet.
_split_input_listsplits on[\n\r\s,], and Python's\sdoes not match Unicode format characters (category Cf: U+200F RLM, U+200E LRM, U+200B ZWSP, U+200C/D, U+2060, U+FEFF BOM, U+061C ALM, U+202A–E, U+2066–9). Lists copied from Arabic Excel/Word/WhatsApp carry them, so:user@example.com+ RLM) is reported invalid although it looks correct, and that learner is silently not enrolled.Fix
Remove every Cf character before splitting, in both copies of the helper (
instructor/views/api.pyandinstructor/views/serializer.py). Format characters never belong in an email, username or National ID, so this is correct for every caller: batch enrollment, CCX coach enrollment, beta testers, access modification.# NELC:marked.Tests
17 new ddt cases in
TestInstructorAPIHelpers(each invisible char alone vanishes; email/username/ID with attached marks are cleaned; Arabic-mixed input); they fail without the fix (17 failed / 4 passed). Container run (overhangio/openedx:20.0.5): instructortest_api.py,test_enrollment.py,ccx→ 506 passed, 9 skipped (existing CCX perf tests). Repo pylint (3.3.6 + edx-lint): clean on all touched files.Stacked under the National ID PR, which targets this branch.
🤖 Generated with Claude Code