Repository navigation
Fix prepared-statement name collisions, row members named like row hooks, and CamelCase query file classes - #55
Merged
devin-ai-integration[bot] merged 2 commits intoNov 4, 2026
Conversation
…ision-free Co-Authored-By: Doron Eli Rachman <doron050@gmail.com>
…QLite busy waiting Co-Authored-By: Doron Eli Rachman <doron050@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
devin-ai-integration
Bot
deleted the
devin/1793754636-sweep-naming-fixes
branch
November 4, 2026 01:25
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.
Summary
Fixes three generator bugs found in a pre-release sweep. Each one has a test that fails on
main. The PR also fixes or documents the suspicions from that sweep.1. PostgreSQL prepared-statement names could collide (High). Names were snake_cased and joined with
_, so different class paths gave the same name.Options::PgV2::FirstSqlandOptions::Pg::V2::FirstSqlboth gotoptions_pg_v2_first_sql_…, and names that PostgreSQL truncated at 63 bytes could also match. Two classes sharing a pool then ran each other's SQL or raisedPG::DuplicatePstatement.Code.statement_namenames each statementModule::Class#method. That name is unambiguous because::and#never appear inside a constant or method name. Names over 63 bytes become a prefix,~, and a 64-bit FNV-1a hash of the full name.tests/end2end_options.rbadds module pairsOptions::PgV2/Options::Pg::V2and two long module names that share their first 63 bytes. Each pair runs on oneConnectionPool. Unit test:test_statement_names_of_different_classes_never_collide.2. Columns named like private row hooks broke every row (Low-Med). A column named
initialize(alsoinitialize_copy,initialize_clone,initialize_dup,method_missing) was not renamed, soData/Structconstruction raisedArgumentError.Code::CONSTRUCTION_METHODS), so they get a trailing_(initialize_).initializecolumn inname_cases.test_keyword_and_method_names_keep_distinct_row_and_argument_namesreads it back asinitialize_. Unit testtest_columns_named_like_row_methods_still_build_and_read_rowsgoes through every public and privateStruct/Datamethod on the running Ruby, then builds, reads, dups, clones andwiths a row for each one.3. Query file names were not CamelCased (Low).
admin_users.sqlgeneratedAdmin_usersSql, which is a RuboCopNaming/ClassAndModuleCamelCaseoffense.Code.constant_partCamelCases file names, soadmin_users.sqlbecomesAdminUsersSqlinadmin_users_sql.rb. Two files that map to the same class are still rejected, and the error now names the files.sqlite_queries/admin_users.sqland runsAdminUsersSql. Unit tests:test_query_file_names_become_camel_case_classesand the updatedtest_query_files_writing_the_same_file_are_rejected.Breaking change: a query file with
_in its name now generates a different class name. For example,my_queries.sqlused to giveMy_queriesSqland now givesMyQueriesSql. Callers have to rename the class. File names stay the same.Suspicions from the sweep
rubyVersion: "3"generatedData, which breaks on Ruby 3.1. A missing minor version now counts as.0for this check, so3generatesStructs (test_immutable_data_support).:execrowscounts changed rows, not matched rows (mysql2's default). This is now documented with theflags: Mysql2::Client::FOUND_ROWSalternative (test_execrows_counts_changed_rows_unless_found_rows_is_set).Stringpassed to a PostgreSQLjson/jsonbparameter is JSON text. This is now documented; the existing JSON round-trip test already covers it.busy_timeout=waits while holding the GVL, so other threads stop. This is now documented, recommendingbusy_handler_timeout=(test_busy_handler_timeout_waits_for_another_connection_without_blocking_threads).Integer, and passingtrueis a sqlite3 gem limitation.examples/,test/golden/,test/fixtures/*.binandsteep_expectations.ymlare regenerated (only line numbers moved in the Steep expectations). README,docs/Coverage.mdanddocs/Testing.mdare updated.Checklist
examples/is regenerated (rake sqlc_generate_process) and committedrake test, andrake end2end_*when the generated code changes)rake rubocop) and Steep-clean (rake steep)bug,enhancement,documentation, orbreaking) so the release notes are grouped correctly