Skip to content

383 minimal transaction lifecycle semantics commit only phase 13#401

Merged
evomimic merged 11 commits intomainfrom
383-minimal-transaction-lifecycle-semantics-commit-only-phase-13
Feb 26, 2026
Merged

383 minimal transaction lifecycle semantics commit only phase 13#401
evomimic merged 11 commits intomainfrom
383-minimal-transaction-lifecycle-semantics-commit-only-phase-13

Conversation

@owleyeview
Copy link
Collaborator

@owleyeview owleyeview commented Feb 20, 2026

PR Draft: Phase 1.3 Minimal Transaction Lifecycle Semantics + Minimal Host Concurrency Guarding

Summary

This PR completes the core of Phase 1.3 by making transaction lifecycle explicit and enforced, and then applies a minimal Phase 2 hardening pass for host-side commit ingress safety. This PR closes issue #383.

It introduces a concrete lifecycle (Open -> Committed), host-side commit-in-progress guarding with RAII, deterministic lifecycle errors, and commit-status-driven lifecycle transitions for both commit and load_holons.

Context / Motivation

Before this work, transaction lifecycle behavior was largely convention-based. This PR makes it explicit and enforceable so downstream command/SDK layers can rely on commit as a real persistence boundary.

What Changed

1) Explicit transaction lifecycle in core

  • Added TransactionLifecycleState with Open and Committed in shared_crates/holons_core/src/core_shared_objects/transactions/
    transaction_lifecycle_state.rs.
  • Added lifecycle storage + helpers in shared_crates/holons_core/src/core_shared_objects/transactions/transaction_context.rs:
  • lifecycle_state()
  • transition_to_committed()
  • ensure_open_for_external_mutation()
  • ensure_commit_allowed()

2) Host commit execution guard (RAII, host ingress only)

  • Added HostCommitExecutionGuard in shared_crates/holons_core/src/core_shared_objects/transactions/host_commit_execution_guard.rs.
  • TransactionContext now exposes host-ingress guard APIs (begin_host_commit_ingress_guard, etc.) and tracks
    host_commit_in_progress atomically.
  • Guard release is now automatic on all paths (including early errors).

3) Lifecycle enforcement at host request boundary

  • Updated lifecycle gating in host/crates/holochain_receptor/src/holochain_receptor.rs.
  • Commit-like requests (commit, load_holons) require commit-allowed state and acquire host commit guard.
  • Read/query requests remain allowed during commit ingress and after Committed.
  • External write/mutation requests (including host transient creation via create_new_holon) require Open and are rejected during
    commit ingress or after Committed.

4) Commit transition correctness

  • Receptor now transitions to Committed based on response properties, not just top-level ResponseStatusCode:
    • CommitRequestStatus for commit
    • LoadCommitStatus for load_holons
  • Added shared transition finalization helper to avoid drift between commit-like flows.

5) Guest/loader alignment for partial commit semantics

  • Guest commit path only clears nursery when commit status is explicitly Complete in happ/crates/holons_guest/src/
    guest_shared_objects/guest_holon_service.rs.
  • Loader computes and exposes LoadCommitStatus in happ/crates/holons_loader/src/controller.rs for lifecycle decisions at host
    ingress.

6) Deterministic lifecycle errors + mapping

  • Added lifecycle error variants in shared_crates/type_system/integrity_core_types/src/holon_error.rs:
    • InvalidTransactionTransition
    • TransactionAlreadyCommitted
    • TransactionCommitInProgress
    • TransactionNotOpen
  • Mapped these to 409 Conflict in shared_crates/holons_core/src/dances/dance_response.rs.

7) Cleanup

  • Removed unused CommitResponse type (shared_crates/holons_core/src/core_shared_objects/commit_response.rs and related exports).

Current Lifecycle Contract (as implemented)

  • Open:
    • Reads allowed
    • External mutations allowed
    • Commit-like ingress allowed
  • host_commit_in_progress == true:
    • Reads allowed
    • External mutations rejected
    • Overlapping commit-like ingress rejected
    • Internal guest commit/load processing still allowed
  • Committed:
    • Reads allowed
    • External mutations rejected
    • Commit-like ingress rejected

Tests Added

In host/crates/holochain_receptor/src/holochain_receptor.rs:

  • commit guard sets/releases correctly
  • re-entrant guard acquire is rejected
  • guard releases on early error path
  • external mutation rejected while host commit ingress active
  • external mutation rejected after committed
  • finalize transition only commits when requested
  • double transition attempt rejected deterministically

@owleyeview owleyeview linked an issue Feb 20, 2026 that may be closed by this pull request
8 tasks
@owleyeview owleyeview force-pushed the 383-minimal-transaction-lifecycle-semantics-commit-only-phase-13 branch from f4eb768 to 338d57c Compare February 20, 2026 20:24
@owleyeview owleyeview marked this pull request as ready for review February 23, 2026 20:37
@owleyeview owleyeview requested a review from evomimic February 23, 2026 20:37
Copy link
Owner

@evomimic evomimic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this is very close. See comments for requested changes.

@owleyeview owleyeview requested a review from evomimic February 25, 2026 20:14
Copy link
Owner

@evomimic evomimic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick response!

All looks good!

Confirmed all tests pass and npm start runs correctly.

@evomimic evomimic merged commit 3038e52 into main Feb 26, 2026
2 checks passed
@evomimic evomimic deleted the 383-minimal-transaction-lifecycle-semantics-commit-only-phase-13 branch February 26, 2026 00:03
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.

Minimal Transaction Lifecycle Semantics (Commit-only) (Phase 1.3)

2 participants