fix(sandbox): declarative engine strips JSONC comments inside strings; sql.format and sql.parse are regex-based
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 75/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Dart
- Stars
- 23
- Forks
- 1
- Avg merge
- 49m
- Merged PRs (30d)
- 496
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from QueryaHub/Querya-Desktop
-
bug P3 ux
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
QueryaHub/Querya-Desktop#1837 ·
Maintainers usually reply within 1 day
-
enhancement P3
Difficulty 4/5 3-5 days Newbie friendliness 50/100
QueryaHub/Querya-Desktop#1838 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 45/100
QueryaHub/Querya-Desktop#1690 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 1-2 days Newbie friendliness 55/100
QueryaHub/Querya-Desktop#1683 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 20/100
QueryaHub/Querya-Desktop#1625 · 2 comments ·
Maintainers usually reply within 1 day
All issues in QueryaHub/Querya-Desktop
Similar issues
-
area/ci-build bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
DarkFlippers/qUnleashed#423 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
google/skills_lint.dart#152 ·
Maintainers usually reply within 1 day
-
Docs: correct the unbuilt "full re-verify" claim and three untrue sync commentsPossibly taken @ibanner56 claimed this today. Openarea: sync priority: low severity: trivial type: docs
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
ibanner56/CallersCompendium#1942 ·
Maintainers usually reply within 1 day
-
[Bug]: 编辑器替换栏关闭按钮错位Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
appshubcc/Bettbox#584 · 1 comment ·
Maintainers usually reply within 1 day