Test roles: single source of truth with quoting-requiring names#45
Open
jnasbyupgrade wants to merge 1 commit into
Open
Test roles: single source of truth with quoting-requiring names#45jnasbyupgrade wants to merge 1 commit into
jnasbyupgrade wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Move the test-role names into one file, test/roles.sql, \i'd per test by test/deps.sql instead of hard-coding the names inline. Previously the names were spelled out in deps.sql and implied across the test files. Rename the roles from cat_tools_testing__use_role / __no_use_role to "cat_tools testing: USE" / "cat_tools testing: NO USE" -- names that REQUIRE identifier quoting. The point is defensive: if the code under test (or a test) ever emits an unquoted role reference, the space/mixed-case name turns that latent quoting bug into a hard test failure instead of passing silently on a conveniently quote-free name. Every reference is quoted accordingly (:"use_role" in identifier position). test/sql/permissions.sql already used the quoted form; this makes the names actually exercise it, and brings the remaining test files and deps.sql/setup.sql into line. Test-harness only: no extension SQL or versioned files change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jnasbyupgrade
force-pushed
the
roles-quoting-single-source
branch
from
July 21, 2026 22:22
6c71b9f to
5382c20
Compare
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.
Improve the test suite's role handling. Test-harness only: no extension SQL or versioned files change, and it is independent of #44 (it applies to master's existing per-test role-creation model regardless of that PR).
What changed
test/roles.sql(new): single source of truth for the two test-role names,\i'd per test bytest/deps.sql. Previously the names were hard-coded inline.cat_tools_testing__use_role/__no_use_roleto"cat_tools testing: USE"/"cat_tools testing: NO USE"-- names that require identifier quoting. This is deliberate: with a quote-free name, a missing quote at a use site passes silently; with a name containing a space and mixed case, any unquoted reference (in a test or in the code under test) becomes a hard failure. So the names actively surface quoting bugs instead of hiding them.:"use_role"in identifier position):test/deps.sql(CREATE ROLE / GRANT),test/setup.sql(GRANT USAGE), and theSET LOCAL ROLE/GRANTsites intest/sql/{attribute,enum,extension,function,name__check,object_type,pg_depends,relation_type,sequence,trigger}.sql.test/sql/permissions.sqlalready used the quoted form; this change makes the names actually exercise it.Why base master, not #44
The role naming/quoting/single-source change is an independent quality improvement to master's existing per-test role creation (
test/deps.sqlstill creates the roles per test here). It does not need #44's committed-once installer, so it is based on master and can merge in either order.Verified locally
make teston PG17: all 12 role-using tests pass with the quoting-requiring names. (The unrelatedzzz_buildbuild-sanity diff fails identically on pristine master -- a pre-existing stale expected file -- andmake testis non-gating in CI regardless.)🤖 Generated with Claude Code