Skip to content

Add CI workflow forcing prepared_statements: false#2635

Merged
yahonda merged 1 commit into
rsim:masterfrom
yahonda:daily-prepared-statements-false-ci
Apr 28, 2026
Merged

Add CI workflow forcing prepared_statements: false#2635
yahonda merged 1 commit into
rsim:masterfrom
yahonda:daily-prepared-statements-false-ci

Conversation

@yahonda
Copy link
Copy Markdown
Collaborator

@yahonda yahonda commented Apr 28, 2026

Summary

Adds:

  • ORACLE_ENHANCED_PREPARED_STATEMENTS_FALSE env-var hook in spec/spec_helper.rb that, when set, forces prepared_statements: false into CONNECTION_PARAMS and prints a startup banner.
  • .github/workflows/test_prepared_statements_false.yml (CRuby 4.0 + JRuby 10.1.0.0, gvenzl/oracle-free:latest) that sets the env var and runs the full RSpec suite.

Why

The `prepared_statements: false` arm has accumulated multiple bugs over the years precisely because nothing in CI exercised it:

prepared_statements: false is reachable from the default Rails 8+ development environment (any app with config.active_record.query_log_tags_enabled = true flips ActiveRecord.disable_prepared_statements), so the arm is real for real users — it just has no CI floor.

The matching ORACLE_ENHANCED_PREPARED_STATEMENTS=1 (force true) hook that #2623 added and #2627 reverted is intentionally not reintroduced here: that arm collapsed once the cursor_sharing default stopped depending on prepared_statements (#2626), and CI duplicating the AbstractAdapter default did not earn its keep. The false arm is a distinct code path that does.

Expected initial CI result on this branch

Failing, with the failures concentrated in the NCLOB describe block in spec/active_record/oracle_enhanced/type/national_character_text_spec.rb:

ORA-00904: "EMPTY_NCLOB": invalid identifier

That is exactly the bug #2634 fixes. The expectation is:

  1. Land Fix NCLOB INSERT failure when prepared_statements is false #2634 first (1-line quoting.rb fix from empty_nclob() to empty_clob() plus a regression spec).
  2. Re-trigger this workflow on this branch — should go green.
  3. Merge this PR.
  4. Promote trigger from workflow_dispatch to schedule: cron "0 0 * * *" in a follow-up.

So this PR is intentionally held until #2634 lands.

Test plan

Refs #2622, #2634.

Adds an env-driven hook in spec/spec_helper.rb and a
workflow_dispatch-triggered job (CRuby 4.0 + JRuby 10.1.0.0) that runs
the existing spec suite under
ORACLE_ENHANCED_PREPARED_STATEMENTS_FALSE=1, mirroring rails/rails'
MYSQL_PREPARED_STATEMENTS env-var convention but inverted (force false
instead of force true) since the AbstractAdapter default applicable to
this adapter is already true.

The matching ORACLE_ENHANCED_PREPARED_STATEMENTS=1 (force true) hook
that rsim#2623 added and rsim#2627 reverted is intentionally not re-introduced
here: that arm collapsed once the cursor_sharing default stopped
depending on prepared_statements (rsim#2626), and a CI grid duplicating
the AbstractAdapter default no longer earns its keep. The false arm,
on the other hand, is a distinct code path that has accumulated bugs
(rsim#272, rsim#2477/rsim#2485 for CLOB/BLOB, and rsim#2634 for NCLOB) precisely
because nothing in CI was running it.

Once green this should be promoted to schedule: cron for daily runs
(separate follow-up).

Refs rsim#2622, rsim#2634.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@yahonda yahonda merged commit eee5793 into rsim:master Apr 28, 2026
12 checks passed
yahonda added a commit to yahonda/oracle-enhanced that referenced this pull request Apr 28, 2026
…s is false

record_lobs_for_create (added in rsim#2485) excluded readonly_attributes
from the create-time @changed_lob_columns set. attr_readonly is meant
to forbid post-creation updates, not the initial create itself, so
filtering on create skipped the after_create write_lobs step and left
the row with the EMPTY_CLOB() / EMPTY_BLOB() placeholder instead of
the supplied value.

The bug only surfaces on prepared_statements: false connections; the
prepared_statements: true path binds LOB data directly via OCI temp
LOB during INSERT and never relies on the after_create callback.

The pre-existing readonly LOB specs already encode the correct
expectation:

  OracleEnhancedAdapter handling of CLOB columns
    should respect attr_readonly setting for CLOB column
  OracleEnhancedAdapter handling of NCLOB columns
    should respect attr_readonly setting for NCLOB column

They pass on prepared_statements: true (today's default) and now also
pass on prepared_statements: false (covered in CI by rsim#2635).

Adds matching regression specs inside the existing
"with prepared_statements disabled" describe blocks of text_spec.rb
and national_character_text_spec.rb. Verified on master without this
fix: only those two new specs fail (2 failures, 0 others).

Closes rsim#2636.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant