Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ jobs:
- name: Build and test greenfloor-engine
if: matrix.run_rust_tests
run: |
cargo build --manifest-path greenfloor-engine/Cargo.toml
cargo build --manifest-path greenfloor-engine/Cargo.toml --bin greenfloor-engine
cargo test --manifest-path greenfloor-engine/Cargo.toml

- name: Install greenfloor-engine CLI on PATH
if: matrix.run_rust_tests
run: |
install -m 755 \
target/debug/greenfloor-engine \
"$GITHUB_WORKSPACE/.venv/bin/greenfloor-engine"

- uses: ./.github/actions/greenfloor-maturin-wheels
with:
operation: ensure-and-install
Expand All @@ -96,7 +103,7 @@ jobs:
run: pre-commit run --all-files

- name: "Test suite (pytest)"
run: pytest -v --tb=short
run: pytest -v --tb=short -m "not engine"

- name: Pytest (engine marker)
if: matrix.run_rust_tests
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/live-testnet-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ jobs:
operation: ensure-and-install
rust-already-configured: true

- name: Build greenfloor-engine CLI binary
run: |
cargo build --release --manifest-path greenfloor-engine/Cargo.toml --bin greenfloor-engine
echo "$GITHUB_WORKSPACE/target/release" >> "$GITHUB_PATH"
greenfloor-engine --help >/dev/null

- uses: ./.github/actions/wheel-cache
with:
operation: ensure-and-install
Expand Down Expand Up @@ -95,6 +101,7 @@ jobs:
--size-base-units "${{ inputs.size_base_units }}" \
--network "${{ inputs.network_profile }}" \
--dry-run | tee ./artifacts/build-and-post-offer.dry-run.log
# build-and-post-offer delegates to the native greenfloor-engine binary.
if [ "${{ inputs.dry_run }}" = "false" ]; then
greenfloor-manager \
--program-config config/program.yaml \
Expand Down
55 changes: 55 additions & 0 deletions docs/decisions/0012-manager-cli-rust-orchestration-cutover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ADR 0012: Manager CLI Rust orchestration cutover

## Status

Accepted (2026-05-29)

## Context

GreenFloor historically implemented manager `build-and-post-offer` in Python
(`greenfloor/runtime/offer_orchestration.py`) with Dexie/Splash adapters, SQLite
persistence, and bootstrap/create/publish orchestration.

The Rust engine now owns the same vertical slice for the **manager CLI path**:

- `greenfloor-engine build-and-post-offer`
- Python `greenfloor-manager build-and-post-offer` delegates via subprocess only

The **daemon** (`greenfloord`) still uses the Python orchestration stack until
the daemon runtime migrates to Rust.

## Decision

1. **Manager CLI = Rust only.** Python must not parse program/markets YAML or
resolve venue URLs for `build-and-post-offer`. Optional CLI overrides are
passed through to Rust; Rust resolves canonical settings.

2. **Rust owns manager config schema** for this path (`config/program.rs`,
`config/markets.rs`) and SQLite persistence schema (`storage/sqlite.rs`).

3. **Rust owns manager file logging** for this path (`manager/logging.rs`), writing
to `{home_dir}/logs/debug.log` with `app.log_level` from program config.

4. **Python orchestration is legacy for daemon only.** Do not extend
`offer_orchestration.py` for new manager CLI behavior. Bug fixes that affect
both paths should land in Rust first, then daemon cutover.

## Cutover milestones

| Milestone | Owner | Delete when done |
| --------------------------------- | ------------------- | --------------------------------------- |
| Manager CLI subprocess delegation | Python CLI | N/A (keep thin wrapper) |
| Rust build/post + sqlite persist | `greenfloor-engine` | — |
| Daemon cycle offer post | Python today | `offer_orchestration.py` manager path |
| Daemon sqlite / config | Python today | duplicate schema in `storage/sqlite.py` |

**Target:** When `greenfloord` runs offer build/post through `greenfloor-engine`
in-process or subprocess, delete Python `execute_build_and_post_offer` and shrink
`offer_orchestration.py` to tests-only fixtures or remove entirely.

## Consequences

- Manager operators get Rust logging/persistence parity without Python preflight.
- Two orchestration implementations remain until daemon migration; new features
for manager CLI land in Rust only.
- CI must build/install `greenfloor-engine` for manager CLI tests and e2e.
31 changes: 31 additions & 0 deletions docs/progress.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Progress Log

## 2026-05-29 (Manager CLI Rust cutover — logging, typed post results, ADR 0012)

- **Logging:** `manager/logging.rs` restores `{home_dir}/logs/debug.log` for Rust manager path; `app.log_level` parsed in `config/program.rs`.
- **Bootstrap:** `signer_bootstrap_phase` takes `&SignerConfig` from resolved context (no second YAML read).
- **Orchestration:** `PostAttemptSuccess` tracks publish outcome without re-parsing JSON for failure counts.
- **Tests:** build/post fixtures extracted to `manager/fixtures/build_and_post.rs`.
- **Decision:** ADR 0012 documents manager CLI = Rust, daemon orchestration = temporary Python until `greenfloord` migrates.

## 2026-05-29 (Refactor — thin Python CLI, typed Rust orchestrator)

- **Python:** `build-and-post-offer` is subprocess delegation only; no YAML preflight or venue resolution in Python.
- **Rust:** `ResolvedBuildAndPostContext`, typed publish/persist helpers, shared coin-op spendability + retry polling.
- **SQLite:** Rust schema is canonical for manager persistence (`storage/mod.rs`).

## 2026-05-29 (Rust manager CLI — build-and-post-offer vertical slice)

- **`greenfloor-engine build-and-post-offer`:** native manager path for bootstrap → sign → verify → Dexie/Splash publish without PyO3.
- **Config:** `config/program.rs` + `config/markets.rs` load manager program + markets YAML (market id/pair resolution, venue URLs).
- **Adapters:** `adapters/dexie.rs` + `adapters/splash.rs` (post, invalid-offer retry, visibility polling).
- **Orchestration:** `manager/build_and_post.rs` + `manager/bootstrap.rs` call in-process engine (`build_signer_offer_for_action`, bootstrap mixed-split).
- **Persistence:** sqlite audit records on successful post (`storage/sqlite.rs`).
- **Tests:** Rust unit tests for config/market resolution and mockito Dexie publish phase; 210+ engine tests.
- **Next:** port `greenfloord` daemon offer post to Rust; delete Python `offer_orchestration.py` manager path (see ADR 0012).

## 2026-05-29 (Python manager delegates build-and-post-offer to Rust binary)

- **`greenfloor/cli/engine_binary.py`:** resolves `greenfloor-engine` (`GREENFLOOR_ENGINE_BIN`, PATH, or `target/{debug,release}/`) and runs `build-and-post-offer` subprocess with manager flag mapping.
- **`greenfloor/cli/offer_build_post.py`:** thin subprocess wrapper only (no YAML preflight).
- **CI:** Ubuntu CI installs debug `greenfloor-engine` into `.venv/bin`; live-testnet-e2e builds release binary and adds it to `PATH`.
- **Tests:** manager build/post tests mock engine delegation; 544 pytest tests pass.

## 2026-05-29 (Review follow-ups — routing collapse + bridge merge)

- **Routing:** removed `offer_execution_backend()` / `managed_offer_execution_backend()` / `coin_ops_execution_backend()` and Rust `sequential_action_route`; daemon sequential dispatch uses explicit dry-run / program / signer checks.
Expand Down
Loading
Loading