Repository navigation
Fix migration SQL boundaries and tracking-table identifiers - #695
Merged
Merged
Conversation
Treat quoted identifiers, escaped delimiters and comments as tokens when validating migration statements. Recognize trigger completion as ; END ; so identifier names cannot hide a following disallowed statement. Quote migration tracking table names with SQLite's identifier formatter instead of interpolating them into fixed-size SQL buffers. Add 19 real SQLite regressions for valid UP/DOWN round trips, trigger boundaries, disallowed ATTACH rejection and tracking-name isolation. Register the test in the existing unit build and integration/sanitizer CI. Validation on origin/main 8927bc8: the new fixture fails 14/19 cases before the fix and passes 19/19 under Debug ASan/UBSan afterward. No services or legacy shared-path test fixtures were run.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Migration validation could lose statement boundaries when quoted identifiers, comments or trigger names contained SQL-looking tokens. Configured tracking-table names were also interpolated as SQL fragments and truncated by fixed buffers.
Track quoted/comment tokens and the SQLite trigger terminator correctly before executing the migration. Quote tracking-table names as identifiers in all four statements while retaining bound version values.
main: 14 of 19 regression cases fail before the fix; all 19 pass under ASan/UBSan afterward. Tests use private temporary files and in-memory SQLite databases.Test selection:
ctest --test-dir build/migration-debug --output-on-failure -V -R '^test_sqlite_migration_boundaries$'.Extracted from #693. No foundation framework, plan, inventory or generated contract changes are included. Production callers currently use a constant tracking-table name; this does not claim remotely controlled input.