Skip to content

[NEAT-874] 🔨 Interface for state #1077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

doctrino
Copy link
Collaborator

@doctrino doctrino commented Apr 1, 2025

Description

Context: This is the first in a series of planned PRs. It is currently unused code as it is not yet complete.

Overall goal: The NeatSession is one of two planned user interfaces. Currently, there is some logic in the interface that needs to be moved out. The most significant logic is the state that guards the state transitions. Through a series of PRs the goal is to replace the NeatSession state with this NeatState.

This PR: Creates the scaffolding for the new NeatState class. In addition, I have implemented a state pattern to guard the transition between four states with basic testing.

Bump

  • Patch
  • Minor
  • Skip

Copy link

github-actions bot commented Apr 1, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
15394 12398 81% 80% 🟢

New Files

File Coverage Status
cognite/neat/_state/init.py 100% 🟢
cognite/neat/_state/_base.py 78% 🟢
cognite/neat/_state/_state.py 76% 🟢
cognite/neat/_state/_types.py 100% 🟢
cognite/neat/_state/exception.py 100% 🟢
TOTAL 91% 🟢

Modified Files

File Coverage Status
cognite/neat/_graph/transformers/init.py 100% 🟢
TOTAL 100% 🟢

updated for commit: 0e5a43f by action🐍

@doctrino doctrino force-pushed the introduce-neat-state branch from e5c8807 to 6d56817 Compare April 2, 2025 10:16
@doctrino doctrino force-pushed the introduce-neat-state branch from 7c4629f to 8401a25 Compare April 2, 2025 11:11
@doctrino doctrino marked this pull request as ready for review April 2, 2025 11:27
@doctrino doctrino requested a review from a team as a code owner April 2, 2025 11:27
Copy link
Collaborator

@nikokaoja nikokaoja left a comment

Choose a reason for hiding this comment

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

Would help with flow and state diagram

raise NotImplementedError()

@abstractmethod
def next_state(self, action: Action) -> "State":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Next state is telling you what is possible next state or ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, it is transitioning to the next state.

doctrino added a commit that referenced this pull request Apr 7, 2025
# Description

This is part of a refactoring to NeatState, #1077. This modifies the
`.transform()` method of `NeatGraphStore` to return an `IssueList`. The
motivation for this is that this should comply with the other action
methods `NeatRuleStore.import_rules/transform()` and
`NeatGraphStore.write` that already return an `IssueList`. In addition,
it now returns an error if the graph transformation failed. This is
important as a failed transformation execution should not lead to a
state change.

## Bump

- [ ] Patch
- [ ] Minor
- [x] Skip
@nikokaoja nikokaoja requested a review from a team April 24, 2025 10:36
@doctrino doctrino enabled auto-merge (squash) April 25, 2025 08:56
@doctrino doctrino added the waiting-for-risk-review Waiting for a member of the risk review team to take an action label Apr 25, 2025
Copy link
Collaborator

@nikokaoja nikokaoja left a comment

Choose a reason for hiding this comment

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

rename action to activity to be in sync with provenance

@nikokaoja nikokaoja removed the request for review from a team April 25, 2025 11:04
"""Returns the display name of the current state."""
return self._state.display_name

def change(self, action: Action) -> IssueList:
Copy link
Collaborator

@nikokaoja nikokaoja Apr 25, 2025

Choose a reason for hiding this comment

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

This is change in terms of what we define as change in Provenance, therefore, your argument is not action, but Agent (extractor, loader, transformer) that is configured to perform certain Activity, so this should be called activity not action

@doctrino doctrino removed the waiting-for-risk-review Waiting for a member of the risk review team to take an action label Apr 25, 2025
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.

2 participants