Skip to content

Implement perry/container and perry/workloads orchestration stack#65

Open
yumin-chen wants to merge 1 commit into
mainfrom
feature/container-orchestration-v1-9509739616403750352
Open

Implement perry/container and perry/workloads orchestration stack#65
yumin-chen wants to merge 1 commit into
mainfrom
feature/container-orchestration-v1-9509739616403750352

Conversation

@yumin-chen

Copy link
Copy Markdown

I have implemented the complete perry/container and perry/workloads orchestration stack.

Key components:

  1. perry-container-compose: A new crate that handles OCI backend detection, Compose specification parsing (YAML/JSON), and service orchestration. It uses Kahn's algorithm for deterministic startup order and handles cleanup/rollback on failures.
  2. perry-stdlib: Added a comprehensive FFI layer in src/container/. It utilizes a deferred promise spawning pattern to ensure that complex JSON results are correctly marshaled back to the Perry runtime's arena-allocated memory without corruption.
  3. Compiler Integration:
    • HIR: Registered perry/container, perry/compose, and perry/workloads as native modules, exempting them from standard dependency checks.
    • Codegen: Updated lower_call.rs with a new NA_JSON argument kind that automatically stringifies JS objects before passing them to the Rust FFI, and added the full container/workload dispatch tables.
  4. WIT Interface: Defined the formal WebAssembly Interface Type contract in src/core/wit/perry-container.wit.
  5. Testing: Implemented a functional test harness with a MockBackend to verify orchestration behavior (topological sorting, run commands, etc.) without requiring a live OCI runtime.

All core logic is verified through unit and property tests. The crates compile successfully with the new container feature flag enabled.


PR created automatically by Jules for task 9509739616403750352 started by @yumin-chen

…ration

This commit implements the full container orchestration stack for Perry,
including:
- The `perry-container-compose` crate: a native Rust reimplementation
  of container-compose functionality with platform-adaptive backend detection
  (prioritizing apple/container on macOS and podman elsewhere).
- Topological sort (Kahn's algorithm) for service startup order and
  automatic rollback on failure.
- `perry-stdlib` integration: a complete FFI bridge in
  `crates/perry-stdlib/src/container/` using the
  `spawn_for_promise_deferred` pattern for runtime safety.
- Compiler integration: Added `perry/container`, `perry/compose`, and
  `perry/workloads` as built-in modules in `perry-hir`.
- Codegen: Implemented a unified dispatch table in `perry-codegen`
  supporting direct FFI calls and automatic JSON serialization via `NA_JSON`.
- WIT definition: Formally specified the container interface in
  `src/core/wit/perry-container.wit`.
- Functional testing: Added a `MockBackend` and functional test suite for
  orchestration logic.

Verified with property-based tests for topological sorting and workspace
compilation checks.

Co-authored-by: yumin-chen <10954839+yumin-chen@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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