1. Summary (Required)
What is the enhancement?
Complete the architectural transition from HolonsContextBehavior to TransactionContext as the sole transaction-scoped execution surface for MAP Core.
This phase:
- Removes
HolonsContextBehavior as a public abstraction
- Moves the remaining MAP Rust API surface onto
TransactionContext (or facades owned by it)
- Establishes a single, authoritative execution model for:
- MAP Commands (Phase 2+)
- IntegrationHub
- TypeScript SDK (v0)
This is a structural cleanup and consolidation step that prepares MAP Core for safe, minimal SDK exposure.
2. Problem Statement (Required)
Why is this needed?
After Phases 1.2 and 1.3:
- References are transaction-bound and self-resolving
- Transaction lifecycle semantics are explicit (
Open → Committed)
TransactionContext is already the de facto execution surface
However, the codebase still contains a legacy abstraction:
HolonsContextBehavior remains in public APIs
- Many operations are expressed as:
- free functions, or
- trait methods that immediately delegate back into
TransactionContext
- Transaction lifecycle entry is conceptually mixed with transaction-scoped execution
Before introducing MAP Commands and a TypeScript SDK, we must ensure that:
- There is exactly one transaction-scoped execution surface
- Lifecycle entry (begin) is clearly separated from transaction-scoped execution
- Transaction semantics are not split across traits, helpers, and managers
- The API exposed to Commands is explicit, auditable, and minimal
3. Dependencies (Required)
This enhancement assumes:
- Phase 1.1 (space-manager fully wrapped behind transaction context) complete
- Phase 1.2 (transaction-aware, self-resolving references) complete
- Phase 1.3 (explicit transaction lifecycle semantics) complete
- Exactly one implicit open transaction per space/context (current v0 model)
This enhancement must land before:
- MAP Commands layer
- TypeScript SDK (v0)
4. Proposed Solution (Required)
4.0 Introduce semantic facades to avoid API monolith
As TransactionContext becomes the sole execution surface, simply moving all APIs directly onto it would create an unwieldy and semantically flat implementation.
Instead, Phase 1.4 introduces small, semantically grouped facades owned by TransactionContext.
These facades:
- Partition the transaction execution surface
- Do not represent alternate execution surfaces
- Do not own state
- Do not bypass lifecycle enforcement
- Are thin semantic wrappers over internal managers
- Exist solely to group related operations and prevent API sprawl
MAP operations fall into three semantic domains:
- Lifecycle control — transaction state transitions (commit, future rollback)
- Mutation — state-changing operations (write path)
- Lookup — indexed and convenience read operations
This separation is forward-looking:
mutation() aligns with future MutationCommand
lookup() preserves indexed reads distinct from future graph-native querying
- Lifecycle remains on the root because it defines execution semantics
The public execution shape after Phase 1.4 becomes:
TransactionContext
├─ lifecycle (root)
├─ mutation()
└─ lookup()
This structure anticipates future graph() support without requiring further refactoring.
4.1 Make TransactionContext the sole transaction-scoped execution surface
After Phase 1.4:
- No public APIs accept
HolonsContextBehavior
- No free-standing functions act as execution entrypoints
- All reads and writes flow through
TransactionContext
- Managers (
Nursery, TransientHolonManager, etc.) remain internal implementation details
4.2 Lifecycle stays on the root
Remain inherent methods on TransactionContext:
tx_id()
lifecycle_state()
is_open()
commit()
Future lifecycle operations (e.g., rollback()) also live here.
Lifecycle methods apply only to an already-begun transaction.
4.3 Introduce mutation() facade
Grouped under:
Includes:
- Transient construction
- Staging operations
- Write operations
load_holons
Properties:
- Represents the full write path
- Enforces lifecycle invariants
- Provides a clean future insertion point for undo/redo support
4.4 Introduce lookup() facade
Grouped under:
Includes:
- Indexed and convenience read operations
- Staged/transient lookup
- Counts
get_all_holons
Properties:
- Read-only
- Backward compatible
- Distinct from future graph-native querying
4.5 Explicitly reserve future graph-native surface
Phase 1.4 does not introduce graph().
However, the facade structure allows future addition of:
without restructuring execution semantics.
Indexed lookup and graph-native querying remain conceptually distinct.
4.6 Absorb HolonOperationsApi
All functions currently in HolonOperationsApi:
- Removed as free functions
- Reintroduced under
TransactionContext
- via
mutation()
- via
lookup()
- or lifecycle root
No execution-facing APIs remain outside TransactionContext.
4.7 Keep managers internal
The following remain internal collaborators:
Nursery
TransientHolonManager
HolonServiceApi
HolonCacheAccess
They do not:
- Escape as execution surfaces
- Expose public behavior traits
- Accept lifecycle responsibility
Execution semantics are enforced only at the TransactionContext level.
4.8 Review TransactionManager (Owned by Space Manager)
What we need is:
- A space-scoped authority responsible for:
- Beginning transactions
- Registering transactions
- Looking up active transactions
- Preserving transaction identity uniqueness
This is governance, not construction.
Responsibilities include:
- Space-level ownership of transaction lifecycle entry
- Clear separation between lifecycle entry and transaction-scoped execution
- A single authoritative source of transaction creation per space
4.8.1 Architectural Role of TransactionManager
TransactionManager:
- Is scoped to a single
HolonSpace
- Is owned by
HolonSpaceManager
- Is responsible for:
begin_transaction()
begin_transaction_with_id(tx_id)
get_transaction(tx_id)
- Maintains a weak registry of open transactions
- Does not own transaction lifetime
Transactions are owned by whoever holds Arc<TransactionContext>.
4.8.2 Clarified Role of HolonSpaceManager
HolonSpaceManager is:
- The space-scoped infrastructure registry
- The owner of:
- Cache routing
- Holon service access
- Dance initiator
- Transient state
- TransactionManager
It is not:
- A transaction execution surface
- A public lifecycle surface
- A semantic domain object
It exposes TransactionManager for lifecycle entry:
space_manager.transaction_manager().begin_transaction()
This makes lifecycle commands clearly space-scoped and outside any existing transaction context.
4.8.3 Execution Boundary Clarification
After Phase 1.4:
-
Transaction lifecycle entry (open_transaction) is:
- Space-scoped
- Provided by
TransactionManager
- Not callable from within
TransactionContext
-
Transaction lifecycle state transitions (commit, future rollback) are:
- Transaction-scoped
- Provided by
TransactionContext
This cleanly separates:
- Lifecycle entry (outside transaction)
- Execution and state mutation (inside transaction)
5. Scope and Impact (Required)
Impacted areas:
- Removal of
HolonsContextBehavior
- Refactoring of call sites
- Migration of free-standing APIs
- Removal of
TransactionContextFactory concept
Not impacted:
- Reference model
- Transaction lifecycle semantics
- Persistence formats
- MAP Commands (next phase)
- TypeScript SDK (next phase)
This is a large but mostly mechanical refactor guided by an already-established execution model.
6. Testing Considerations (Required)
- Existing tests should continue to pass
- New tests ensure:
- No public APIs accept
HolonsContextBehavior
- All transaction-scoped execution flows through
TransactionContext
- Transaction lifecycle entry flows through
TransactionManager
- Lifecycle enforcement remains intact
- Test fixtures use
HolonSpaceManager → TransactionManager → TransactionContext
7. Definition of Done (Required)
This enhancement is complete when:
1. Summary (Required)
What is the enhancement?
Complete the architectural transition from
HolonsContextBehaviortoTransactionContextas the sole transaction-scoped execution surface for MAP Core.This phase:
HolonsContextBehavioras a public abstractionTransactionContext(or facades owned by it)This is a structural cleanup and consolidation step that prepares MAP Core for safe, minimal SDK exposure.
2. Problem Statement (Required)
Why is this needed?
After Phases 1.2 and 1.3:
Open → Committed)TransactionContextis already the de facto execution surfaceHowever, the codebase still contains a legacy abstraction:
HolonsContextBehaviorremains in public APIsTransactionContextBefore introducing MAP Commands and a TypeScript SDK, we must ensure that:
3. Dependencies (Required)
This enhancement assumes:
This enhancement must land before:
4. Proposed Solution (Required)
4.0 Introduce semantic facades to avoid API monolith
As
TransactionContextbecomes the sole execution surface, simply moving all APIs directly onto it would create an unwieldy and semantically flat implementation.Instead, Phase 1.4 introduces small, semantically grouped facades owned by
TransactionContext.These facades:
MAP operations fall into three semantic domains:
This separation is forward-looking:
mutation()aligns with futureMutationCommandlookup()preserves indexed reads distinct from future graph-native queryingThe public execution shape after Phase 1.4 becomes:
This structure anticipates future
graph()support without requiring further refactoring.4.1 Make
TransactionContextthe sole transaction-scoped execution surfaceAfter Phase 1.4:
HolonsContextBehaviorTransactionContextNursery,TransientHolonManager, etc.) remain internal implementation details4.2 Lifecycle stays on the root
Remain inherent methods on
TransactionContext:tx_id()lifecycle_state()is_open()commit()Future lifecycle operations (e.g.,
rollback()) also live here.Lifecycle methods apply only to an already-begun transaction.
4.3 Introduce
mutation()facadeGrouped under:
Includes:
load_holonsProperties:
4.4 Introduce
lookup()facadeGrouped under:
Includes:
get_all_holonsProperties:
4.5 Explicitly reserve future graph-native surface
Phase 1.4 does not introduce
graph().However, the facade structure allows future addition of:
without restructuring execution semantics.
Indexed lookup and graph-native querying remain conceptually distinct.
4.6 Absorb
HolonOperationsApiAll functions currently in
HolonOperationsApi:TransactionContextmutation()lookup()No execution-facing APIs remain outside
TransactionContext.4.7 Keep managers internal
The following remain internal collaborators:
NurseryTransientHolonManagerHolonServiceApiHolonCacheAccessThey do not:
Execution semantics are enforced only at the
TransactionContextlevel.4.8 Review
TransactionManager(Owned by Space Manager)What we need is:
This is governance, not construction.
Responsibilities include:
4.8.1 Architectural Role of
TransactionManagerTransactionManager:HolonSpaceHolonSpaceManagerbegin_transaction()begin_transaction_with_id(tx_id)get_transaction(tx_id)Transactions are owned by whoever holds
Arc<TransactionContext>.4.8.2 Clarified Role of
HolonSpaceManagerHolonSpaceManageris:It is not:
It exposes
TransactionManagerfor lifecycle entry:This makes lifecycle commands clearly space-scoped and outside any existing transaction context.
4.8.3 Execution Boundary Clarification
After Phase 1.4:
Transaction lifecycle entry (
open_transaction) is:TransactionManagerTransactionContextTransaction lifecycle state transitions (
commit, futurerollback) are:TransactionContextThis cleanly separates:
5. Scope and Impact (Required)
Impacted areas:
HolonsContextBehaviorTransactionContextFactoryconceptNot impacted:
This is a large but mostly mechanical refactor guided by an already-established execution model.
6. Testing Considerations (Required)
HolonsContextBehaviorTransactionContextTransactionManagerHolonSpaceManager→TransactionManager→TransactionContext7. Definition of Done (Required)
This enhancement is complete when:
HolonsContextBehavioris removed from public APIs&dyn HolonsContextBehaviorHolonOperationsApiis removedTransactionContextexposes:mutation()lookup()mutation()lookup()TransactionManager