Skip to content

0.7.1: the cargo knapsack in Rust (optional binding, CI); no number moves - #14

Merged
loggger101 merged 3 commits into
mainfrom
rust-cargo-prototype
Nov 18, 2026
Merged

loggger101 merged 3 commits into
mainfrom
rust-cargo-prototype

Conversation

@loggger101

Copy link
Copy Markdown
Owner

Release 0.7.1. Data contract 1.21.0 unchanged and no number moves: nothing under spacevalue/ changed except __version__.

What it adds

  • rust/cargo_core: a plain-Rust port of cargo.py's optimal_payload_mix, _hold_refining and _capped_sale_value, operation for operation. economicspace's es_core links it.
  • rust/cargo_py: an optional PyO3 binding, spacevalue_cargo_rs. spacevalue never imports it. It installs from the tag:
    pip install "spacevalue_cargo_rs @ git+https://github.com/loggger101/spacevalue@v0.7.1#subdirectory=rust/cargo_py" (needs a Rust toolchain). It is not an extra, because then every install of spacevalue would need a Rust toolchain.
  • tests/test_cargo_rust.py holds the binding to the Python bit for bit: the golden replay, plus fuzzed calls with exceptions compared. It skips when the binding is missing, unless SPACEVALUE_REQUIRE_RUST=1.
  • A new rust job in CI (three hosts, Python 3.13 and 3.14):
    1. The planted build (planted_knapsack_defect, one ulp in every take) must fail all six Rust tests.
    2. The good binding is installed the way a consumer installs it.
    3. test_cargo_rust.py runs with SPACEVALUE_REQUIRE_RUST=1, then the whole suite.
  • cargo_core has no Rust tests (it is tested only against cargo.py, through the binding), so the job has no cargo test step. That step would pass on zero tests.

Evidence

  • Locally (Windows, Python 3.13, fresh venv), the job's steps: planted build 6 failed; good build 6 passed; whole suite 189 passed.
  • economicspace's Rust gate (branch rust-solver-prototype), which builds es_core against this crate: 32/32 at cislunar, 29/29 at geo and mars_surface. Its e2e catalogs are byte-identical between Python and Rust.

After merge: tag v0.7.1 from main; economicspace then repins to it.

loggger101 and others added 3 commits November 15, 2026 18:51
rust/cargo_core ports optimal_payload_mix, _hold_refining and
_capped_sale_value operation for operation; plain Rust, so economicspace's
es_core can link it with no Python boundary. rust/cargo_py is an optional
PyO3 module (spacevalue_cargo_rs) with the same signatures; nothing in
spacevalue imports it.

tests/test_cargo_rust.py replays every golden call through it (0 differ)
and fuzzes 120,000 hostile calls against the Python, exceptions included
(0 differ). The planted_knapsack_defect build fails all six tests. Skips
without the module unless SPACEVALUE_REQUIRE_RUST=1. Full suite: 189 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hold and capped-sale fuzzes had no share check, and the mix fuzz read
process-wide counters, so a build answering everything through the
Python fallback compared the Python with itself and passed. Each now
requires Rust to have answered more calls than it handed back, counted
since the test began (planted all-fallback: 3 of 3 caught).
SPACEVALUE_REQUIRE_RUST accepts any value but unset or 0.
Ignore cargo_core's Cargo.lock, which cargo test regenerates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@loggger101
loggger101 merged commit 80ec754 into main Nov 18, 2026
17 checks passed
loggger101 added a commit to loggger101/economicspace that referenced this pull request Nov 18, 2026
… that tag

spacevalue 0.7.1 (loggger101/spacevalue#14) moves no number: nothing under
spacevalue/ changed but __version__.  It ships the Rust knapsack copy and
its optional binding from the tag, with CI building and testing both.

- The spacevalue pin, in its five places, is now v0.7.1.
- rust/es_core/Cargo.toml links spacevalue_cargo_core by git at tag v0.7.1
  (Cargo.lock: 80ec754), no longer a path into the sibling checkout.
- requirements-rust.txt: the opt-in Rust install (the binding from the tag
  and es_core from this checkout); never auto-installed, it needs Rust.
  calc's import guard names it.
- verify_docs.py check 7: rust_pin_findings holds Cargo.toml's tag and
  requirements-rust.txt's ref to requirements.txt's spacevalue pin, and
  refuses a path or extra key; six planted mismatches each caught.
- Gate step sv_checkout_at_pin: the spacevalue checkout the gate builds the
  binding from must be the locked commit (an older checkout is refused).
@loggger101
loggger101 deleted the rust-cargo-prototype branch November 18, 2026 22:33
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