Registry Mirror
Skip to content

Conversation

@andrewtdiz

Copy link
Copy Markdown
Contributor

Replacement for external PR #159, whose head branch could not be pushed to by this account (GitHub returned 403 for yumin-chen/perry).\n\nThis branch merges current main into the container-compose work, resolves the split-module/runtime/API manifest conflicts, regenerates Cargo.lock, and keeps the container feature wiring intact.\n\nValidation run:\n- cargo metadata --no-deps --format-version 1\n- cargo check -p perry-container-compose\n- cargo check -p perry-stdlib --features container\n- cargo check -p perry-codegen -p perry-runtime -p perry-api-manifest\n- exact conflict-marker scan\n- git diff --check --cached

yumin-chen and others added 6 commits April 30, 2026 13:06
feat: implement production-ready container and workload orchestration

Finalize the OCI stack by implementing the `perry/container` and
`perry/container-compose` (workloads) subsystems. This moves the
implementation from initial stubs to a hardened, spec-compliant architecture.

Core Subsystems:
- Orchestration: Implemented `WorkloadGraphEngine` and `ComposeEngine`
  using Kahn's algorithm for deterministic dependency resolution and
  topological startup/shutdown/rollback.
- Backend Logic: Multi-layered auto-detection for 7+ runtimes (Apple, Podman,
  Docker, Lima, etc.) with liveness probes and strict priority ordering.
- Security & Policy:
    * Implemented `PolicySpec` enforcement (Isolated, Hardened, Untrusted).
    * Added image verification via Sigstore/cosign (opt-in via environment).
    * Hardened ephemeral runners with `cap_drop: ALL`, seccomp, and read-only
      root support.
- FFI Bridge: Expanded `perry-stdlib` with async-safe, promise-based
  handlers optimized for raw C-ABI passing of primitives.

Technical Details:
- Restructured `perry-container-compose` into a flat module layout.
- Standardized container naming to `{image_hash_8}-{random_hex8}` with
  label-based orphan cleanup.
- Refactored `CliBackend` to be generic over `CliProtocol` for zero vtable
  overhead.
- Modernized internal registries with `DashMap` for concurrent access.
- Integrated with Perry compiler (HIR registration and codegen dispatch).

Refinements & Fixes:
- Fixed SQLite linker conflicts by gating runtime stubs.
- Restored `Buffer` synonym and `process.argv` specialization in `lower.rs`.
- Implemented robust IP and label extraction for the `DockerProtocol`.
- Expanded `MockBackend` for high-fidelity orchestration testing.

Validation:
- Added 12 new tests covering orchestration states and policy enforcement.
- Verified 79/0 pass in `perry-container-compose`.
- Verified 33/0 pass in `perry-stdlib` container features and smoke tests.
…ycle

Complete the OCI container and workload subsystems by resolving nine
interlocking codegen/FFI bugs and implementing a production-ready Forgejo
deployment example. This update moves the stack from "spec-complete" to
"deployment-hardened."

Orchestration & Correctness:
- Project Namespacing: Volumes and networks are now prefixed with
  `<project>_<name>` to prevent cross-stack collisions and data corruption.
- Idempotency: Implemented spec-hash tracking (`perry.compose.spec_hash`);
  subsequent `up()` calls now detect drift and recreate containers only on
  configuration changes.
- DNS & Aliases: Automated service-key network aliases, allowing sibling
  containers to resolve each other (e.g., `db:5432`) via embedded DNS.
- Rollback & Cleanup: Fixed volume-drain bugs in `down()`; added RAII-style
  `downByProject` and `downAll` APIs for reliable resource recovery.

Codegen & FFI Fixes:
- Fixed FFI type mismatches where LLVM doubles conflicted with Rust i64/i32
  signatures for handles.
- Resolved "Invalid Handle" bugs via NaN-boxing with `POINTER_TAG` for
  safe u64-to-f64 handle round-trips.
- Implemented `js_value_to_str_ptr_for_ffi` to correctly handle JSON
  serialization for complex objects passed to `composeUp`.
- Fixed async backend race conditions via synchronous in-place probes.

Security & Environment:
- Enforced `PolicySpec` tiers (Isolated, Hardened, Untrusted) with
  fail-fast checks for backend compatibility.
- Added three-mode image verification (off, warn, enforce) via Sigstore/cosign.
- Integrated `${VAR:-default}` environment interpolation at the FFI boundary.

Testing & Validation:
- Phase A-E Test Sweep: 191+ tests covering hermetic functional logic,
  FFI regressions, live-runtime integration (Docker/Podman), and e2e
  compiler-to-runtime flows.
- Forgejo Deployment: A production-quality example using `data.forgejo.org`,
  featuring healthcheck-gated dependencies and stable volume secrets.
Move container examples to /examples/container and update them
…container/ section

Seven new pages cover overview, single-container lifecycle (perry/container), compose orchestration (perry/compose), networking (incl. the container_name DNS workaround), volumes, security, and a Forgejo-deployment case study. New docs/examples/stdlib/container/snippets.ts with 11 ANCHOR blocks pulled into the markdown via {{#include}}. doc-tests --lint and --filter container both pass.
…ontainer-compose

# Conflicts:
#	Cargo.lock
#	crates/perry-codegen/src/runtime_decls.rs
#	crates/perry-hir/src/ir.rs
#	crates/perry-runtime/src/.value.parked/mod.rs.tmp
#	crates/perry-stdlib/Cargo.toml
#	crates/perry/src/commands/stdlib_features.rs
- Add API_MANIFEST entries for perry/container, perry/compose,
  perry/container-compose, and perry/workloads so the
  every_native_module_has_at_least_one_manifest_entry test passes
  and the unimplemented-API gate (PerryTS#463/PerryTS#513) flips strict mode on.
- Add crates/perry-container-compose to [workspace] default-members
  (fixes container_workspace_invariants::perry_container_compose_in_default_members).
- cargo fmt --all over the container-compose crate + stdlib container
  modules (fixes lint).
- Regenerate docs/api/perry.d.ts and docs/src/api/reference.md from the
  manifest (fixes api-docs-drift).
@proggeramlug proggeramlug reopened this Jun 2, 2026
@proggeramlug
proggeramlug force-pushed the codex/repair-pr-159-container-compose branch from bfc65dd to 50b4934 Compare June 2, 2026 13:13
andrewtdiz and others added 4 commits June 2, 2026 10:33
# Conflicts:
#	docs/api/perry.d.ts
#	docs/src/api/reference.md
…oversized files, drop phantom test ref, regen docs

- Gate the 7 perry-stdlib container integration tests with
  #![cfg(feature = "container")] so the default-feature cargo-test gate
  compiles (the container module is feature-gated).
- Allowlist perry-container-compose/src/backend.rs + perry-stdlib container
  mod.rs for the file-size gate (PerryTS#1435).
- Remove the dangling --test container_bug_regressions reference (the test
  never existed) from the Container Tests workflow.
- Regenerate API reference + .d.ts for the merged container manifest entries.
@proggeramlug
proggeramlug merged commit e20a6b5 into PerryTS:main Jun 3, 2026
17 checks passed
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.

3 participants