Skip to content

Enhance Commit Outcomes to Include map from StagedHolon's TemporaryId to HolonId #352

@evomimic

Description

@evomimic

This enhancement is ON HOLD.

A very different alternate design is being considered.

1. Summary (Required)

What is the enhancement?
Refactor the commit() function to replace the SavedHolons and AbandonedHolons relationships in the CommitResponse holon with a unified CommitOutcomes relationship. This relationship will point to a set of CommitMap holons, each representing the outcome of a commit attempt for a single StagedHolon.


2. Problem Statement (Required)

Why is this needed?
The current structure splits committed holons into separate SavedHolons and AbandonedHolons relationships. This model is insufficient for capturing richer commit metadata, such as the originating TemporaryId, the specific outcome (e.g., previously committed or failed), and fine-grained tracking of what happened per holon.

Additionally, the current design includes an outdated behavior that misinterprets Abandoned as a system-derived failure rather than a user-declared state. In the latest implementation, commit() no longer receives abandoned holons—thus making Abandoned an invalid outcome. Retaining this logic introduces confusion and incorrect categorization of errors.


3. Dependencies (Required)

Does this depend on other issues or features?

  • None immediately blocking this work, but:
    • Future enhancements may include moving error tracking from StagedHolon to CommitMap.
    • This change will require updates to any downstream logic or client interfaces that read from the old relationships (SavedHolons, AbandonedHolons).

4. Proposed Solution (Required)

How would you solve it?

  • Introduce a new CommitMap holon type.

  • Modify the commit() function to build one CommitMap holon per StagedReference, each with the following properties:

    • StagedTemporaryId → the holon's original TemporaryId.
    • CommitOutcome → one of:
      • "Saved": commit succeeded or was previously saved.
      • "Error": commit failed.
    • SavedHolonId → the resulting HolonId (only if outcome was "Saved").
  • Attach all CommitMap holons to the CommitResponse via the new CommitOutcomes relationship.

  • Remove all references to AbandonedHolons and SavedHolons relationships in this context.

  • Update logic to treat NoAction as a successful save (i.e., "Saved" outcome).

  • If commit_holon() returns Abandoned, treat this as a developer error (HolonError) since no abandoned holons should be passed in anymore.

Supporting Type System Changes

To support this model, we also need to extend the core value and property types:

  • Extend the BaseValue enum to include a new variant:

    MapBytesValue(MapBytes)
  • Implement ToBaseValue for MapBytesValue:

    impl ToBaseValue for MapBytesValue {
        fn to_base_value(self) -> BaseValue {
            BaseValue::MapBytesValue(self)
        }
    }
  • Define Uuid as a ValueType that maps to MapBytesValue as its BaseValue.

  • Ensure Uuid is used as ValueType for TemporaryId and HolonId when storing them as property values.

  • Register new type names in the relevant core enums:

    • CoreHolonTypeName:
      • CommitMap
    • CorePropertyTypeName:
      • StagedTemporaryId
      • SavedHolonId
      • CommitOutcome
    • CoreValueTypeName:
      • Uuid
      • CommitOutcomeEnum

These changes ensure that UUIDs are stored and typed correctly, and that the resulting CommitMap holons are fully representable and queryable within the MAP holonic system.


5. Scope and Impact (Required)

What does this impact?

  • Changes the schema and output structure of the CommitResponse holon.
  • Affects guest modules and clients that previously consumed SavedHolons / AbandonedHolons.
  • Requires updates to tests, UI logic, and any validation scripts relying on the old structure.
  • Clarifies the semantics of Abandoned by removing it from system-assigned commit outcomes.

6. Testing Considerations (Required)

How will this enhancement be tested?

  • Unit Tests

    • Ensure that for every staged holon committed, a corresponding CommitMap is created.
    • Validate that correct outcomes (Saved, Error) and HolonIds are assigned.
  • Integration Tests

    • Validate full commit() runs with mixed outcomes, ensuring the CommitResponse holon is populated correctly.
    • Confirm that no Abandoned responses are ever returned or processed.
  • Regression Testing

    • Ensure that behavior for already committed holons (NoAction) continues to result in valid Saved entries.
    • Ensure no logic depends on the old SavedHolons or AbandonedHolons relationships.

7. Definition of Done (Required)

When is this enhancement complete?

  • CommitMap holon type is defined with appropriate properties.
  • commit() returns CommitResponse holon with CommitOutcomes relationship populated.
  • Old SavedHolons and AbandonedHolons relationships are removed from the CommitResponse.
  • commit_holon() returns HolonError if Abandoned is encountered.
  • Test suite is updated to reflect and validate new behavior.
  • Client or UI consumers are updated to consume CommitOutcomes instead of old relationships.

Optional Details (Expand if needed)

8. Alternatives Considered

What other solutions did you think about?

  • Continuing to track saved and abandoned holons separately—but this would complicate tracking per-holon metadata (e.g., commit errors, original TemporaryId).
  • Embedding the outcome data in properties of the CommitResponse holon itself—rejected due to lack of granularity and difficult lookup.

9. Risks or Concerns

What could go wrong?

  • Client code not updated in sync may break if it expects old relationships.
  • Failing to properly identify and handle NoAction or previous-commit states could cause incorrect or missing entries in CommitOutcomes.
  • Migration path for existing CommitResponse holons (if persisted long-term) needs to be considered.

10. Additional Context

Any supporting material?

  • Internal discussion of Abandoned as a user-driven, not system-driven, state.
  • GitHub Issue 352: Align commit outcomes with MAP's new data model expectations.
  • Longer-term consideration: Centralizing commit errors into CommitMap instead of StagedHolon.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requeston holdOn hold due to unsatisfied dependencies

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions