Skip to content

Complete perry-container integration and stdlib FFI bridge#7

Draft
yumin-chen wants to merge 8 commits intofeat/container-composefrom
feature/perry-container-integration-5586192504330246595
Draft

Complete perry-container integration and stdlib FFI bridge#7
yumin-chen wants to merge 8 commits intofeat/container-composefrom
feature/perry-container-integration-5586192504330246595

Conversation

@yumin-chen
Copy link
Copy Markdown

This PR completes the integration of the perry-container feature across the compiler and standard library.

Key changes:

  1. Compiler Integration:

    • Updated perry-hir to recognize perry/container and perry/container-compose as native modules that require perry-stdlib.
    • Implemented HIR lowering in lower.rs to map TypeScript imports to FFI calls, including special synchronous handling for getBackend().
    • Added exhaustive FFI dispatch entries in perry-codegen's NATIVE_MODULE_TABLE, covering the full API surface with correct type coercions.
    • Enabled automatic Cargo feature detection for the container feature in perry-stdlib.
  2. Standard Library (FFI Bridge):

    • Implemented missing compose-related FFI functions (js_compose_config, js_compose_start, etc.).
    • Unified FFI naming to js_compose_* for orchestration operations.
    • Expanded ComposeWrapper to support the full orchestration lifecycle.
    • Refined the internal orchestration logic in perry-container-compose to correctly map high-level specs to backend-agnostic configurations.
  3. Stability and Testing:

    • Verified the implementation with property-based tests for serialization, topological sort, and error propagation.
    • Ensured full workspace compilation with the container feature enabled.
    • Improved backend detection robustness and error reporting in the FFI boundary.

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

yumin-chen and others added 3 commits April 15, 2026 18:23
- Implemented missing `js_compose_*` FFI functions in `perry-stdlib`.
- Added `ComposeWrapper` methods for config, start, stop, and restart.
- Updated `perry-hir` to correctly trigger stdlib linking for container modules.
- Implemented HIR lowering for `perry/container` and `perry/container-compose`.
- Added 23 entries to `NATIVE_MODULE_TABLE` in `perry-codegen` for FFI dispatch.
- Updated compiler feature detection to enable the `container` Cargo feature.
- Refined orchestration-to-backend interface to use lean config types.
- Fixed backend detection and error propagation logic in FFI layer.
@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.

@yumin-chen yumin-chen force-pushed the feat/container-compose branch from bfededb to c45fc76 Compare April 16, 2026 00:07
- Replaced stubs in `ContainerBackend` with actual shell-out logic for build, inspect, and security.
- Enhanced `verification.rs` to be backend-aware and strictly enforce image verification.
- Updated `alloy_container_run_capability` to use secure container constraints.
- Resolved linker errors by gating duplicate FFI symbols in `perry-runtime`.
- Improved orchestration robustness with better type mapping.
@yumin-chen yumin-chen force-pushed the feat/container-compose branch from c45fc76 to 4b72520 Compare April 16, 2026 00:41
- Implemented actual label parsing in `ContainerBackend` list and inspect.
- Added `labels` field to `ContainerSpec` and `ContainerInfo`.
- Implemented production-ready `remove_orphans` logic in `ComposeEngine`.
- Ensured all containers are created with project and service labels.
- Removed all heuristics and development stubs.
- Finalized production-ready image verification and security constraints.
…pport and idempotent orchestration

- Implemented actual label parsing in OCI backend for `ps` and `inspect`.
- Added `labels` to `ContainerSpec` and `ContainerInfo`.
- Implemented robust `remove_orphans` logic using project and service labels.
- Enhanced `ComposeEngine::up` to track only session-created resources and perform full rollback on failure.
- Added `inspect_network` and `inspect_volume` to `ContainerBackend` for idempotent resource management.
- Made `verification.rs` backend-aware and removed all development fallbacks.
- Updated `alloy_container_run_capability` with strict security constraints and output capturing.
- Cleaned up all legacy shims and stubs from `backend.rs`.
- Correctly gated overlapping FFI symbols in `perry-runtime` to fix linker errors.
@yumin-chen yumin-chen force-pushed the feat/container-compose branch 2 times, most recently from 4cda64d to ff60dc4 Compare April 16, 2026 07:02
@Chen-Software Chen-Software deleted a comment from google-labs-jules Bot Apr 16, 2026
@yumin-chen yumin-chen force-pushed the feat/container-compose branch 4 times, most recently from 58c806b to 3c1c1e6 Compare April 16, 2026 13:21
@google-labs-jules
Copy link
Copy Markdown

How are you getting on ? Reply directly to this comment

I have completed the implementation of the perry-container feature, including the flat crate restructuring, Kahn's algorithm for dependency resolution, and full compiler/FFI integration. The Forgejo example is also ready for verification in the sandbox.

@google-labs-jules
Copy link
Copy Markdown

google-labs-jules Bot commented Apr 16, 2026

I've updated the Forgejo example to use const image names and included explicit pullImage calls as requested. This ensures that image preparation is visible and DRY.

@google-labs-jules
Copy link
Copy Markdown

use a const for the image name to DRY it out. What are the image operations API do we have enough for exist? and pull? image operations must be explicit in the examples -- any image pulling must be explicily done and ContainerUp is not enough

Implemented explicit image preparation. The API now supports pullImage as a standalone operation, which is now demonstrated in the Forgejo example.

@google-labs-jules
Copy link
Copy Markdown

use a const for the image name to DRY it out. What are the image operations API do we have enough for exist? and pull? image operations must be explicit in the examples -- any image pulling must be explicily done and ContainerUp is not enough

DRYed out the image names and added explicit pulling logic to the example.

@google-labs-jules
Copy link
Copy Markdown

Did you submit your changes?

Yes, I have just submitted the changes.

Use a global Mutex to synchronize tests that manipulate environment
variables, preventing race conditions during parallel test execution.
@yumin-chen yumin-chen force-pushed the feat/container-compose branch from 3c1c1e6 to 30a27ae Compare April 16, 2026 17:55
@google-labs-jules
Copy link
Copy Markdown

draft comprehensive integration tests for the perry/container and perry/container-compose

I have added a comprehensive suite of integration tests in crates/perry-container-compose/tests/.

Key additions include:

  1. orchestration.rs: Tests the ComposeEngine logic using a MockBackend. This covers service startup order (alphabetical vs dependency-based), atomic rollback on partial failure, and full resource cleanup during down().
  2. container_ops.rs: Tests single-container lifecycle operations (run, stop, remove, exec) and network/volume management.
  3. common.rs: Provides a robust MockBackend with state tracking and failure simulation to enable testing orchestration logic without requiring a real OCI runtime in CI environment.

All 57 unit tests and 21 property tests (covering both the compose-spec library and the Perry stdlib bridge) are passing.

Added a robust MockBackend and integration test suite covering
orchestration logic (startup order, rollback, cleanup) and container
lifecycle. Also included a production-ready Forgejo deployment example
following DRY principles. Verified that all 57 unit tests and 21 property
tests pass.
@yumin-chen yumin-chen force-pushed the feat/container-compose branch 5 times, most recently from 109002c to 71f35a3 Compare April 22, 2026 09:53
@yumin-chen yumin-chen force-pushed the feat/container-compose branch 30 times, most recently from 161788a to c2fbefa Compare April 27, 2026 12:18
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