Skip to content

build: add optional Rust and CXX bridge support - #7580

Open
PastaPastaPasta wants to merge 58 commits into
dashpay:developfrom
PastaPastaPasta:feat/optional-rust-components
Open

build: add optional Rust and CXX bridge support#7580
PastaPastaPasta wants to merge 58 commits into
dashpay:developfrom
PastaPastaPasta:feat/optional-rust-components

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Aug 11, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Dash Core needs a reproducible, cross-platform Rust and C++ bridge foundation before the Dash Platform GUI components can be split into reviewable follow-up pull requests. The earlier draft #7109 established this direction but is now stale and conflicting.

This PR carries that work forward on current develop, preserves the original commit authorship, and keeps Rust completely opt-in so normal developer and release builds are unaffected.

What was done?

  • Add an opt-in --enable-rust build path backed by Rust 1.92.0 and cxxbridge 1.0.198.
  • Add depends packages for the native Rust toolchain, target standard libraries, cxxbridge, and offline vendored crates.
  • Add an umbrella Rust static library and a small chirp bridge that proves the end-to-end C++ integration.
  • Support native and cross-build target/linker configuration, deliberately confined to the hosts we validate: x86_64/aarch64/riscv64 Linux, x86_64 Windows, and both macOS architectures. --enable-rust on any other host fails explicitly rather than fetching a Rust standard library we never build or test; additional targets can be provisioned later together with CI lanes that actually exercise them.
  • Add update and vendoring scripts with pinned hashes and safe archive extraction.
  • Add a dedicated linux64_rust depends and source CI lane.
  • Leave default depends and source builds Rust-free. Guix and release builds are intentionally not enabled in this foundation PR.

This replaces #7109 and is intended as the base for the Rust-backed DashPay GUI work currently demonstrated in PastaPastaPasta#67.

How Has This Been Tested?

Tested locally on macOS arm64:

  • Built depends with RUST=1 and completed a Rust-enabled Dash Core build.
  • Started dashd on regtest and confirmed the Rust chirp bridge executed at runtime.
  • Built the Rust workspace with cargo check --workspace --locked and verified formatting with cargo fmt --all -- --check.
  • Generated a source distribution and verified that the Rust sources and generated CXX bridge artifacts are included.
  • Rebuilt depends without RUST=1, verified no Rust packages or vendoring ran, then completed a clean Dash Core build with --disable-rust.
  • Ran test/lint/all-lint.py successfully.
  • Re-ran the native cxxbridge lockfile updater and verified the root lockfile remained stable.
  • Validated the new CI shell and workflow configuration locally.

Breaking Changes

None. Rust support is disabled by default and existing build invocations retain their current behavior.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

This pull request was created by Codex.

kwvg and others added 25 commits August 11, 2026 10:28
Eventually, `rust/` will be hosting primarily subtrees, whose contents
we cannot directly influence, so linting it makes little sense.
Co-authored-by: pasta <pasta@dashboost.org>
Needed for cross-compilation to work correctly
This can be removed alongside the whole minimal crate when we have
actual crates to slot in.
We're using `depends` to provide us with the Rust compiler and
`cxxbridge`, we can drop it from the CI container and save some space.
The conflict occurs due a difference in glibc version between the Guix
environment and the targets compiled, this is only a problem for Linux
targets so the issue doesn't extend to Windows
…ging

Merging per-crate staticlibs with 'ar -x' into a flat directory silently
drops object files once member basenames collide, which happens as soon as
two crates share dependencies (measured: 373 of 374 members collide between
two crates built from one workspace). Replace the merge with an umbrella
staticlib crate, rust/dashrust, that depends on each component as an rlib:
cargo deduplicates shared dependencies, applies LTO across the whole graph,
and emits a single archive. Component crates keep their own cxx bridges and
codegen; per-crate Makefile includes now contribute only cxxbridge artifacts.
Optional components become cargo features on the umbrella crate, plumbed
from configure via RUST_CRATE_FEATURES. Per-crate dist-hook recipes are
replaced by an aggregate dist-hook so additional crates do not collide on
automake's one-recipe-per-Makefile rule.
The dashpay/platform v4.1.0 workspace declares rust-version 1.92; rustc
1.85.1 refuses nine of its crates by name. Hashes regenerated with
contrib/devtools/update-rust-hashes.py. cxx/cxxbridge stay at 1.0.192,
which compiles unchanged under 1.92.
The offline cargo configuration was generated into the source tree, which
pollutes srcdir and races when multiple out-of-tree builds for different
hosts share one checkout. Cargo discovers .cargo/config.toml by walking up
from its invocation directory, so a config under the build tree's root
works for both in-tree and out-of-tree builds.
cargo vendor handles git dependencies, but consuming the vendor directory
offline requires per-git-source replacement stanzas in .cargo/config.toml,
which the build system previously did not generate (only crates.io was
redirected). Derive the stanzas deterministically from Cargo.lock with
contrib/devtools/cargo-vendor-git-sources.sh — output verified byte-identical
to what cargo vendor itself prints — and append them when generating the
offline config. Git dependencies are unavoidable for upcoming components:
crates.io copies of the dashpay/platform crates are stale or name-squatted.
@thepastaclaw

thepastaclaw commented Aug 11, 2026

Copy link
Copy Markdown

⛔ Blockers found — Opus deferred (commit eeb3b91)
Canonical validated blockers: 1

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e286842c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread configure.ac Outdated
Comment thread configure.ac Outdated
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 81ab5f1a-fad1-4945-af05-2b1aa0b527ec

📥 Commits

Reviewing files that changed from the base of the PR and between 9c94e2c and eeb3b91.

📒 Files selected for processing (6)
  • configure.ac
  • contrib/devtools/update-native-cxxbridge.py
  • contrib/devtools/update-rust-hashes.py
  • depends/packages/native_rust.mk
  • depends/packages/rust_stdlib.mk
  • rust/Makefile.chirp.include
💤 Files with no reviewable changes (1)
  • depends/packages/native_rust.mk
🚧 Files skipped from review as they are similar to previous changes (2)
  • rust/Makefile.chirp.include
  • configure.ac

Walkthrough

The change adds optional Rust support to the build system. It provisions Rust and standard-library packages, vendors Cargo dependencies, configures targets and linkers, and adds Linux Rust CI jobs. It introduces the chirp and dashrust crates, generates CXX bridge sources, links Rust libraries into C++ targets, and logs and tests the bridge output.

Estimated code review effort: 4 (Complex) | ~60 minutes

Mergeability Score: 🔵 Low · up to eeb3b

The optional Rust build currently lacks the big-endian PowerPC standard-library target mapping, so Rust-enabled builds for that platform would fail. This is a bounded cross-platform compatibility gap; the PR is mergeable with explicit owner awareness or follow-up.

Sequence Diagram(s)

sequenceDiagram
  participant Configure
  participant Depends
  participant Cargo
  participant Cxxbridge
  participant CppTargets
  Configure->>Depends: Configure Rust tools and targets
  Depends->>Cargo: Vendor dependencies and install Rust targets
  Cargo->>Cxxbridge: Build chirp and generate bridge artifacts
  Cxxbridge->>CppTargets: Provide bridge sources and headers
  Cargo->>CppTargets: Provide libdashrust.a
  CppTargets->>CppTargets: Link Rust and CXX bridge libraries
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely summarizes the PR's primary change: optional Rust and CXX bridge support.
Description check ✅ Passed The description directly explains the optional Rust and CXX bridge foundation, implementation details, testing, and unchanged default behavior.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@depends/funcs.mk`:
- Line 88: Remove the tar -P option from every archive-extraction command at
depends/funcs.mk lines 88, 293-296, and 337-340, and depends/Makefile lines 216,
224, and 237. Preserve the existing checksum validation and all other extraction
options.

In `@depends/Makefile`:
- Around line 221-228: The $(host_prefix)/$(CRATE_REGISTRY) target must depend
on the workspace Cargo.lock so lockfile changes invalidate the vendored
registry. Update this target’s prerequisites using the existing workspace path,
and ensure the $(CRATE_ARCHIVE) path is regenerated or validated against that
same lockfile before extraction.

In `@rust/Makefile.chirp.include`:
- Around line 39-43: Guard the cp branches in both lib.cpp
(rust/Makefile.chirp.include lines 39-43) and lib.h (rust/Makefile.chirp.include
lines 47-51) recipes with a source/destination inequality check, so copying is
skipped when $(LIBRUST_CHIRP_GEN_SRCDIR) resolves to the build output path;
retain the existing CXXBRIDGE generation fallback.

In `@rust/Makefile.libs.include`:
- Around line 55-56: Update the $(LIBRUSTDEPS) rule prerequisites to include
$(CARGO_CONFIGURED), the root Cargo.toml, and Cargo.lock, ensuring configuration
is generated before Cargo runs and changes to workspace metadata rebuild
libdashrust.a.

In `@src/init.cpp`:
- Around line 1483-1485: Add a targeted C++ unit test for the ENABLE_RUST bridge
behavior, invoking chirp::chirp() and asserting its expected result. Place the
test with the existing C++ unit-test suite and ensure it is included in the
relevant test target; leave the startup logging in the init path unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d68cf288-94bf-4484-9351-5b69296956da

📥 Commits

Reviewing files that changed from the base of the PR and between 2a28739 and 6e28684.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • depends/patches/native_cxxbridge/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (36)
  • .cargo/config.toml.offline
  • .github/workflows/build.yml
  • .gitignore
  • Cargo.toml
  • Makefile.am
  • ci/dash/matrix.sh
  • ci/test/00_setup_env_native_rust.sh
  • configure.ac
  • contrib/devtools/cargo-vendor-git-sources.sh
  • contrib/devtools/update-native-cxxbridge.py
  • contrib/devtools/update-rust-hashes.py
  • depends/Makefile
  • depends/config.site.in
  • depends/funcs.mk
  • depends/packages/native_cxxbridge.mk
  • depends/packages/native_rust.mk
  • depends/packages/packages.mk
  • depends/packages/rust_stdlib.mk
  • depends/packages/rustcxx.mk
  • depends/patches/native_cxxbridge/cargo-config.toml
  • depends/patches/native_rust/fix-elf-interpreter.sh
  • rust-toolchain.toml
  • rust/Makefile.am
  • rust/Makefile.chirp.include
  • rust/Makefile.libs.include
  • rust/chirp/Cargo.toml
  • rust/chirp/build.rs
  • rust/chirp/src/lib.rs
  • rust/dashrust/Cargo.toml
  • rust/dashrust/src/lib.rs
  • src/Makefile.am
  • src/Makefile.bench.include
  • src/Makefile.qt.include
  • src/Makefile.qttest.include
  • src/Makefile.test.include
  • src/init.cpp

Comment thread depends/funcs.mk Outdated
Comment thread depends/Makefile Outdated
Comment thread rust/Makefile.chirp.include Outdated
Comment thread rust/Makefile.libs.include Outdated
Comment thread src/init.cpp
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Potential PR merge conflicts

This is advisory only. It does not block CI, but it marks PRs that will likely need a rebase depending on merge order.

If this PR merges first

These open PRs will likely need a rebase:

If these PRs merge first

This PR will likely need a rebase:

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0afa9e49d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread configure.ac
Comment thread depends/packages/native_rust.mk Outdated
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

@coderabbitai review

Please review the current head (0afa9e49d8ed), focusing on the two final reliability fixes: retry-safe Rust vendoring and preservation of developer Cargo configuration. Evaluate them in the context of this being the opt-in foundational Rust/CXX PR for the DashPay series.


🤖 Posted autonomously by Codex on behalf of pasta.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

@PastaPastaPasta I will review commit 0afa9e49d8ed. I will focus on retry-safe Rust vendoring and preservation of developer Cargo configuration.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
depends/packages/rust_stdlib.mk (1)

40-58: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy lift

Document the GNU-linker/musl-target contract. The mapping is intentional to avoid Guix glibc version conflicts, but the build links musl Rust libraries through GNU host compilers. Document the static-CRT and C++ linking requirements, and add link coverage for each supported Linux target.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@depends/packages/rust_stdlib.mk` around lines 40 - 58, Update the rust_stdlib
target mappings to document that GNU host compilers link against musl Rust
libraries to avoid Guix glibc conflicts, including the required static CRT and
C++ linking behavior. Add link-coverage checks for every supported Linux target
defined by the target and hash variables, including ARMv7, AArch64, and i686
variants.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@depends/packages/rust_stdlib.mk`:
- Around line 40-58: Update the rust_stdlib target mappings to document that GNU
host compilers link against musl Rust libraries to avoid Guix glibc conflicts,
including the required static CRT and C++ linking behavior. Add link-coverage
checks for every supported Linux target defined by the target and hash
variables, including ARMv7, AArch64, and i686 variants.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 926c7495-9815-4ea2-80d8-5c7872b7c39e

📥 Commits

Reviewing files that changed from the base of the PR and between 043706d and 0afa9e4.

📒 Files selected for processing (7)
  • .gitignore
  • configure.ac
  • contrib/devtools/update-rust-hashes.py
  • depends/Makefile
  • depends/packages/rust_stdlib.mk
  • rust/Makefile.am
  • rust/Makefile.common.include
🚧 Files skipped from review as they are similar to previous changes (4)
  • .gitignore
  • rust/Makefile.am
  • rust/Makefile.common.include
  • contrib/devtools/update-rust-hashes.py

@PastaPastaPasta

Copy link
Copy Markdown
Member Author

I evaluated the remaining CodeRabbit nitpick against the scope of this foundational PR and am not expanding it into an all-target Linux link matrix:

  • The musl target selection is deliberate and already encoded explicitly in rust_stdlib.mk; the GNU host compiler remains the final C++ linker while Rust supplies a static library/CRT for the selected target.
  • This PR’s required end-to-end portability gate is the dedicated linux64_rust lane. Adding ARMv7, AArch64, i686, and every other provisioned target as full link jobs would be a substantial CI expansion, not a correction to the reviewed changes.
  • The target/hash updater and depends downloads already validate that every declared stdlib artifact exists and matches its official checksum.

I’m treating broader cross-target link coverage as follow-up portability work, not a blocker for the opt-in DashPay Rust/CXX foundation.


🤖 Posted autonomously by Codex on behalf of pasta.

@PastaPastaPasta

Copy link
Copy Markdown
Member Author

@coderabbitai review

Please review the current head (9c94e2c6e63c), focusing on the Cargo toolchain version check and the scoped per-package hashing/execution of fix-elf-interpreter.sh.


🤖 Posted autonomously by Codex on behalf of pasta.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c94e2c6e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread contrib/devtools/update-native-cxxbridge.py Outdated
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git status --short
git show --no-ext-diff --format=fuller --stat 9c94e2c6e63c
git diff --no-ext-diff 9c94e2c6e63c^ 9c94e2c6e63c -- \
  configure.ac \
  depends/funcs.mk \
  depends/packages/native_rust.mk \
  depends/patches/native_rust/fix-elf-interpreter.sh \
  depends/Makefile \
  depends/packages/native_cxxbridge.mk

printf '\n--- Candidate files ---\n'
fd -a -t f '^(configure\.ac|funcs\.mk|native_rust\.mk|native_cxxbridge\.mk|fix-elf-interpreter\.sh)$' . \
  | sort

printf '\n--- Relevant definitions and invocations ---\n'
rg -n -C 5 -P \
  'CARGO.*VERSION|cargo.*version|RUSTUP_TOOLCHAIN|fix-elf-interpreter|int_.*(hash|stage)|_stage_cmds|_hash' \
  configure.ac depends

Length of output: 73172


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Package path definitions ---'
sed -n '45,115p' depends/funcs.mk
sed -n '1,80p' depends/packages/native_cxxbridge.mk
sed -n '1,75p' depends/packages/native_rust.mk

printf '%s\n' '--- All interpreter-fix references and files ---'
rg -n -C 3 -F 'fix-elf-interpreter.sh' .
find depends/patches -type f -name 'fix-elf-interpreter.sh' -print

printf '%s\n' '--- Cargo detection and Rust version checks ---'
sed -n '115,165p' configure.ac
sed -n '1745,1810p' configure.ac
sed -n '1860,1930p' configure.ac
rg -n -C 3 -P '\$CARGO\s+--version|CARGO_REQUIRED_VERSION|AC_PATH_PROG\(\[CARGO\]' configure.ac

printf '%s\n' '--- Make database expansion for relevant package variables ---'
make -s -C depends -pn RUST=1 2>/dev/null \
  | grep -E '^(native_(cxxbridge|rust)_(patch_dir|patches|recipe_hash|all_file_checksums)|PATCHES_PATH) ?[:=]' \
  | sort || true

Length of output: 20640


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Depends patch staging rules ---'
rg -n -C 8 -P 'patch_dir|_patches|\.patches-|cp .*patch|for .*patch' depends/funcs.mk depends/Makefile

printf '%s\n' '--- Expanded native_cxxbridge commands and variables ---'
make -C depends -pn RUST=1 \
  | grep -E '^(native_cxxbridge_(patch_dir|patches|preprocess_cmds|stage_cmds|recipe_hash|all_file_checksums)|base_build_dir|PATCHES_PATH) ?[:=]' \
  | sed -n '1,120p'

printf '%s\n' '--- Cargo-check introduction and relevant history ---'
git log --no-ext-diff --format='%H %s' --all -- configure.ac | head -40
git log --no-ext-diff -S'CARGO_REQUIRED_VERSION' --format=fuller -- configure.ac
git log --no-ext-diff -S'rust_uses_depends' --format=fuller -- configure.ac

printf '%s\n' '--- Current toolchain selection references ---'
rg -n -C 6 -P '\b(CARGO|RUSTC|CXXBRIDGE)\s*=|depends_prefix|rust_uses_depends|RUSTUP_TOOLCHAIN' \
  configure.ac depends/config.site.in rust depends

Length of output: 5275


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- Cargo version-check introduction ---'
git log --no-ext-diff -S'CARGO_REQUIRED_VERSION' --format='%H%n%s%n%b%n' -- configure.ac || true

printf '%s\n' '--- Introducing diff, if present ---'
cargo_commit=$(git log --no-ext-diff -S'CARGO_REQUIRED_VERSION' --format='%H' -n 1 -- configure.ac || true)
if [ -n "${cargo_commit}" ]; then
  git show --no-ext-diff --format=fuller --find-renames "$cargo_commit" -- configure.ac
fi

printf '%s\n' '--- All Cargo assignments and validation use ---'
rg -n -C 5 -P 'AC_PATH_PROG\(\[CARGO\]|\bCARGO=|CARGO_REQUIRED_VERSION|\$CARGO\s+--version|rust_uses_depends' \
  configure.ac depends/config.site.in rust .cargo 2>/dev/null || true

printf '%s\n' '--- All helper declarations, copy operations, and executions ---'
rg -n -C 4 -P 'fix-elf-interpreter\.sh|foreach patch.*_patches|cp \$\(patch\)' \
  depends || true

printf '%s\n' '--- Script static syntax check ---'
bash -n depends/patches/native_rust/fix-elf-interpreter.sh

Length of output: 11145


@PastaPastaPasta Review complete for 9c94e2c6e63c.

I found no issues in the requested areas.

  • The Cargo check runs only with --enable-rust. It requires Cargo 1.92.0 before build configuration continues. It covers both the system Cargo path and the depends-provided Cargo path.
  • The recipe hash now includes fix-elf-interpreter.sh only for native_rust and native_cxxbridge.
  • The preprocessing rule copies the helper into each package-specific patch directory. Both stage commands execute that local copy.
  • depends/patches/native_rust/fix-elf-interpreter.sh passes bash -n.
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 684495e16d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread contrib/devtools/update-rust-hashes.py Outdated
Comment thread contrib/devtools/update-native-cxxbridge.py Outdated
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

@coderabbitai review

Please review the current head (a0cee6845e2f), focusing on the Rust and cxxbridge updater workflows added in the latest three commits.


🤖 Posted autonomously by Codex on behalf of pasta.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

head_commit="a0cee6845e2f"
base_commit="$(git rev-parse "${head_commit}~3")"

printf '%s\n' '--- Latest three commits ---'
git log --no-ext-diff --format='%H%n%s%n%b' "${base_commit}..${head_commit}"

printf '%s\n' '--- Changed files ---'
git diff --no-ext-diff --name-status "${base_commit}..${head_commit}"

printf '%s\n' '--- Diff for updater workflows and their data sources ---'
git diff --no-ext-diff --find-renames "${base_commit}..${head_commit}" -- \
  contrib/devtools/update-rust-hashes.py \
  contrib/devtools/update-native-cxxbridge.py \
  depends/packages/native_rust.mk \
  depends/packages/rust_stdlib.mk \
  depends/packages/native_cxxbridge.mk \
  depends/packages/rustcxx.mk \
  depends/packages/packages.mk \
  depends/Makefile \
  rust-toolchain.toml \
  Cargo.lock

printf '%s\n' '--- Updater script structure ---'
ast-grep outline contrib/devtools/update-rust-hashes.py --items all
ast-grep outline contrib/devtools/update-native-cxxbridge.py --items all

printf '%s\n' '--- Current recipe declarations and updater references ---'
rg -n -C 4 -P \
  'RUST(_|_STDLIB_|CXXBRIDGE)|native_(rust|cxxbridge)|rustcxx|CROSS_TARGETS|NATIVE_TARGETS|update_(rust|native-cxxbridge)' \
  depends contrib/devtools rust-toolchain.toml Cargo.toml Cargo.lock

printf '%s\n' '--- Python syntax check ---'
python3 -m py_compile \
  contrib/devtools/update-rust-hashes.py \
  contrib/devtools/update-native-cxxbridge.py

Length of output: 27631


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- cxxbridge updater ---'
nl -ba contrib/devtools/update-native-cxxbridge.py | sed -n '1,190p'

printf '%s\n' '--- Rust hash updater ---'
nl -ba contrib/devtools/update-rust-hashes.py | sed -n '1,190p'

printf '%s\n' '--- cxxbridge depends recipe and patch lockfile ---'
nl -ba depends/packages/native_cxxbridge.mk | sed -n '1,120p'
nl -ba depends/patches/native_cxxbridge/Cargo.lock | sed -n '1,220p'

printf '%s\n' '--- workspace manifests and cxx-related lock entries ---'
nl -ba Cargo.toml | sed -n '1,160p'
for path in rust/chirp/Cargo.toml rust/dashrust/Cargo.toml; do
  printf '%s\n' "--- ${path} ---"
  nl -ba "$path" | sed -n '1,140p'
done
rg -n -C 5 -P '^name = "(cxx|cxx-build|cxxbridge-cmd|cxxbridge-flags|cxxbridge-macro)"$|^version = "1\.0\.198"$' \
  Cargo.lock depends/patches/native_cxxbridge/Cargo.lock

printf '%s\n' '--- Cargo lockfile copy and workspace-update history ---'
git log --no-ext-diff --format='%H %s' -S'cargo update' -- contrib/devtools/update-native-cxxbridge.py
git blame -L 112,150 -- contrib/devtools/update-native-cxxbridge.py

printf '%s\n' '--- Depends download stamp patterns ---'
find depends/sources/download-stamps -maxdepth 1 -type f -name '*native_cxxbridge*' -print -exec sh -c 'echo "--- $1"; cat "$1"' _ {} \; 2>/dev/null || true
rg -n -C 3 -P 'stamp_fetched|download-stamps|sha256.*file_name' depends/funcs.mk depends/Makefile

Length of output: 1796


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- cxxbridge updater ---'
cat -n contrib/devtools/update-native-cxxbridge.py

printf '%s\n' '--- Rust hash updater ---'
cat -n contrib/devtools/update-rust-hashes.py

printf '%s\n' '--- cxxbridge depends recipe and patch lockfile ---'
cat -n depends/packages/native_cxxbridge.mk
sed -n '1,220p' depends/patches/native_cxxbridge/Cargo.lock

printf '%s\n' '--- workspace manifests and cxx-related lock entries ---'
cat -n Cargo.toml
for path in rust/chirp/Cargo.toml rust/dashrust/Cargo.toml; do
  printf '%s\n' "--- ${path} ---"
  cat -n "$path"
done
rg -n -C 5 -P '^name = "(cxx|cxx-build|cxxbridge-cmd|cxxbridge-flags|cxxbridge-macro)"$|^version = "1\.0\.198"$' \
  Cargo.lock depends/patches/native_cxxbridge/Cargo.lock

printf '%s\n' '--- Cargo lockfile copy and workspace-update history ---'
git log --no-ext-diff --format='%H %s' -S'cargo update' -- contrib/devtools/update-native-cxxbridge.py
git blame -L 112,150 -- contrib/devtools/update-native-cxxbridge.py

printf '%s\n' '--- Depends download stamp patterns ---'
find depends/sources/download-stamps -maxdepth 1 -type f -name '*native_cxxbridge*' -print -exec sh -c 'echo "--- $1"; cat "$1"' _ {} \; 2>/dev/null || true
rg -n -C 3 -P 'stamp_fetched|download-stamps|sha256.*file_name' depends/funcs.mk depends/Makefile

Length of output: 33777


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Rust recipe declarations ---'
sed -n '1,180p' depends/packages/native_rust.mk
sed -n '1,260p' depends/packages/rust_stdlib.mk

printf '%s\n' '--- Version pins used by each updater ---'
rg -n -C 2 -P \
  '^\$\(package\)_version:=|^channel = "|^RUSTC_REQUIRED_VERSION="|^CXXBRIDGE_REQUIRED_VERSION="' \
  depends/packages/native_rust.mk \
  depends/packages/rust_stdlib.mk \
  depends/packages/native_cxxbridge.mk \
  rust-toolchain.toml \
  configure.ac

printf '%s\n' '--- Independent target and declaration consistency check ---'
python3 - <<'PY'
import re
from pathlib import Path

rust_updater = Path("contrib/devtools/update-rust-hashes.py").read_text()
native_recipe = Path("depends/packages/native_rust.mk").read_text()
stdlib_recipe = Path("depends/packages/rust_stdlib.mk").read_text()

cross_block = re.search(r"CROSS_TARGETS = \[(.*?)\n\]", rust_updater, re.S).group(1)
cross_targets = re.findall(r'"([^"]+)"', cross_block)
native_block = re.search(r"NATIVE_TARGETS = \[(.*?)\n\]", rust_updater, re.S).group(1)
native_ids = dict(re.findall(r'\("([^"]+)", "([^"]+)"\)', native_block))

declared_native = set(re.findall(r'^\$\(package\)_sha256_hash_([a-z0-9_]+):=', native_recipe, re.M))
declared_stdlib = set(re.findall(r'^\$\(package\)_sha256_hash_([a-z0-9_-]+):=', stdlib_recipe, re.M))

print("native updater IDs:", sorted(native_ids.values()))
print("native recipe IDs:", sorted(declared_native))
print("native missing from updater:", sorted(declared_native - set(native_ids.values())))
print("native extra in updater:", sorted(set(native_ids.values()) - declared_native))
print("stdlib updater targets:", sorted(cross_targets))
print("stdlib recipe targets:", sorted(declared_stdlib))
print("stdlib missing from updater:", sorted(declared_stdlib - set(cross_targets)))
print("stdlib extra in updater:", sorted(set(cross_targets) - declared_stdlib))
PY

printf '%s\n' '--- Updater documentation, test, and CI references ---'
rg -n -C 3 -P \
  'update-rust-hashes\.py|update-native-cxxbridge\.py|native_cxxbridge.*Cargo\.lock|rust-toolchain\.toml' \
  .github ci test contrib depends \
  -g '!depends/sources/**' 2>/dev/null || true

printf '%s\n' '--- Changed commit patch checks ---'
git show --no-ext-diff --check a0cee6845e2f
git diff --no-ext-diff --check a0cee6845e2f~3..a0cee6845e2f

Length of output: 23489


@PastaPastaPasta Review complete for a0cee6845e2f.

I found no issues in the Rust and cxxbridge updater workflows.

  • update-rust-hashes.py covers every declared native compiler and Rust standard-library target exactly once.
  • It synchronizes rust_stdlib.mk, rust-toolchain.toml, and configure.ac from native_rust.mk after all hash downloads complete.
  • update-native-cxxbridge.py validates the downloaded cxx source before it updates repository files.
  • It updates the workspace cxx packages before it copies the generated cxx lockfile for the depends build.
  • The generated fetched-stamp format matches the depends fetch rule.
  • The current workspace and depends lockfiles both resolve cxx packages at 1.0.198.
  • Python syntax checks and whitespace checks passed.
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Codex/Sol only (Phase 2 disabled)

The current head fixes all five previously reported Rust/CXX build-path defects, and the bridge behavior test requested by CodeRabbit is present and wired into the Rust-enabled unit-test target. One non-blocking history-quality finding remains: the 55-commit series retains abandoned implementation paths and numerous corrective commits that should be consolidated before the history becomes permanent.
Source: Codex general reviewer backend gpt-5.6-sol; Codex dash-core-commit-history reviewer backend gpt-5.6-sol; final verifier backend gpt-5.6-sol. Orchestration-only: openclaw-agent/cliproxy/gpt-5.6-sol (not reviewer evidence).

Validated zero-blocker Codex/Sol precheck evidence was promoted to final because Phase 2 (Sonnet/Opus) is temporarily disabled. This is Codex/Sol-only final validation, not Codex + Sonnet/Opus coverage.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (completed), gpt-5.6-sol — dash-core-commit-history (completed)
  • Verifier: gpt-5.6-sol — verifier
  • Sonnet/Opus: not run (Phase 2 disabled — temporary Codex/Sol-only final)
  • Secondary pass: disabled (temporary_phase2_sonnet_disable)

🟡 1 suggestion(s)

1 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `<commit:6e28684>`:
- [SUGGESTION] <commit:6e28684>:1: Rewrite temporary detours and fixups into durable commits
  The 55-commit series still records temporary paths that have no effect in the final tree. For example, `e189a09` adds CI-container Rust support that `8e74d07` removes, `fc23f36` adds broad Rust lint exclusions that `6e28684` reverses, and the Guix integration from `9c88a95` and `a1a681b` is later removed because Guix support is outside this PR. The series also contains roughly thirty follow-up corrections after `6e28684`, including several narrowly scoped repairs to build logic introduced earlier in the same unmerged stack. This makes future bisection traverse known-incomplete states and preserves review-process detours as project history. Drop the abandoned paths and fold corrective commits into the commits that introduced the affected logic, while retaining independently meaningful feature, hardening, test, and generated-update steps.

@PastaPastaPasta

Copy link
Copy Markdown
Member Author

CI status on current head a0cee684:

  • 38 exact-head jobs passed, including the dedicated linux64_rust source build, linters, unit tests, all depends builds, macOS, Windows, and the remaining source/test matrix.
  • linux64_asan-build failed twice solely in qt/test/test_dash-qt with the same LeakSanitizer signature: 86 bytes in four allocations rooted at QDBusConnectionManager::executeConnectionRequest. Retry log
  • This is a pre-existing baseline failure: an upstream develop push produced the identical 86-byte/four-allocation Qt/DBus leak. Upstream baseline log

This PR does not alter Qt/DBus code, so no unrelated suppression is being added here. The independent final review also reports no blockers for a0cee684.


🤖 Posted autonomously by Codex on behalf of pasta.

PastaPastaPasta and others added 3 commits August 12, 2026 18:38
The Rust stdlib/target provisioning covered Android, FreeBSD, ARMv7, i686, PowerPC and more, inherited from the Zcash-derived tooling and later ABI-correctness fixes, even though only x86-64 Linux is CI-covered and Guix Rust builds are disabled. Presence in the build system implies a support commitment we cannot honor, and untested mappings can bitrot or emit broken binaries.

Trim CROSS_TARGETS, rust_stdlib.mk, native_rust.mk and RS_SET_TRIPLE to the hosts we actually validate: the narrowed Guix release set (x86_64/aarch64/riscv64 Linux, x86_64 Windows, both macOS) plus native development hosts. Any other host now fails --enable-rust explicitly instead of fetching a standard library we never test. Android triples are rejected explicitly since they would otherwise match the generic Linux arms.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
RUST_MACOS_DEPLOYMENT_TARGET fell back to the host OS version (sw_vers) whenever OSX_MIN_VERSION was not set as a shell variable. The depends config.site passes the deployment target to C/C++ inside CXXFLAGS (-mmacos-version-min=14.0) without exporting OSX_MIN_VERSION, so C++ objects were built for macOS 14.0 while libdashrust.a claimed the host version (e.g. minos 26.5), producing binaries whose Rust code assumes a newer macOS than the binary advertises.

Derive the Rust deployment target from the C++ compiler's effective target instead: honor OSX_MIN_VERSION and MACOSX_DEPLOYMENT_TARGET when set, otherwise probe __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ through $CXX $CXXFLAGS so version-min flags embedded in CXXFLAGS are respected. Verified: configure now reports 14.0 under the depends config.site and the built archive carries minos 14.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dist-chirp copied the generated bridge sources before the version stamp, so in the extracted tarball the stamp was newer than the sources and the strictly-newer staleness check always failed, forcing cxxbridge regeneration and defeating the pre-generated dist sources. Copy the stamp first so the shipped sources compare newer than it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

Pushed three commits addressing review feedback on target scope and a macOS correctness issue:

4b2ec385b925 — build: confine Rust support to validated hosts. CROSS_TARGETS/rust_stdlib.mk/RS_SET_TRIPLE had accumulated mappings for Android, FreeBSD, ARMv7, i686, and PowerPC — inherited from the Zcash-derived tooling (Android arrived alongside the optional-Rust rework, and the 32-bit/big-endian entries were ABI-correctness fixes layered on top). None of these are built or tested anywhere; their presence implied a support commitment we cannot honor. The provisioned set is now confined to the narrowed Guix release set plus native development hosts: x86_64/aarch64/riscv64 Linux, x86_64 Windows, and both macOS architectures. Every other host fails --enable-rust explicitly (Android is rejected by an explicit case arm, since its triples would otherwise match the generic Linux patterns). Additional targets should return only together with CI lanes that actually exercise them.

594f394e70f1 — fix: match Rust macOS deployment target to the C++ toolchain. RUST_MACOS_DEPLOYMENT_TARGET fell back to the host OS version whenever OSX_MIN_VERSION wasn't set as a shell variable — but the depends config.site passes the deployment target to C/C++ inside CXXFLAGS (-mmacos-version-min=14.0) without exporting that variable, so C++ objects targeted macOS 14.0 while libdashrust.a was stamped with the host version (e.g. minos 26.5). The Rust target is now derived from the C++ compiler's effective deployment target (probing __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ through $CXX $CXXFLAGS), with OSX_MIN_VERSION/MACOSX_DEPLOYMENT_TARGET still taking precedence when set. Verified locally: configure reports 14.0 under the depends config.site and the built archive now carries minos 14.0.

eeb3b9157519 — build: dist the cxxbridge stamp before generated sources. dist-chirp copied the generated bridge sources before the version stamp, so in extracted tarballs the stamp was newer and the strictly-newer staleness check always forced regeneration, defeating the pre-generated dist sources. The stamp is copied first now.

The PR description's target-support wording has been updated to match. Re Guix: it has not been exercised for the Rust lane on this branch — Guix/release Rust remains intentionally disabled in this foundation PR, and a flag-on Guix determinism run is tracked as a release gate in #7512.


🤖 Posted autonomously by Claude on behalf of pasta.

@DashCoreAutoGuix

Copy link
Copy Markdown

Guix Automation has failed due to the HEAD commit not being signed by an authorized core-team member. Please rebase and sign or push a new empty signed commit to allow Guix build to happen.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminary review — Codex only

The optional Rust/CXX integration has one blocking source-distribution defect: ustar timestamp precision defeats the strict freshness checks, so extracted tarballs regenerate the bridge instead of using the distributed artifacts. The bridge behavior test is present and correctly wired, while durable documentation for the new opt-in workflow is still needed.
Source: Codex general reviewer backend gpt-5.6-sol; final verifier backend gpt-5.6-sol. Orchestration-only: openclaw-agent/cliproxy/gpt-5.6-sol (not reviewer evidence).

Validated blockers were found in the Codex precheck. Opus is deferred until a fresh Codex revalidation clears the blocker gate.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (completed)
  • Verifier: gpt-5.6-sol — verifier
  • Sonnet: not run (deferred by blocker gate)

🔴 1 blocking | 🟡 1 suggestion(s)

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `rust/Makefile.chirp.include`:
- [BLOCKING] rust/Makefile.chirp.include:52-64: Allow equal timestamps for distributed bridge artifacts
  Copying the stamp before the generated files does not preserve their ordering in the source archive. Automake emits a ustar archive, whose mtimes have one-second precision; these three copies normally occur in the same second and therefore have identical timestamps after extraction. In an out-of-tree build, both strict `artifact -nt $(LIBRUST_CHIRP_GEN_SRCSTAMP)` checks fail and invoke `cxxbridge`, so the shipped bridge files are never accepted even though they have the matching version stamp. Accept an artifact when it is not older than the versioned stamp, while retaining the strict comparison against `lib.rs`.

In `configure.ac`:
- [SUGGESTION] configure.ac:153-163: Document the optional Rust build workflow
  The repository has no durable documentation explaining how to use the new build path. Users currently must infer `RUST=1` for depends, the Rust/Cargo/cxxbridge version requirements, supported hosts, the default offline `RUST_VENDORED_SOURCES` requirement, and the purpose of `--enable-online-rust` from build scripts and configure diagnostics. Add a short build document covering both depends-backed and system-toolchain workflows and link it from the relevant build documentation.

Comment on lines +52 to +64
test $(LIBRUST_CHIRP_GEN_SRCDIR)/src/lib.cpp -nt $(LIBRUST_CHIRP_GEN_SRCSTAMP) && \
test "$(LIBRUST_CHIRP_GEN_SRCDIR)" != "$(LIBRUST_CHIRP_GEN_DIR)"; then \
cp $(LIBRUST_CHIRP_GEN_SRCDIR)/src/lib.cpp $@; \
else \
$(CXXBRIDGE) $< -o $@; \
fi

$(LIBRUST_CHIRP_H): $(LIBRUST_CHIRP_SRCS) $(LIBRUST_CHIRP_GEN_STAMP)
$(AM_V_at)$(MKDIR_P) $(@D)
$(AM_V_GEN)if test -f $(LIBRUST_CHIRP_GEN_SRCDIR)/include/rust/chirp/lib.h && \
test -f $(LIBRUST_CHIRP_GEN_SRCSTAMP) && \
test $(LIBRUST_CHIRP_GEN_SRCDIR)/include/rust/chirp/lib.h -nt $< && \
test $(LIBRUST_CHIRP_GEN_SRCDIR)/include/rust/chirp/lib.h -nt $(LIBRUST_CHIRP_GEN_SRCSTAMP) && \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: Allow equal timestamps for distributed bridge artifacts

Copying the stamp before the generated files does not preserve their ordering in the source archive. Automake emits a ustar archive, whose mtimes have one-second precision; these three copies normally occur in the same second and therefore have identical timestamps after extraction. In an out-of-tree build, both strict artifact -nt $(LIBRUST_CHIRP_GEN_SRCSTAMP) checks fail and invoke cxxbridge, so the shipped bridge files are never accepted even though they have the matching version stamp. Accept an artifact when it is not older than the versioned stamp, while retaining the strict comparison against lib.rs.

source: ['codex']

Comment thread configure.ac
Comment on lines +153 to +163
AC_ARG_ENABLE([rust],
[AS_HELP_STRING([--enable-rust],
[build the Rust/C++ bridge smoke component (default is no)])],
[enable_rust=$enableval],
[enable_rust=no])

AC_ARG_ENABLE([online-rust],
[AS_HELP_STRING([--enable-online-rust],
[allow Cargo to fetch Rust dependencies from the internet (default is no, using vendored dependencies offline)])],
[enable_online_rust=$enableval],
[enable_online_rust=no])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: Document the optional Rust build workflow

The repository has no durable documentation explaining how to use the new build path. Users currently must infer RUST=1 for depends, the Rust/Cargo/cxxbridge version requirements, supported hosts, the default offline RUST_VENDORED_SOURCES requirement, and the purpose of --enable-online-rust from build scripts and configure diagnostics. Add a short build document covering both depends-backed and system-toolchain workflows and link it from the relevant build documentation.

source: ['codex']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants