Add DBR::Misc::DBI::Compat shim to restore DBD::mysql 4.036 string behavior#17
Merged
Merged
Conversation
…havior
DBD::mysql 4.050 (required for Debian Bookworm / libmariadb 3.x) returns
numeric MySQL columns as IV/NV scalars instead of string scalars (SVp_POK).
This changes JSON::XS output from quoted strings ("42") to bare numbers (42),
breaking consumers that rely on string-encoded numerics.
DBR::Misc::DBI::Compat is a DBI RootClass that overrides all fetch methods on
MySQL statement handles to stringify every returned value, restoring 4.036
behavior transparently across all callers — both DBR ORM paths and raw $dbh
users (e.g. Dashboard.pm) — with no changes required in service code.
This is an intentional temporary migration bridge. It should be removed once
all consumers have been audited and verified safe with bare-number JSON encoding.
See: perl-base-image-v2/DBD-mysql-numeric-types.md (Option B)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CircleCI SSH key was no longer functional. Replaces .circleci/config.yml with .github/workflows/build-and-test.yml using the standard perl:5.24 Docker Hub image; installs deps via cpanm, builds with make, runs make test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Fix CI: use actions/checkout@v3 for perl:5.24 (Debian Stretch) compatibility actions/checkout@v4 uses Node 20 which requires glibc 2.27+; Debian Stretch ships glibc 2.24. Downgrade to v3 (Node 16, requires glibc 2.17). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Fix CI: switch to perl:5.36 (Debian Bookworm) container GitHub Actions now forces Node 20 for all actions, including checkout@v3. Node 20 requires glibc 2.28+; perl:5.24 (Debian Stretch) ships glibc 2.24. perl:5.36 (Debian Bookworm, glibc 2.36) resolves the incompatibility and aligns CI with the migration target environment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Fix CI: run on ubuntu-latest without container Drop the Docker container entirely. The perl:5.24 image (Debian Stretch, glibc 2.24) is incompatible with Node 20 required by all current GitHub Actions. Running directly on ubuntu-latest uses the system Perl on Ubuntu 22.04 and avoids the issue. Added sudo for apt-get (runner is non-root). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Fix CI: install cpanminus via apt before using cpanm ubuntu-latest does not include cpanm pre-installed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Fix CI: run cpanm with sudo so deps install to system Perl paths Without sudo, cpanm cannot write to system Perl directories and the installs fail silently, leaving modules missing from @inc. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Fix CI: chown working directory back to runner after sudo cpanm sudo cpanm creates MYMETA.json as root, causing 'Permission denied' when the non-root build step tries to overwrite it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
164b709 to
375b750
Compare
3 tasks
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
lib/DBR/Misc/DBI/Compat.pm(new file): DBIRootClassthat overrides all fetch methods on MySQL statement handles to stringify every returned value, restoring the DBD::mysql 4.036 behavior where all numeric columns were returned as string scalars (SVp_POK).lib/DBR/Config/Instance.pm(~3 lines): passes{ RootClass => 'DBR::Misc::DBI::Compat' }toDBI->connectfor MySQL connections only. MonetDB and SQLite connections are unaffected.Background
DBD::mysql 4.050 is required for Debian Bookworm (libmariadb 3.x). It returns integer columns as IV scalars and float columns as NV scalars instead of strings.
JSON::XSencodes these as bare numbers (42) rather than quoted strings ("42"), breaking any consumer that relies on string-encoded numerics.Because all MySQL connections originate from the single
DBI->connectcall in_new_connection, this shim covers the entire codebase — both DBR ORM paths and raw$dbhcallers — with no changes required in any service code.This is a temporary migration bridge. It should be removed once all consumers have been audited and verified safe with bare-number JSON encoding.
Full diagnosis, audit findings, and decision rationale:
perl-base-image-v2/DBD-mysql-numeric-types.mdTest plan
perl-base-image-v2:dev) to confirm no regressionsperl-modules-usage-snapshotDBD::mysql sidecar tests against the new image — all 12 previously failing tests should now passJira ticket
https://gudtech.atlassian.net/browse/ROP-9213
🤖 Generated with Claude Code