Skip editor validation when the parse result can't have changed#36
Draft
Edwinexd wants to merge 1 commit into
Draft
Skip editor validation when the parse result can't have changed#36Edwinexd wants to merge 1 commit into
Edwinexd wants to merge 1 commit into
Conversation
Deploying sql-validator with
|
| Latest commit: |
e471245
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://11180a35.dsv-db-sql-validator.pages.dev |
| Branch Preview URL: | https://fix-issue-19-battery-usage.dsv-db-sql-validator.pages.dev |
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.
Addresses part of #19 (battery usage).
The live "validate on change" effect ran on every keystroke, calling
validateStatements(SQLite prepares/parses viaiterateStatements, Postgres runsEXPLAIN) and, in RA mode,raToSQL→getColumnNames→db.prepare(). No debounce, no memoization. That per-keystroke parsing is the main CPU/battery cost while typing.Instead of a blanket timer, skip the engine call only when the result provably can't have changed since the last validation:
Error classification covers both engines:
incomplete inputsyntax error at end of inputnear "X": syntax errorsyntax error at or near "X"no such table: Xrelation "x" does not existPersistence (localStorage + written-questions tracking) is split into its own effect so it stays immediate; only the engine validation is skipped.
RA mode keeps only the exact-repeat guard since its error shapes don't fit the append invariant.
Existing suite passes (249 tests), tsc and eslint clean.