Skip to content

mariadb: add the relational database service#53

Open
brandonpayton wants to merge 2 commits into
mainfrom
migrate/mariadb-database
Open

mariadb: add the relational database service#53
brandonpayton wants to merge 2 commits into
mainfrom
migrate/mariadb-database

Conversation

@brandonpayton

@brandonpayton brandonpayton commented Jul 11, 2026

Copy link
Copy Markdown
Member

Purpose

Build MariaDB 10.5.28 from its canonical source archive as a first-class Kandelo Formula, using tap libcxx, ncurses, PCRE2, and zlib directly. Install the server, mysqltest-compatible client, bootstrap SQL, character sets, and generated error catalogs through the normal SDK/runtime path.

Formula contract

  • Build native CMake generators in the isolated host tool environment, then cross-compile mariadbd and mariadb-test for wasm32.
  • Reject unsupported architectures instead of building private dependency copies.
  • Validate final stripped executables for ABI, imports, Asyncify/fork state, relocatability, and host paths.
  • Preserve the registry server/mysqltest and SSL-disabled surface without bootstrap-exit or client-only source shortcuts.

Exact source head

Base: c5705667a90b05754d2244a362f3f7fc95d2f9c3

Head: 37ae32c2245428255071246ec4e8ef96483a990e

Formula SHA-256: cd1c1336abdc7a259fb6ee4c00cfabe9cb0555aa9384f7480f06840b469e9d2c

Source SHA-256: 0b5070208da0116640f20bd085f1136527f998cc23268715bcbf352e7b7f3cc1

Both commits range-diff identically from the accepted prior series; Formula bytes are unchanged. Exact receipts name 37ae32c and list exactly four direct target dependencies: libcxx 21.1.7, ncurses 6.5, PCRE2 10.44, and zlib 1.3.1_2.

Exact-head evidence

Two clean pre-#842 source builds were byte-identical:

  • mariadbd: de84ae99aceef8a29dad821015761253e799c80a295bd28b20293f9eeb69a917
  • mariadb-test: d0b2c2accb8723b9a2c8f17805a33fd2152b140fb8593dd2d7a4375a7433f9b7

Those bytes truthfully fail the lifecycle because the validation integration omitted #842:

  • __stack_pointer == __heap_base == 15782544, only 64 KiB above common BSS end 15717008
  • the downward stack overwrites musl pthread TSD key metadata with bytes decoding to ./mysql/db.frm
  • key 6's destructor becomes table index 1, an intentionally null slot, causing call_indirect type 3 at function 17280 / offset 0x76c346
  • none of the legitimate pthread key-create sites registers destructor index 1

Rebuilding the unchanged Formula with exact #842 over #882+#896 gives an 8 MiB reserve:

  • __stack_pointer == __heap_base == 24105616 = BSS end + 8 MiB
  • the boundary moves 8 MiB minus the old 64 KiB, or 8,323,072 bytes
  • mariadbd: 460df769fc779d254f485ed8ae2f8fba2d66eb50d4b5e065bb157c33f37544a8
  • mariadb-test: 5cbe43e126a7436bc0fdd7df1460cc4a41d72e25cf2db444eec58381c90a05a6
  • literal lifecycle passes bootstrap/system tables, restart, TCP listen on 3306, Aria create/insert/select with mariadb-homebrew-ok, SQL shutdown, and clean server exit

This proves a general SDK stack-input failure, not a Formula, plugin, pthread destructor, dependency, or ABI runtime defect.

All exact artifacts are ABI 18, fork-free, Asyncify-free, and free of user/temp/Nix/Cellar paths; #882 extracts ABI even from the 13.4 MB server. Support passes 37/279; style, strict audit, readall, dependency graph, receipt, diff, ancestry, and worktree checks pass.

Evidence archive: /private/tmp/mariadb-37ae32c-evidence.tar.gz, SHA-256 632e6c53390454448ce29299ee059411e6b66135f5cf61050c7cfccf7e8eece5.

Gates

Source/runtime validation requires #842, #882, and #896. #896's registry-image Node/Chromium checks are platform evidence only, not Homebrew bottle proof.

Final rebuild waits for exact merged #907 / ABI 39. #873 is required because the literal test instruments its supervisor. #888 is not a package-byte gate because both installed artifacts are fork-free; it applies only to the ephemeral test supervisor.

#903 is not currently required because #882 repeatedly extracts ABI from exact 13.4 MB artifacts. #905 is not separate because the supervisor uses manual fork and #905 is already included in #907.

Publication

Publication requires #881/#887/#890/#885/#895 plus #900 prior-bottle enforcement. Publish exact ABI 39 libcxx, ncurses, PCRE2, and zlib bottles first; build MariaDB from those poured bottles; record trusted provenance; then run stock Homebrew Node and Chromium lifecycle pours.

All ABI 18 bytes above are validation evidence only and are not publication candidates. No bottle block or binary artifact is committed.

@brandonpayton brandonpayton force-pushed the migrate/mariadb-database branch from 3354ae9 to fa6f905 Compare July 12, 2026 10:10
@brandonpayton

Copy link
Copy Markdown
Member Author

Independent devil review at exact refreshed head fa6f905b7fc2654493f273c187dbc77b12fabdda: ACCEPT the source-contract refresh; do not merge yet.

The original Formula is patch-identical after restacking on current tap main. The shared validator runs after conditional instrumentation and wasm-strip, so it inspects the exact bytes copied into the keg. fork: :auto preserves the intended conditional policy while adding fail-closed ABI/tool checks, Asyncify rejection, exact fork import/export consistency, and broader path rejection. Removed Node checks are fully subsumed; MariaDB's compiled-module and host-import allowlist remains unchanged. Binaryen is correctly declared for wasm-dis and WABT remains declared for wasm-objdump/wasm-strip.

Fresh dev-shell evidence: Ruby syntax; Homebrew style; shared support 30/221; and exact branch diff check pass. No refreshed source build, runtime test, Chromium run, bottle, or pour is claimed.

The old dependency gates #8/#37 are resolved. Remaining source merge gates are main #882 and the real browser fixture defect: /data is root-owned while mariadbd runs as uid/gid 101. The historical Chromium pass used an uncommitted ownership overlay, so a main-owned VFS fix and clean exact Chromium rerun are still required. Publication remains dependency-first and must prove prior bottles were poured without source fallback.

@brandonpayton

Copy link
Copy Markdown
Member Author

Platform ownership gate opened as Automattic/kandelo#896 at exact head ebb2a09f3b34e0d00b68791c207caa52d3192018.

Evidence on that branch:

  • rebuilt the mariadb-test VFS through its package build path
  • Chromium test 1st passed with MariaDB running as uid 101
  • the same rebuilt image reached a listening MariaDB service under NodeKernelHost
  • shared VFS uid/gid/mode tests passed (35/35 across the focused set)

This validates the Kandelo platform fixture using resolver-managed registry artifacts. It is deliberately not a claim that the MariaDB formula or its dependencies were poured from Homebrew bottles. That exact bottle-backed proof remains gated on the publisher and dependency receipts.

Restack the formula on tap main, load support through the installed tap, and route final stripped executables through the shared ABI, Asyncify, fork-policy, and path validator while retaining MariaDB-specific import checks.
@brandonpayton brandonpayton force-pushed the migrate/mariadb-database branch from fa6f905 to 37ae32c Compare July 13, 2026 02:48
@brandonpayton

Copy link
Copy Markdown
Member Author

Independent exact-head review completed for 37ae32c2245428255071246ec4e8ef96483a990e: ACCEPT for source review; not merge/publish ready.

  • Two-commit content preservation, source hash, exact four-dependency receipts, support 37/279, style/audit/readall, and artifact contracts pass.
  • Two pre-#842 builds are reproducible but fail because the 64 KiB main stack overwrites pthread-key BSS; the exact trap/key/table/data evidence rules out a Formula or destructor-linkage defect.
  • Rebuilding the unchanged Formula with #842 supplies BSS + 8 MiB and passes bootstrap, listen, Aria query, shutdown, and clean exit.
  • Artifacts are ABI 18, fork-free, Asyncify-free, path-clean, and readable by #882 even at 13.4 MB.
  • Source/runtime gates are #842/#882/#896. Final publication waits exact #907/ABI39, prior libcxx/ncurses/PCRE2/zlib bottles under #900, trusted provenance, and stock Node/Chromium lifecycle pours.
  • #888 is only relevant to the ephemeral test supervisor; #903/#905 are not separate package gates.

No Formula blocker was found. ABI 18 bytes remain nonpublishable evidence only.

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