fix: sync config validation content#54
Merged
Merged
Conversation
LucDeCaf
previously approved these changes
Jun 9, 2026
LucDeCaf
left a comment
Contributor
There was a problem hiding this comment.
This looks a lot nicer than before! just some minor naming nitpicks.
LucDeCaf
approved these changes
Jun 9, 2026
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.
fixes #49
The PowerSync CLI validates Sync config by calling a running instance's
/api/admin/v1/validateroute. This provides Sync config validation errors and warnings which optionally map to the start and end character offset positions in the sync config content.The current implementation for mapping from the service provided character offset position to a
Line + Columnposition span is quite messy. This refactors the mapping implementation to avoid situations where critical warning and error details are omitted from being displayed.The general flow now is to:
Request a base validation response from the
/api/admin/v1/validateroute. If character based positions are provided, we can enrich themessagefield to contain a line snippet and caret indicator.For example, the message:
Will become
We then map the character offsets (if provided) to the corresponding line and column span. The implementation then diverges for the
powersync validatecommand and the built-in Sync Config editor.For the
powersync validatecommand: The output will prepend a text[Line XXX, Column YYY]string to the message. Resulting in the following outputThe Sync Config editor will place Monaco Markers at the location/span of errors in the editor. The message shown here will not include any line/column information - that is conveyed by the span.
The
Validation Detailssection will summarize all errors and warnings. Items which have positional information will indicate the relevantLinenumber. Items which don't have positional information, will not show any line item. This is particularly relevant from Syntax errors (when reported from the/api/admin/v1/validateroute)AI Usage. I manually made the main changes to the function structure and types. I then used Codex GPT 5.5 to cleanup comments, stale variable names and update the front-end widgets.