Skip to content

feat: platform-aware binary resolution and fallback build across fleet (EMO-404) - #54

Open
emo-eth wants to merge 10 commits into
plannotator:mainfrom
emo-eth:annotate-clipboard
Open

emo-eth wants to merge 10 commits into
plannotator:mainfrom
emo-eth:annotate-clipboard

Conversation

@emo-eth

@emo-eth emo-eth commented Sep 20, 2026

Copy link
Copy Markdown

Overview

Resolves EMO-404: Fix multi-machine herdr-annotate platform binary distribution across fleet.

Root Cause

Previously, when the repository or plugin directory was synced across development machines (or local staging was run on a macOS host), fetch-herdr-annotate.sh and fetch-herdr-annotate.ps1 checked only whether bin/herdr-annotate.exe was executable and its version matched herdr-annotate.version. Because version stamps and file permissions were preserved during file syncs, the fetcher short-circuited with "already installed", leaving incompatible Mach-O arm64 binaries on Linux aarch64 (sparks) and x86_64 / Windows (emo-win).

Changes

  1. Platform-Aware Binary Resolution:
    • Detect host OS and architecture via uname -s/uname -m (Darwin arm64/x86_64, Linux aarch64/x86_64, Windows Git Bash / MSYS / CYGWIN, PowerShell $architecture).
    • Fallback detection via Node/Bun process.platform and process.arch if uname or PowerShell reports an unrecognized value.
  2. Runnable Verification & Target Stamping:
    • Stamp bin/herdr-annotate.target and bin/plannotator-tui.target upon installation or local staging.
    • Verify that any existing binary actually executes on the host OS (--version) and matches the host target stamp before allowing an idempotent skip. Unrunnable or cross-architecture binaries are automatically detected and replaced with the matching native asset.
  3. Native Fallback Build:
    • If prebuilt assets are unavailable or downloading fails (e.g. offline/isolated fleet nodes), automatically invoke cargo build --manifest-path rust/Cargo.toml --release to compile and stage the native binary.
  4. Integration & Regression Tests:
    • Added test cases in test-fetch-herdr-annotate.sh, test-fetch-plannotator-tui.sh, test-fetch-herdr-annotate.ps1, and test-fetch-plannotator-tui.ps1 verifying target stamp generation, mismatched-target recovery, and unrunnable-binary replacement.
    • Fixed clippy warnings (collapsible_if and indexing_slicing).

Verification

  • cargo test --manifest-path rust/Cargo.toml: 87 tests passed (4 suites).
  • cargo clippy --all-targets -- -D warnings: 0 warnings/errors.
  • cargo fmt --check: passed.
  • test-fetch-herdr-annotate.sh, test-fetch-plannotator-tui.sh, and test-windows-full-manifest.py: all passed.
  • Cross-platform live reproduction and verification:
    • spark0 (Linux aarch64): Mach-O arm64 binary placed in bin/ with matching version stamp -> fetch-herdr-annotate.sh detected mismatch -> successfully downloaded and verified herdr-annotate-aarch64-unknown-linux-gnu ELF binary (--version exit 0).
    • emo-win (Linux x86_64): Mach-O arm64 binary placed in bin/ -> fetch-herdr-annotate.sh detected mismatch -> successfully downloaded and verified herdr-annotate-x86_64-unknown-linux-gnu ELF binary (--version exit 0).
    • Fallback build test: simulated failed asset download -> compiled and staged native release binary via cargo build --release.

Prove copy-context and copy-archive pipe Markdown through
`herdr clipboard set --stdin`, and record the fleet blocker that live
Herdr binaries still lack that command.
Plugin global copy is herdr clipboard set --stdin only. Live round-trip
is blocked on fleet Herdr lacking that command, not plugin code. Min
gate is 0.9.0 with clipboard set (unreleased after tagged 0.9.0).
Plugin global copy stays on `herdr clipboard set --stdin`. Tagged 0.9.0
does not ship it; live round-trip is blocked on fleet Herdr version, not
plugin code. No second transport.
Standing contract: no merge and this worktree is not finished until
operator-approved Done / Acceptance / Validation lists exist and are
met. These three lists are a proposal. Wait.
Consolidate annotate chairs: remaining-work list lives here.
herdr-annotate-broken is sitting, not removed.
Treat Done/Acceptance/Validation as the working contract (not merge).
Fleet Herdr now has clipboard set. Local copy-context landed on the
viewing Mac clipboard. Remote spark0 invoke still needs a TUI viewer
(no_foreground_client). No second transport.
Local plugin action invoke works; saved-machine targeting from this
Mac CLI does not. Remote copy-context still needs a TUI viewer on
the plugin host (no_foreground_client). No merge.
@backnotprop

Copy link
Copy Markdown
Contributor

Thanks for this. We can't find herdr clipboard set in Herdr 0.9.1 or on Herdr's master. Which Herdr build provides it, and how does it reach the viewing client? Until it exists upstream, core can't route copies through it. The fetch-script hardening is worth taking on its own: send that alone, without GOAL.md, DECISIONS.md, or the README removals, and I'll review it quickly.

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.

2 participants