IC upgrade boundary and independent review

The final combined f294d1a5 artifacts repeat all ten pending-local actual IC checks and add the combined root, stable ownership and Heavy16 qualification. See integrated results; the source-specific reviews below retain their original scope.

Source baseline: 6a19090e, branch store-round2/ic; 2026-10-20. All IC source inspection is read-only at /srv/shared/ic, revision ee8086a9773725fd1058832a9400297cf0990112. That checkout explains implementation; it is not proof of the server build revision. Actual probes use the separately hashed PocketIC 16.1.0 binary 1fc9e6f58f7b329a0deb0c1944306a74625293fa56decf9df653ba8ec41fa45c. Retained Store directory, attachment and record anchors remain intentional.

The useful distinction

Logical pending work can be a durable local Ready/Waiting/Joining node with an absolute saved deadline. A physical handler is an active Rust future, callback environment, method context or transport operation. KEEP preserving bytes does not make old function-table entries, transient Rc services or futures usable by new code. The IC system API registers callback function indices and environment values. The SDK deliberately drains these before replacing code.

Zero physical calls is insufficient. A completed handler can leave an uncertain Blocked request or external response address. A timeout ends logical waiting, not the physical operation or its effect. Such work keeps its original request, identity and definition; this candidate does not retry or translate it.

The management specification defines stopping/open-context behavior, atomic installation and KEEP. Do not infer that every platform upgrade requires a prior stop, or that a stopped canister's application state is necessarily logically resolved. Application and SDK gates establish this implementation's stronger boundary.

Existing gates stay closed

  • ver1/crates/cdk-rsx/src/lib.rs::assert_upgrade_ready rejects undrained SDK callback tables or executor tasks before application checks run.
  • cdk-rsx-executor::shutdown rejects tasks, method contexts, an active execution context and trap recovery. Timer shutdown rejects outstanding physical timer calls. Explicit transient-root teardown and its final recheck precede the zero-Global-allocation assertion and clean handoff marker.
  • Takt's ordinary RuntimeView::shutdown still requires pending, logical and physical counts and permits to be zero. Existing Fourcans keeps its full-drain check. Coordination's bindings, due work and addressed Reactor subscriptions, completions, publications and recipients are not made upgradeable here.
  • Current catalog admission still runs before any retained pointer is opened; only the current or an exact declared predecessor digest may enter conversion.

Incremental implementation: opt-in unchanged local work

The new native RRT path consists of Runtime::check_local_upgrade and suspend_local_work, plus a cold validator registered by the existing workflow driver. It is not selected by default and introduces no saved field or schema. Only lifecycle calls scan pending executions/nodes; ordinary turns do not.

At each old-code check and new-code rebind, it requires:

  1. Zero Takt logical/physical calls, physical identities, runtime permits and scheduler callback units/permits; no queued native/coordinated calls or transient addressed completion/de-dup entries.
  2. Every registered engine's addressed Reactor is drained, including saved completions/publications/active calls in addition to runtime watches and in-flight calls. The composing root must also check every other owner.
  3. Every pending execution matches the compiled definition version and full saved 32-byte identity. Pending nodes may only be Ready, Waiting or Joining, with neither Task nor producer. Awaiting, RetryWait, Received, Blocked, external requests and uncertainty therefore fail even with physical count 0.
  4. The sum of registered engines' pending counts equals the durable shared Runtime pending count. A missing pending-work driver fails closed.

Definition::LOCAL_UPGRADE_SOURCE is explicit opt-in and defaults to None. It pins complete step/reply/policy and helper source/interpretation dependencies and active configuration, and must also be included in root semantic admission. The existing function-free graph SIGNATURE alone does not establish body identity. For opt-in definitions the graph and source contracts are framed and SHA-256 hashed at compile time. The engine binds that digest to its exact u64 namespace once when the driver is attached (or first used in a direct native test), then saves the full result in the existing StoredOption<[u8;32]> execution signature. A fixed transient service cache holds the 32-byte compiled input witness and 32-byte bound identity; ordinary turns compare it without rehashing. Changing namespace fails at rebind even if the author omitted the binding configuration from the source declaration. No u64 truncation is used. Ordinary definitions keep their existing identity and cannot suspend pending work through this path. Hash collision resistance is assumed, just as for existing catalog admission; this is accidental-change detection for trusted compiled contracts, not a sandbox against an author deliberately declaring a false contract. Automatic source closure generation remains unfinished.

A separate follow-up rejects LOCAL_UPGRADE_SOURCE = Some with no graph SIGNATURE during const evaluation. The engine consumes the compiled pair without a redundant runtime missing-graph branch. The exact compile receipt records two successful used-definition builds (ordinary None default and a qualified pair) and one rejected source-only build with rustc E0080 and the specific declaration error. rrt/tools/test-local-upgrade-contract.py forces code generation through an exported nongeneric caller, so this is not a test of an unused generic body. Seven focused native state/rebind cases also pass after this refinement. The actual IC artifacts below remain pinned to earlier frozen source 2a15f7b1; this later compile-time-only refinement is not relabeled as part of that run.

After validation the old controller cancels only unstarted timers, transient drivers/leases are detached and SDK teardown follows its existing sequence. Saved queues, wake keys, IDs, versions, visit/attempt data and absolute deadlines remain untouched. New code binds all definitions and validates before reactor::ic::start registers/refreshes the controller and arms timers. No deadline is refreshed and no history chain is replayed.

Scheduler DriverId, ready tickets and deadline indexes live only in its transient Core. Saved Takt Work identifies execution/node/visit; a WakeKey stores absolute time plus monotonic ticket, with Wake::Node carrying the Work. Operation Key includes namespace/version, while the opt-in execution identity independently binds the namespace even before a local node creates an operation. Every new driver is marked dirty; EngineView::readiness projects saved ready queues and the earliest saved wake into new scheduler IDs. Registration ordinals need not survive. The dedicated fixture changes workflow ordinal 0 to 1 by reversing an inert driver's binding order in its successor executable.

The fixture is rrt/tests/pending-local-probe, with the ordinary generated explicit root hooks, the native RRT Engine/driver/SDK, and a root semantic dependency on its complete flow contract. It uses a local absolute wait and a real held native callback whose mapper deliberately traps. It qualifies one narrow native RRT case; RRts and applications have not opted in merely because this fixture exists. No active workflow migration is implemented.

Validation and reproducibility

Focused native cases cover local deadline/rebind and unchanged default drain, same-graph changed source, changed namespace, live call then physically idle uncertainty, external event wait, a missing registered pending driver, and a held scheduler permit. The canonical Wasm probe additionally checks same-artifact KEEP, a successor with reordered registration, rejection of a same-graph source/configuration change, late restore rollback, a changed namespace, the original timer deadline, live SDK callback rejection and explicit original-operation reconciliation. Actual results are recorded below after the frozen build/run; native tests alone do not qualify these IC claims.

Build lease: rrt/tmp/perf-round12/targets/contract-pair, with checksum freshness, the local pinned compiler and source-built Wasm64 standard library. Outputs are under rrt/tmp/store-round2/ic; the runner uses only its owned instance on the shared server and pinned JS client 0.16.1. No trace is cleared and no shared server is stopped.

Frozen source 2a15f7b1f6665fed53f41b12259ca536fbaed7f7 passes all ten actual IC checks. The compact review receipt pins raw rrt/tmp/store-round2/ic/lifecycle-bound-1/result.json and the independent source-after.json. Each artifact has 637 archived build inputs, unchanged through its canonical build, and 651 source/output checks both before and after the run. Runtime-import helper bytes equal this worktree's copies; client 0.16.1 and the server hash are recorded. Seven focused native cases plus 94 existing runtime tests and two compile-fail doctests pass.

Variant Wasm SHA-256 Actual result
V1 b09e7bde5732b25f9e82c2fedca93f0f12f5d81f9052c9b8b943f6195644fe0f Pending local wait; exact KEEP; late restore rollback
revision2 06e5c42bc330b2bda7c1cb4082ce8b7cbaa29d2a884de2ad330a49701090d569 New executable, reordered drivers, original timer and reconciliation
bad-definition 3c052400f5efdd58f15f227ecab49b11752c111ec43263b4e334eaf766bcb710 Same graph, changed source/configuration rejects at catalog admission
bad-namespace 41f38113cd1bc3001f5415505031f9d7b9120533a14dd347b20c0f47d4e63f17 Same graph/source contracts, changed namespace rejects before timer arming

After a mapper callback trap, the sentinel is rolled back, the original request and attempt remain unchanged, and logical/physical counts reach zero. KEEP still rejects the uncertain Blocked execution. Explicit original-operation resolution then completes it; the physical native endpoint was called exactly once before and after the final KEEP. These checks use real SDK callbacks, not impersonated ingress completion methods. The restore-trap case first tears down old services, then traps after new retained binding/validation and a deliberate retained write; the old executable, services and pending snapshot remain usable through IC rollback.

Initial screen failures were harness failures and remain in lifecycle-1.log and lifecycle-2/failure.json: rapid repeated installations exhausted the normal install-code debit, and flooring nanoseconds into millisecond clock advances left time almost one millisecond before the saved wake. The final runner inserts 16 ordinary empty rounds before KEEP (without advancing time) and advances the last remainder with ceiling division. It checks no early execution and completion at/after the saved wake within one millisecond; it does not assert exact timer delivery at a timestamp between representable client clock advances.

Compiler upgrades remain rejected

ver1/crates/cdk-rsx-memory-abi/build.rs hashes rustc -vV, the compiler binary, driver and LLVM backend, all pinned rust-src, target/features/panic/Rust flags and the qualification recipes into COMPILER_SOURCE_CLASS. Catalog digests include that class plus complete physical and semantic closures and policies. The proposed local-work path does not alter it.

The Rust Reference permits layout changes between compilations; equal size/alignment is insufficient. An outer repr(C) does not make every nested Rust/library type portable. Importing frozen V1 source into a new compiler describes V1 as compiled by that new compiler, not the exact layout used by its predecessor. Portable stable codecs do not make retained kernel anchors compiler-independent.

A feasible future mechanism is a build-time certificate for an exact old/new compiler pair, comparing the entire retained closure (fields, tags, pointers, allocation recipes and interpretation dependencies) and qualifying install, KEEP, owner conversion and rollback on actual Wasm. It must include private allocator/Store anchors and all reachable generic collection layouts, not a hand-picked record. An alternative is old-code export through an explicit portable bridge and new-code reconstruction, which is a separate persistence design. Neither is implemented or admitted in this round. Never bypass the compiler class based only on reflected size/alignment or a successful toy KEEP.

An additional source-policy review found RRts persistent Payload<T> delegates to Wire encode/decode while its carrier policy initially hashes only the local wrapper. Payload/schema declarations and compiler qualification do not freeze a same-schema codec interpretation edit. Integrated commits 50f02698 and 9389d0a1 close that generic codec gap as reviewed below. Exact build archives alone do not enforce compatibility of a future release. This does not invalidate the unchanged-codec measurement receipts, and does not authorize a changed codec on those images.

Integrated source review and semantic boundary

Read-only review of main through 9389d0a199e40ed9db1a2b6bb326b0653c7c7f18 found no weakened pending-work rejection. LOCAL_UPGRADE_SOURCE = None returns the previous graph signature before consulting the transient cache or hashing a namespace; normal default-definition work introduces no per-turn SHA. The opt-in path hashes its namespace-bound identity once per bound Engine. Its validation scan remains confined to upgrade boundaries. SDK callbacks/tasks, scheduler permits, physical/logical calls, uncertain tasks, external producers and addressed Reactor state still reject; ordinary full-drain shutdown remains the default. The added transient Engine field and registration callback can change service allocation/layout costs, so source review does not establish an exactly zero whole-workload instruction delta. The final combined artifacts need their own measurement and lifecycle receipts.

The generic memory declaration review (c73a3846) keeps physical metadata and semantic dependencies per concrete monomorphization, without a runtime schema registry or startup instance scan. Same-size generic/cfg/custom-codec semantics remain explicit owner dependencies. Generated root admission (da22b1b2, with later Wire composition) obtains the memory type from the actual Actor binding, compares the saved fixed digest before user restore, and publishes the target only after a successful callback with APP present. Previous catalogs use the same mandatory policy set; they do not implicitly authorize changed compiler, collection or Wire interpretation. The earlier exact IC admission artifacts predate these later integrated additions and are not relabeled.

The Wire build policy now hashes both complete controlled Rust source trees, the SDK bridge, manifests/build recipe and selected Cargo target configuration. Serializer dependencies are exactly pinned, including Serde derive. RRts CARRIER_POLICY composes that digest; native Rechain block, Reactor frame and Takt task owners declare it, and generated SDK roots add it automatically. A native regression uses an actual Payload<u64> child: changing only its Wire dependency preserves physical layout/Codec size but changes both module and rooted catalog digests. Its 20 Wire tests and one carrier regression pass. This is source/native evidence for the generic codec contract, not an IC test of an edited codec against an old image.

Consumer schemas remain a separate, explicit author obligation. For concrete examples, Fourcans's permanent Action schema is in wire.rs, while its custom Envelope serializer is in ledger/mod.rs. The Ledger memory declaration hashes its memory version; the graph policy hashes the seven workflow JSON files. Neither automatically infers those Action and Envelope semantics. Reactor's DTOs, framing identities and decode budgets in reactor/src/wire.rs likewise sit outside the generic codec source policy. An owner must include the relevant consumer declarations, custom serializer/helper dependencies and active cfg in its semantic contract whenever their interpretation must survive KEEP.

Opaque retained evidence bytes can be preserved and hashed byte-for-byte without decoding them as a new schema. They still need a frozen schema for a reader that claims their original typed meaning. Bytes decoded into authoritative workflow or business state require that interpretation contract before decoding; equal carrier width and a generic codec pin are insufficient. The current full-drain and peer-protocol evolution rules remain in force. This round adds no automatic proof for arbitrary application serializers, DTOs or protocol changes.

The authored service-view adapter 83935877 emits only the static Service GAT and a checked call to the existing inherent view, with its generics/where/cfg conditions. It adds no frame, Rc clone, RootService certificate or lifecycle policy. Source review and the recorded native pointer/capability tests pass; combined Wasm qualification remains separate.

Named-owner commits 71e6f0bb and 7f2c077e also pass source/receipt review. The source loan encloses every split field token; reconstruction creates its pending target before consuming fields and retains nested transfer loans until assembly finishes. The derive explicitly requires fieldwise StableValue ownership and adds no safe raw adoption. Recorded tests pass 38 Collections native cases, 20 Stable cases, two positive and nine negative doctests. The final privacy check rejects with E0616; encoding rejects with E0277, raw-hook use with E0133, and a field view cannot escape its lexical scope. The native changed-field conversion preserves shared-child identity and disposes the removed unique field; caught partial work and forgotten fields force quarantine/restoration. The new probe instead keeps a 16-byte Row whose V2 imports the same V1 type: its forthcoming combined IC gate exercises named split/rebuild through the existing conversion, not a changed named field schema. Earlier IC receipts are not relabeled as qualification of this later derive.

Follow-up 8772c940 (integrated fd2ca318) makes that structural contract a compile-time requirement: struct StableValue derives emit the zero-method, zero-data FieldwiseValue certificate with the same field bounds, and OwnedRecord requires it. A concrete manual aliasing contract rejects with E0277; an explicitly unsafe manual fieldwise certificate compiles with both split/rebuild methods. Source/receipt review passes three named cases, four derive cases, three positive and ten negative doctests, and the all-feature native probe. No new IC claim is attached to this source-only follow-up.

Continuing experiment review

The diagnostic stable profile counts actual provider calls and bytes inside complete reactor turns, separately from logical storage operations. Nonempty stable64 reads/writes pay 20 + length on every call, including repeats; page tracking and the observer are separate. The initial 52-turn complete small graph has 309,946,509 direct copy/API instructions (6.31% of 4,914,894,387 observed), with no zero-length raw calls in that scope. This is attribution, not a Heavy16 selection result. Existing capacity-based page-fee bounds exclude only specified first-touch fee classes; the remainder is not "pure compute".

Independent source review found no blocker in lazy Map decoding/span replacement 4fdb6f0a; it preserves encoded node layout, stored keys and owner transfer. Scoped-read workspaces may remove allocation/zero/copy of an intermediate heap buffer, but cannot remove the stable API copy itself. Decoders under an exclusive storage borrow must not reenter TLS storage. Ownership 03043a51 now creates its pending loan before a fallible mutation and retains a disposal sentinel while retirement runs; caught-inner-panic tests cover the earlier commit-able orphan gap. Catalog be197097 and services 9ab39c5b include actual IC lifecycle evidence, including same-size cfg semantic rejection and explicit domain-check limits. Detailed candidate measurements remain in their lane receipts.

Final read-with candidate 0ad3bf60 / Wasm 2972dea3… has independently reviewed Heavy16 receipt performance/readwith-heavy16/heavy16-audit.json: 1,132,656,131,451 finished replicated instructions / 188 complete rounds, unchanged complete work, and passing public lifecycle plus six stable mutation/rollback gates. The 52-turn diagnostic profile retains every Map-candidate provider/logical call/byte/allocation/growth counter, while observed instructions fall from 3,042,990,659 to 2,590,803,255. This supports reduced transient workspace cost at unchanged API volume; it does not separately apportion ordinary Wasm work and changed heap first-touch fees.

For large conversion qualification, the local application-subnet defaults are 300B total install-code instructions and 2B per DTS slice (rs/config/src/subnet_config.rs); system-subnet and benchmarking overrides are different. The official execution-error reference also documents the 300B install/upgrade total. Performance counter 0 is cumulative across slices: wasmtime_embedder/system_api.rs::message_instructions_executed adds completed-slice instructions, and out_of_instructions updates that sum on resume. A measured post-upgrade conversion delta over 2B plus an independently finished post-upgrade trace under the default application configuration proves slicing; management-call round count alone includes other installation phases.