fix(sandbox): declarative engine strips JSONC comments inside strings; sql.format and sql.parse are regex-based
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Read lib/core/extensions/sandbox/embedded/declarative_embedded_engine.dart alongside lib/core/theme/parser/jsonc_preprocessor.dart and the core/database helper mentioned for leading comments. Check the editor fix in issue #1566 for the segment-aware SQL formatter. Add tests for the listed JSONC and SQL cases; done means strings remain intact, trailing commas parse, and sql.parse skips leading comments.
由索引模型根據 Issue 內容生成。
描述
Problem
DeclarativeEmbeddedEngine (lib/core/extensions/sandbox/embedded/declarative_embedded_engine.dart) runs Level-1 JSON/JSONC modules for extensions. Three of its helpers use regexes where a scanner is needed:
_parseJsoncObject(:230-238) breaks on any//or/*inside a string. It removes comments with//[^\n]*and/\*[\s\S]*?\*/over the raw text, so{"homepage": "https://example.com"}becomes{"homepage": "https:and the module fails withFormatException. Trailing commas, which JSONC allows, are not handled either. The repo already has a correct scanner:stripJsoncinlib/core/theme/parser/jsonc_preprocessor.dart(string-aware, handles trailing commas). Use it.sql.format(:120-164) changes literals and does extra work. It compiles 21RegExps per call (one per keyword plus two) and makes 23 passes over the string.[ \t]+ -> ' 'collapses spaces inside string literals;\s*;\s* -> ';\n'inserts newlines inside literals; keyword uppercasing rewrites'order by'and"select". Use the segment-aware formatter from the editor fix (#1566) instead of a second implementation.sql.parse(:219) splits the whole statement on whitespace to read the first word, and returns--//*when the statement starts with a comment. Use onefirstMatchafter skipping leading comments (stripLeadingWhitespaceAndLineCommentsexists in core/database).
Scope
EmbeddedSandboxRuntime has no callers outside lib/core/extensions/sandbox/embedded/ yet (only tests), so nothing breaks for users today. Fix before the runtime is wired to extensions.
Tests
JSONC with a URL value, /* inside a string, trailing comma; sql.format with keywords and ; inside literals; sql.parse with a leading comment.
- 主要語言
- Dart
- 星號
- 23
- 分支
- 1
- 平均合併
- 49 分鐘
- 30 天內合併 PR
- 496
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
QueryaHub/Querya-Desktop 的其他 Issue
-
bug P3 ux
難度 2/5 1-3 小時 新手友好度 79/100
QueryaHub/Querya-Desktop#1837 ·
維護者通常 1 天內回覆
-
enhancement P3
難度 4/5 3-5 天 新手友好度 50/100
QueryaHub/Querya-Desktop#1838 ·
維護者通常 1 天內回覆
-
enhancement
難度 5/5 一週以上 新手友好度 45/100
QueryaHub/Querya-Desktop#1690 ·
維護者通常 1 天內回覆
-
enhancement
難度 4/5 1-2 天 新手友好度 55/100
QueryaHub/Querya-Desktop#1683 ·
維護者通常 1 天內回覆
-
enhancement
難度 5/5 一週以上 新手友好度 20/100
QueryaHub/Querya-Desktop#1625 · 2 則留言 ·
維護者通常 1 天內回覆
查看 QueryaHub/Querya-Desktop 的全部 Issue
相似的 Issue
-
good first issue help wanted translation
難度 2/5 1-3 小時 新手友好度 86/100
blankframe-tech/ThrottleIQ#23 ·
維護者通常 5 天內回覆
-
good first issue mobile P0 size:S
難度 2/5 1-3 小時 新手友好度 68/100
-
難度 2/5 1-3 小時 新手友好度 69/100
trufi-association/trufi-core#1024 ·
維護者通常 14 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 83/100
-
@apps/catalog enhancement
難度 2/5 1-3 小時 新手友好度 76/100
ymm-oss/flutter-mobile-project-template#699 ·
維護者通常 15 天內回覆