Skip to content

chore: merge train 245 (v0.5.1624) - #10845

Merged
proggeramlug merged 5 commits into
mainfrom
train245r
Sep 20, 2026
Merged

proggeramlug merged 5 commits into
mainfrom
train245r

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Merge train 245 — the combined pg + mysql2 native-binding removal. −6,705 lines. Released as v0.5.1624.

Contents

source Change
#10677 chore(pg): remove the native pg binding, compile the real package from source
#10680 refactor(stdlib): remove the mysql2 native binding

Why these two together, and not one at a time

#10678's hazard is only closed by removing both. Each binding existed twice — crates/perry-ext-pg (sqlx + tokio over perry-ffi) and the pre-#466 in-tree implementation in crates/perry-stdlib/src/pg/, kept alive behind a bundled-pg feature since before the migration. Both defined the same extern "C" symbols (js_pg_client_new, js_pg_client_query, …), and whichever won the link order silently shadowed the other. That is not a link error; it is a choice made by command-line ordering that nothing reported.

Removing one binding leaves the other's pair intact. Landing them as one tree is what makes the duplicate-symbol claim true rather than half-true.

import ... from "pg" no longer resolves as a native module at all. It compiles the real npm package from source, with pg and its 13 transitive deps picked up by the compile-package wildcard — and mysql2 likewise, including the generate-function row-parser factory handled at runtime via dyn_eval.

Also removed: the [bindings.pg] / [bindings.mysql2] entries, the NATIVE_MODULES rows and api-manifest entries, the NativeModSig dispatch rows in lower_call/native_table/databases.rs, the stdlib_features.rs / optimized_libs feature-gate arms, the bundled-* / database-postgres Cargo features, the now-unreachable sqlx "postgres" feature, and the workspace-architecture.json entries.

One consequence worth naming: dropping the "Client" | "Pool" => Some(&["pg"]) import gate leaves a user-defined Pool/Client on the generic path — which is what #536 wanted anyway.

Verified against live servers

Both fragments carry end-to-end evidence, and both are stronger than the source PRs' own:

Rebase: the Cargo.lock was regenerated, not hand-merged

The rebase onto v0.5.1623 conflicted in Cargo.lock. A hand-merged lock for a change that deletes two crates and their transitive dependency trees is a guess; this took main's lock and let cargo reconcile it against this tree's manifests, then asserted the result: cargo metadata --offline --locked exits 0, no conflict markers, and no perry-ext-{pg,mysql2} / postgres / mysql_* entries remain.

Absolute counts re-derived against the new base, not carried

Removal counts are chained absolutes — a baseline re-derived against yesterday's main is wrong against today's. All eight ratchets were re-run on the rebased tree: native_result_ledger, gc_runtime_root_holders, shape_descriptor_census, check_file_size, addr_class_inventory, raw_handle_debt, unrooted_local_shape, string_payload_access_inventory — every one green.

binding_governance --check was then checked for discrimination rather than assumed live: rc=0 on this tree, and rc=1 on main's workspace-architecture.json with

FAIL architecture binding inventory has unexpected entries: perry-ext-mysql2, perry-ext-pg

workspace_architecture.py, incidentally, passes on both — it is a reporter, not the gate. Running it and reading its exit code would have proved nothing.

Representation, checked on the part where the sibling cannot confound it

A naive whole-PR representation check reports ~1,000 "missing" insertions per PR here, because each PR is stale relative to the union: #10677 alone keeps mysql2, #10680 alone keeps pg. Checking each PR against only its exclusive, non-changelog files removes that confound:

The remaining flagged lines are changelog prose the combined re-derive commit rewrote, with the stronger evidence quoted above.

Validation

Source heads asserted fresh against the assembly record before spending the cycle; no attribution trailers on any of the five commits. Ten cheap gates, cargo check --workspace --all-targets under -D warnings, all five pinned artifacts byte-identical before and after the gap sweep.

  • lint complete at 6-of-6 compile commands, lint_unexpected_failures=[]
  • 6 unit suites, failing set empty — the set, not a count
  • integration suites live=[] deleted=[] — verified correct rather than assumed: neither deleted crate had a tests/*.rs, and the train touches no integration test file at all, so the empty stamp is a real answer and not a broken derivation
  • cor_native-region-proof / cor_native-abi-proof both rc=0, failed_workloads=[] — no transient excused
  • repsel_census rc=0 wasted_promotion=False
  • security_audit: the single tracked RUSTSEC-2026-0285 (security: cargo audit fails on RUSTSEC-2026-0285 (rustls 0.23.44) — the fix is unblocked by the soak window on 2026-09-21 #10791), nothing else

Gap sweep at PERRY_RUN_TIMEOUT=30 over the module-resolution surface this removal moves pg/mysql2 onto, plus class as an unrelated control. 140 fixtures, every area asserted live, zero unexplained regressions:

class 84   import 20   module 14   export 8   cjs 6   require 5   sql 3

Ralph Küpper added 5 commits September 21, 2026 00:50
…#10677)

Squashed rebase of #10677 onto main. Generated/absolute-count files (Cargo.lock, docs/api/perry.d.ts, docs/src/api/reference.md, scripts/native_result_ledger.py, scripts/string_payload_access_baseline.txt, scripts/unrooted_local_shape_baseline.json, workspace-architecture.json) are left at main's values here and regenerated from their owning scripts in a later commit (#10739).
Squashed rebase of #10680 on top of #10677. Generated/absolute-count files are left at main's values here and regenerated from their owning scripts in a later commit (#10739).

Non-obvious conflict call: #10680's side of crates/perry-hir/src/lower/expr_call/native_module.rs still contained native_module_member_path(), which main deleted with the node-forge binding. Taking 'theirs' would have resurrected it as dead code, so the whole hunk resolves to empty.
#10677 deleted perry-ext-pg and perry-stdlib/src/pg but left the call sites
that reference their symbols:

- lower_call/builtin.rs still lowered `new Client(cfg)`/`new Pool(cfg)` from
  an `import ... from "pg"` to `js_pg_client_new`/`js_pg_pool_new`. With no
  provider those are undefined at link time, which is exactly the failure the
  real `pg` package would hit (it constructs `new Client`). Dropped the two
  arms and the `"Client" | "Pool" => Some(&["pg"])" import gate together, so
  a user-defined Pool/Client falls through to the generic path (#536).
- runtime_decls/stdlib_ffi/data_stores.rs declared the ten js_pg_* externs.
- perry-ui-android/src/stdlib_stubs.rs defined seven js_pg_* stubs (#10680 had
  already dropped the matching mysql2 ones).
- perry-codegen-js browser-emit list and a native_table/mod.rs comment.
- scripts/run_doc_tests.sh / .ps1 still passed -p perry-ext-pg to cargo build,
  which no longer resolves.
…ysql2 removal

that is now 28 commits behind `main`, so neither side's numbers could be
merged (#10739). Every count below is what the owning script reports on this
resolved tree — none of it is arithmetic on the two PRs' figures:

  Cargo.lock                     cargo metadata --offline
                                 (drops perry-ext-pg, perry-ext-mysql2 and,
                                 via sqlx's mysql-rsa edge, rsa/pkcs1/
                                 crypto-primes)
  workspace-architecture.json    scripts/workspace_architecture.py --check
                                 --print-summary: members 66 -> 64,
                                 externalize 17 -> 15 (keep/merge/remove/
                                 review unchanged). The two `crates` policy
                                 entries are deleted; the script errors on a
                                 policy entry with no workspace crate.
  native_result_ledger.py/.tsv   scripts/native_result_ledger.py:
                                 349 -> 314 rows, 300 -> 279 providers.
                                 Both PRs landed on 349/300 for unrelated
                                 reasons, so the textual auto-merge agreed
                                 and was wrong.
  unrooted_local_shape_baseline  scripts/unrooted_local_shape.py
                                 --update-baseline: total 527 -> 428.
  string_payload_access_baseline scripts/string_payload_access_inventory.py
                                 --write-baseline: perry-stdlib 36 -> 28,
                                 the perry-ext-pg/mysql2 rows dropped.
  docs/src/api/reference.md      target/<profile>/perry --print-api-manifest
  docs/api/perry.d.ts            (run directly: regen_api_docs.sh hardcodes
                                 <worktree>/target/release/perry and silently
                                 truncates both files when that path is
                                 absent). 2870 -> 2829 entries across
                                 120 -> 117 modules, which is exactly the 41
                                 manifest rows (9 pg + 32 mysql2) and 3
                                 specifiers removed; tails intact.

Also folded in here: a stray `}` left in perry-hir's native_module.rs by the
conflict markers), the changelog fragments corrected to the results actually
measured on this branch, and a `pg` entry in governance.md's "Completed
source migrations" list to match the one #10680 added for mysql2.
@proggeramlug
proggeramlug merged commit b3bffd7 into main Sep 20, 2026
27 of 29 checks passed
@proggeramlug
proggeramlug deleted the train245r branch September 20, 2026 23:53
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 88e1fec8-7ead-4861-a6d6-e034d30bd16f

📥 Commits

Reviewing files that changed from the base of the PR and between 91cc563 and 4deb692.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • scripts/native_result_ledger.tsv is excluded by !**/*.tsv
📒 Files selected for processing (52)
  • .github/workflows/test.yml
  • CLAUDE.md
  • Cargo.toml
  • changelog.d/10677-remove-pg-native-binding.md
  • changelog.d/10680-mysql2-native-binding-removal.md
  • crates/perry-api-manifest/src/entries.rs
  • crates/perry-api-manifest/src/entries/part_1.rs
  • crates/perry-api-manifest/src/entries/part_3.rs
  • crates/perry-codegen-js/src/emit/native.rs
  • crates/perry-codegen/src/ext_registry.rs
  • crates/perry-codegen/src/lower_call/builtin.rs
  • crates/perry-codegen/src/lower_call/native_table/databases.rs
  • crates/perry-codegen/src/lower_call/native_table/mod.rs
  • crates/perry-codegen/src/runtime_decls/stdlib_ffi.rs
  • crates/perry-codegen/src/runtime_decls/stdlib_ffi/data_stores.rs
  • crates/perry-ext-mysql2/Cargo.toml
  • crates/perry-ext-mysql2/src/lib.rs
  • crates/perry-ext-mysql2/src/test_async_shims.rs
  • crates/perry-ext-pg/Cargo.toml
  • crates/perry-ext-pg/src/lib.rs
  • crates/perry-hir/src/lower/expr_call/native_module.rs
  • crates/perry-stdlib/Cargo.toml
  • crates/perry-stdlib/src/common/dispatch/method_dispatch.rs
  • crates/perry-stdlib/src/common/dispatch/property_dispatch.rs
  • crates/perry-stdlib/src/lib.rs
  • crates/perry-stdlib/src/mysql2/connection.rs
  • crates/perry-stdlib/src/mysql2/mod.rs
  • crates/perry-stdlib/src/mysql2/pool.rs
  • crates/perry-stdlib/src/mysql2/result.rs
  • crates/perry-stdlib/src/mysql2/types.rs
  • crates/perry-stdlib/src/pg/connection.rs
  • crates/perry-stdlib/src/pg/mod.rs
  • crates/perry-stdlib/src/pg/pool.rs
  • crates/perry-stdlib/src/pg/result.rs
  • crates/perry-stdlib/src/pg/types.rs
  • crates/perry-ui-android/src/stdlib_stubs.rs
  • crates/perry/src/commands/compile/collect_modules/binding_faithfulness.rs
  • crates/perry/src/commands/compile/optimized_libs/driver.rs
  • crates/perry/src/commands/compile/optimized_libs/freshness.rs
  • crates/perry/src/commands/compile/resolve.rs
  • crates/perry/src/commands/stdlib_features.rs
  • crates/perry/well_known_bindings.toml
  • docs/api/perry.d.ts
  • docs/src/api/reference.md
  • docs/src/native-libraries/governance.md
  • docs/src/native-libraries/overview.md
  • scripts/native_result_ledger.py
  • scripts/run_doc_tests.ps1
  • scripts/run_doc_tests.sh
  • scripts/string_payload_access_baseline.txt
  • scripts/unrooted_local_shape_baseline.json
  • workspace-architecture.json
 __________________________________________________________________________________
< Crash early. A dead program normally does a lot less damage than a crippled one. >
 ----------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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