Skip to content

Effect lowering contracts and Effect Unit command entries #139

Description

@biuld

Scope

A standalone correctness and command-entry slice under #78, selected explicitly before the full Phase 4 gate. Preserve abstract source Effect and lower it to the existing generic closure representation.

Required behavior

  • Resolve trusted Effect and primitive operation identities once and carry the contract into Core; untrusted same-named foreign data is not a compiler effect.
  • Carry synonym-expanded, quantified checked WIT import schemes through THIR, Core, and linking; WIT conformance and Effect classification consume this shared authority rather than reconstructing raw HIR annotations.
  • Classify effectful foreign imports before erasing the abstract type and suspend them from that evidence, without inferring effect semantics from an arbitrary single-parameter closure.
  • Validate the converted Core, generated primitive declarations, and suspended import wrappers; distinguish structural checks from behavior established by execution.
  • Use one entry identity selection rule for scope checks and command lowering.
  • Execute selected main :: Effect Unit once via a generated zero-argument integer command entry. Normal completion returns exit code 0; traps propagate. Preserve integer main compatibility.
  • State the source-visible runEffect compatibility rule truthfully as a restriction on direct resolved references, without claiming runner confinement.

Acceptance

Source tests cover inferred and annotated Effect main, aliases/re-exports, linked actions, single execution and observable order, assertion trap and suppressed later output, legacy integer entry, ambiguous/invalid entries, and untrusted same-named opaque types. Negative IR cases cover invalid lowering metadata and ordinary closures that must not be interpreted as effects. The full official-suite runtime scoreboard records recovered executions and newly exposed first blockers; modules without an executable main remain explicit.

References

  • docs/feature/F-02-portable-programs.md
  • docs/design/backend/fp/effects.md
  • docs/design/backend/00-ir-boundaries.md
  • docs/implementation/backend/effects.md
  • docs/implementation/backend/wasi-platform.md
  • docs/design/D-04-suite-roadmap.md

Validation

cargo fmt --all --check
PSRS_REQUIRE_WASMTIME=1 cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
PSRS_REQUIRE_WASMTIME=1 PSRS_ORACLE=annotations cargo test -p psrs-driver --test suite -- --ignored --nocapture
git diff --check

This slice does not close the broader #78 epic or assert that all corpus modules have a runnable entry.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendBackend: CC, MIR, Wasm encoding, WIT/ABI, WASIgate:L6/M7Blocks runtime and the standard library (D-04 L6, M7)

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions