Closed evomimic closed 1 month ago
@evomimic What is the associated ResponseStatusCode for HolonError::NotAccessible
@evomimic What is the associated ResponseStatusCode for HolonError::NotAccessible
NotAuthorized
@evomimic What is the associated ResponseStatusCode for HolonError::NotAccessible
NotAuthorized @evomimic confirm: 401 - Unauthorized
I also see in the issue checklist, under dance_response.rs file it says to map to BadRequest, should it instead be Unauthorized? Is spelling correct or should the A be capital?
Yea. I noticed that also after sending my reply. Probably BadRequest is better. NotAuthorized typically refers to a permissions issue.
@evomimic how to ensure relationship is populated?
@dauphin3 : Hmmm... right. I don't think that will be possible until we implement #84. Currently, holon's try_from_node
function is not loading the relationship_map
(and we probably don't want to until we have RelationshipDescriptor's to guide the process). So there is not currently any way to tell which relationships have been populated.
Summary
This enhancement adds the _abandon_staged_changes_ dance to the Uniform API. This dance marks a staged_holon as
Abandoned
. Staged holons markedAbandoned
are simply ignored during commit processing -- they are not saved to the persistent store. Once a staged_holon has been abandoned, further attempts to access the holon will return a (newly introduced)NotAccessible
error.Current State:
There is no native functionality that supports this function.
However, some existing native functionality needs to modified:
Proposal
Enhance Native Holons Functionality
_In the
holon_error.rs
file within the Holons zome:_NotAccessible
error to theHolonError
enum to report access violationsIn the
holon.rs
file within the Holons zome:Abandoned
variant toHolonState
and extend the implementation of the fmt function to cover this variantabandon_staged_changes
method that sets holon's state toAbandoned
Abandoned
semantics.is_accessible(access_type: AccessType)->Result<_,HolonError>
helper function, whereThis function should return
Ok
if the requestedaccess_type
is allowed given the current state of the holon. Otherwise, return aNotAccessible
error.is_accessible(Read)
and a Write Guard_ refers to a call onis_accessible(Write)
.Read Guard
Write Guard
Write Guard
_In the
staged_reference.rs
file within the Holons zome:_abandon_staged_changes
method that gets a borrowed mut reference to its holon and then delegates the call to it._In the
commit_manager.rs
file:_[x] Enhance to_staged_reference to return a NotAccessible error on attempts to get a StagedReference from a StagedIndex if the referenced holon is in an Abandoned state.
[x] Enhance the definition of CommitResponse to reflect the possible presence of Abandoned.
[x] Enhance the commit() method's handling of the result of each holon's commit to add the Holon to the appropriate vector in the CommitResponse.
Dance Enhancements
_In the holon_dance_adapter.rs file:_
abandon_staged_changes
is a mutator, it's DanceRequest should be of typeCommand
with its staged_holon's index passed via the Command'sStagedIndex
element. It should delegate the call to the StagedReference'sabandon_staged_changes
methodbuild_abandon_staged_changes_dance_request
as a CommandMethodIn the dancer.rs file:
NotAccessible
to theprocess_dispatch_result
function._In the dance_response.rs file:_
NotAccessible
HolonError toBadRequest
to theFrom<HolonError> for ResponseStatusCode
implementationTesting Enhancements
New files:
_In the test_data_types.rs file:_
AbandonStagedChanges
as a variant in theDanceTestStep
enum definition_In the dance_fixture.rs file:_
abandon_staged_changes
test case._In the dance_tests.rs file:_
AbandonStagedChanges
stepDefinition of Done:
abandon_staged_holons_test
, test case passes