# PR-23 — Eliminate Invalid Call Fallbacks ### Goal Prevent invalid bytecode generation. ### Required Changes * Remove **all** fallbacks to `FunctionId(0)` or equivalent * On unresolved symbols during lowering: * Emit canonical diagnostic (`E_RESOLVE_UNDEFINED` or `E_LOWER_UNSUPPORTED`) * Abort lowering ### Tests * PBS program calling missing function → compile error * No Core IR or VM IR emitted --- # PR-24 — Validate Contract Calls in Frontend (Arity + Types) ### Goal Move contract validation to compile time. ### Required Changes * During PBS type checking: * Validate argument count against contract signature * Validate argument types * Lower only validated calls to `HostCall` ### Tests * Wrong arity → `E_TYPE_MISMATCH` * Correct call lowers to Core IR `HostCall` --- # PR-25 — Core IR Invariants Test Suite ### Goal Lock in correct semantics before touching the VM. ### Required Invariants * Every `Begin*` has a matching `End*` * Gate passed to `Begin*` is available at `End*` * No storage writes without `BeginMutate` * No silent fallbacks ### Tests * Property-style tests or golden IR assertions --- ## STOP POINT After PR-25: * Core IR correctly represents PBS HIP semantics * Lowering is deterministic and safe * VM is still unchanged **Only after this point may VM PRs begin.** Any VM work before this is a hard rejection. --- ## Instruction to Junie If any rule in this document is unclear: * Stop * Add a failing test * Document the ambiguity Do not invent behavior. This document is binding.