Skip to content

Split production and experimental ForkPress builds#29

Merged
JanJakes merged 29 commits into
trunkfrom
refactor
May 7, 2026
Merged

Split production and experimental ForkPress builds#29
JanJakes merged 29 commits into
trunkfrom
refactor

Conversation

@JanJakes
Copy link
Copy Markdown
Contributor

@JanJakes JanJakes commented May 6, 2026

Summary

This PR separates the shippable forkpress binary from experimental storage work:

  • keeps production focused on materialized COW storage with APFS clonefile, APFS sparsebundle, Linux FICLONE reflinks, and file-copy fallback
  • adds a separate forkpress-dev binary behind the dev-experiments Cargo feature for BranchFS, CAS, and ZFS experiments
  • splits production Rust into focused crates under crates/: forkpress-cli, forkpress-core, forkpress-storage, forkpress-runtime, forkpress-server, and forkpress-git
  • keeps experiment Rust crates with their experiment code, currently experiments/cas/crates/{cas-store,cas-ffi}
  • keeps production runtime inputs narrow under runtime/cow/, scripts/cow/, scripts/git/, and scripts/shared/
  • groups BranchFS runtime, scripts, Git adapter, PHP extension, schema, and tests under experiments/branchfs/
  • groups CAS runtime, Rust crates, and e2e coverage under experiments/cas/
  • moves ZFS code under experiments/zfs-engine/
  • updates CI, release jobs, Makefile targets, README, storage docs, and contributor docs for the two-binary and multi-crate layout
  • includes COW Git hardening from this branch, including signed commit parsing, branch mutation locking, Git-created branch support, branch deletion/reset, and path normalization checks

Stacking note: this work was developed on top of codex/cow-database-sql-schema-snapshot-clean and is now rebased onto latest trunk.

Binary size

Measured on macOS arm64 release builds with the embedded runtime bundle:

Build Size Delta vs pre-split single-binary base
before: single forkpress from the pre-split base 36.11 MiB / 37,867,648 bytes baseline
after: production forkpress 34.24 MiB / 35,906,592 bytes -1.87 MiB / -5.2%
after: forkpress-dev with experiments 36.13 MiB / 37,885,328 bytes +0.02 MiB / +0.0%

The production PHP runtime itself drops from 25.78 MiB to 23.38 MiB (-2.40 MiB / -9.3%) because BranchFS/CAS are no longer built into production PHP. The dev PHP runtime remains at 25.78 MiB, matching the previous all-experiments shape. The end-to-end binary delta is modest because the embedded WordPress/PHP/runtime assets dominate the final binary size.

Validation

  • cargo test --workspace --exclude forkpress-cli
  • cargo test -p forkpress-core --features dev-experiments
  • FORKPRESS_RUNTIME_BUNDLE=/dev/null cargo test -p forkpress-cli --bin forkpress
  • FORKPRESS_RUNTIME_BUNDLE=/dev/null cargo test -p forkpress-cli --features dev-experiments --bin forkpress-dev
  • cargo build --release -p forkpress-cli --bin forkpress
  • cargo build --release -p forkpress-cli --features dev-experiments --bin forkpress-dev
  • cargo fmt --check
  • git diff --check
  • bash -n scripts/build-dist.sh
  • bash -n scripts/release/try-single-binary-detach.sh
  • bash -n tests/cow/e2e.sh
  • bash -n experiments/cas/tests/e2e.sh
  • make -n forkpress forkpress-dev test-all
  • PHP lint over scripts/, runtime/cow/, experiments/branchfs/, experiments/cas/runtime/, tests/cow/, and experiments/branchfs/tests/
  • make test-cow
  • make test-branchfs
  • target/release/forkpress --help
  • target/release/forkpress-dev --help
  • inspected embedded runtime tarballs: production contains no experiments/**; dev contains BranchFS/CAS experiment runtime and scripts

@JanJakes JanJakes changed the base branch from trunk to codex/cow-database-sql-schema-snapshot-clean May 6, 2026 10:21
@JanJakes JanJakes force-pushed the codex/cow-database-sql-schema-snapshot-clean branch from 2110595 to 9e52b13 Compare May 6, 2026 18:57
@JanJakes JanJakes changed the base branch from codex/cow-database-sql-schema-snapshot-clean to trunk May 6, 2026 19:01
@JanJakes JanJakes changed the base branch from trunk to codex/cow-database-sql-schema-snapshot-clean May 6, 2026 19:01
@JanJakes JanJakes changed the base branch from codex/cow-database-sql-schema-snapshot-clean to trunk May 6, 2026 19:02
JanJakes added 9 commits May 7, 2026 16:17
Make the default forkpress binary production COW-only. Add the forkpress-dev target behind the dev-experiments feature, keep experimental BranchFS/CAS/ZFS surfaces out of the default binary, and profile the embedded PHP runtime bundle accordingly.
Make the bundled WordPress helper use ForkPress naming instead of BranchFS naming. Keep BranchFS compatibility hooks inside the plugin for forkpress-dev, but install it as forkpress-wp.php for production COW sites.
Relocate the CAS crates and embedded ZFS engine into explicit experiment directories. Keep package names stable for dev builds while making the repository layout reflect that these paths are outside the production ForkPress binary.
Build and test the production forkpress binary separately from forkpress-dev. Move CAS e2e coverage to the dev binary, keep releases production-only, and document the production COW cascade versus experimental storage paths.
Keep BranchFS SQL and experiment-only runtime inputs out of the production bundle and release trigger surface. Leave them in the dev runtime profile for forkpress-dev.
Replace the remaining BranchFS-era marker filename in the vendored SQLite integration snapshot with ForkPress naming. The marker is metadata only, but it should not appear in the production runtime bundle as an experiment reference.
Support Git commit header continuation lines so signed commits with gpgsig blocks can be parsed. This keeps COW push handling independent of the user's local commit signing configuration.
Production bundles still need the SQLite hot-copy helper for COW branch reset. Keep only backup.php and sqlite_retry.php alongside the COW Git adapter, and update the production e2e to initialize through the default forkpress command shape.
Give the experimental CAS router the same longer request budget used by the Git adapters so first-load branchfs/CAS WordPress requests are not killed by PHP's default 30 second limit.
JanJakes added 2 commits May 7, 2026 16:31
Fail the production forkpress wrapper when dev-experiments is enabled so experimental commands cannot be accidentally shipped under the production binary name.
Keep BranchFS-only WordPress hooks in a dev-only mu-plugin and bundle only the common ForkPress integration plugin in production.
@JanJakes JanJakes marked this pull request as ready for review May 7, 2026 14:36
JanJakes added 8 commits May 7, 2026 16:43
Keep the embedded ZFS research code under the top-level experiments directory and update the dev-only build references accordingly.
Keep the experimental BranchFS PHP extension source and local test build output under experiments/php-ext-branchfs, and update build, CI, script, and test references.
Keep the BranchFS/CAS-only mu-plugin under experiments/wp-plugin and update dev runtime bundle paths.
Move the BranchFS schema and PHP extension under experiments/branchfs and update dev build, scripts, tests, and documentation references.
JanJakes added 2 commits May 7, 2026 17:25
Put the CLI package at crates/forkpress-cli and keep the installed binary names as forkpress and forkpress-dev. Move experimental CAS Rust crates under crates/experiments while leaving their runtime and test fixtures under experiments/.
@JanJakes JanJakes marked this pull request as draft May 7, 2026 19:22
JanJakes added 8 commits May 7, 2026 21:36
Keep production and shared Rust packages under crates/. Move CAS experiment packages under experiments/cas/crates so all CAS-specific runtime, tests, and Rust code are grouped together.
Move layout, manifest parsing, storage strategy types, path normalization, and branch-name validation into forkpress-core. Keep CLI command parsing and behavior in forkpress-cli for the next split steps.
Move portable runtime extraction, WordPress archive unpacking, PHP command helpers, script execution, and filtered PHP output into forkpress-runtime. Keep the embedded runtime bytes supplied by forkpress-cli's build script.
Move production branch lifecycle, APFS sparsebundle handling, clonefile/FICLONE tree materialization, copy fallback, branch locks, and SQLite reset helpers into forkpress-storage. Keep branch lifecycle and file clone mechanics together as one storage layer.
Move child process guarding, server registry records, pid file handling, process signaling, and TCP readiness checks into forkpress-server. Keep CLI commands as orchestration over the server crate.
Move Git command execution, ref helpers, agent worktree creation, and server-normalized push sync into forkpress-git. Keep CLI argument parsing and high-level command routing in forkpress-cli.
Describe the production Rust crates, clarify where experiment-specific code lives, and expand CI unit-test coverage for the extracted workspace crates.
Gate test-only and dev-only helper imports so release builds stay warning-free after the crate split.
@JanJakes JanJakes marked this pull request as ready for review May 7, 2026 19:58
@JanJakes
Copy link
Copy Markdown
Contributor Author

JanJakes commented May 7, 2026

I did a couple of review rounds, and all seems OK, so I'll get it in now.

@JanJakes JanJakes merged commit 459683d into trunk May 7, 2026
8 checks passed
@JanJakes JanJakes deleted the refactor branch May 7, 2026 19:59
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