Skip to content

[refactor]: introduce a 'HostContext' for exposing host info through tree #325

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

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

jamieQ
Copy link
Contributor

@jamieQ jamieQ commented Mar 12, 2025

  • introduce a HostContext type to hold 'host-level' information to be distributed to various entities throughout the workflow tree
  • currently it holds the two optional top-level injected properties: 'observers' and the 'debugger'
  • in the future i expect this to be useful for propagating additional top-level configuration information downward (e.g. new runtime behavior options), as well as offering a convenient means for communicating back to the 'root' in some circumstances (e.g. recording nodes that changed when applying actions)

note: no new tests added as no new functionality introduced yet

@jamieQ jamieQ changed the title [refactor]: introduce a 'HostContext' for exposing host info through … [refactor]: introduce a 'HostContext' for exposing host info through tree Mar 12, 2025
@jamieQ jamieQ marked this pull request as ready for review March 12, 2025 03:16
@jamieQ jamieQ requested a review from a team as a code owner March 12, 2025 03:16
@@ -194,7 +202,7 @@ extension WorkflowNode.SubtreeManager {
let eventPipe = EventPipe()
eventPipes.append(eventPipe)

/// See if we can
/// See if we can reuse an existing child node for the given key.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this truncated sentence has bothered me for a long time – i think this is probably what it was going to


/// A context object to expose certain root-level information to each node
/// in the Workflow tree.
final class HostContext {
Copy link
Collaborator

Choose a reason for hiding this comment

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

class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, are you asking why is it a class? assuming 'yes', then it's because i think we will eventually want to allow different parts of the tree to be able to mutate some of its properties and have those changes be visible elsewhere. e.g. you're handling an action and want to remember that 'some node in the tree was invalidated' by the time the root/host has to do the next render.

@jamieQ jamieQ force-pushed the jquadri/host-context branch from 0703d92 to 1355990 Compare March 12, 2025 18:20
@jamieQ jamieQ merged commit e9f82d1 into main Mar 12, 2025
7 checks passed
@jamieQ jamieQ deleted the jquadri/host-context branch March 12, 2025 21:19
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.

None yet

4 participants