[BUG] translate_imports uses blind str.replace — corrupts identifiers and string contents
还没有人认领这个 Issue。
评估
调研方向
Start in translate_imports in maithili_dsl/cli.py, where module names are swapped with plain str.replace, then read _make_keyword_pattern in transpile.py to see the word-boundary approach to reuse. Switch the module rewrite to word boundaries applied only outside string literals and comments, and record translated_modules from actual import statements. Done when both reproductions (the substring case and the string-literal case) produce unchanged output in tests/test_cli.py or tests/test_security.py, and आयात गणित followed by गणित.sqrt(...) still works.
由索引模型根据 Issue 内容生成。
描述
File: maithili_dsl/cli.py (translate_imports)
translate_imports() still uses blind str.replace() — the exact class of bug that was fixed in the transpiler for keywords (see v0.3.0 hardening). Two verified reproductions:
Substring corruption:
Input: उच्चगणित.कोष = १
Output: उच्चmath.कोष = १ # गणित matched inside उच्चगणित
Rewrites inside string literals:
Input: छपाउ("गणित.")
Output: छपाउ("math.") # user-visible output changed
Side effect: because "{module}." appearing anywhere (including strings/comments) adds the module to translated_modules, the import whitelist gets looser than intended.
Fix: reuse the word-boundary pattern machinery from transpile.py (_make_keyword_pattern) and run module translation on code regions only (after/with tokenization), not on the raw source. Track translated_modules from actual आयात statements rather than substring hits.
Tests: both repros above in tests/test_cli.py or tests/test_security.py, plus regression tests that legitimate आयात गणित + गणित.sqrt(...) still work.
- 主要语言
- Python
- 星标
- 1
- 派生
- 4
- 平均合并
- 12 天 21 小时
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
alphacrack/python-maithili-dsl 的其他 Issue
-
help wanted infra P2 testing
难度 2/5 1-3 小时 新手友好度 80/100
-
documentation enhancement good first issue help wanted P3
难度 2/5 1-3 小时 新手友好度 75/100
-
documentation good first issue P3
难度 1/5 1 小时以内 新手友好度 88/100
-
area:linter enhancement good first issue P3 translation
难度 2/5 半天 新手友好度 66/100
-
area:cli enhancement good first issue P3
难度 2/5 1-3 小时 新手友好度 82/100
查看 alphacrack/python-maithili-dsl 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
roman-corgi/corgisim#327 ·
维护者通常 2 天内回复
-
[Bug]: opencode_go chat route drops reasoning_effort (even 'none'), while the same endpoint honors it via custom_llm_provider=openai可能已有人在做 @arvindkumar-ship-it 今天认领。 未关闭llm translation
难度 2/5 1-3 小时 新手友好度 70/100
BerriAI/litellm#51871 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
PolicyEngine backdates South Carolina’s EITC into 2015–2017可能已有人在做 @MaxGhenis 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
PolicyEngine/policyengine-us#10944 ·
维护者通常 2 天内回复
-
fix(frontend): resolve SSE parser crash on unhandled Ref methods and undefined actions identifier未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
kodokbakar/MiroFish-Local#94 ·
维护者通常 1 天内回复