Skip to content
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

[Bug] [Jac Cloud] With Entry / Exit Ability does not follow Jaclang #1346

Closed
ChrisIsKing opened this issue Oct 7, 2024 · 2 comments · May be fixed by #1354
Closed

[Bug] [Jac Cloud] With Entry / Exit Ability does not follow Jaclang #1346

ChrisIsKing opened this issue Oct 7, 2024 · 2 comments · May be fixed by #1354
Assignees
Labels
jac cloud Issues related to the jac-cloud package jivas Issues of high priority to the Jivas Product

Comments

@ChrisIsKing
Copy link
Collaborator

Describe the bug

The behavior of the with entry and with exit abilities in walkers is inconsistent between jac-cloud when running with jac serve and core JacLang using jac run. Specifically, in core JacLang, the with exit ability is executed only once at the end of the walker's walk, while in jac-cloud (when using jac serve), the with exit ability triggers on every node exit.

To Reproduce

  1. Install jac-cloud
  2. Run the following example in both JacLang (jac run) and jac-cloud (jac serve):
node test_node {
    has value: int = 0;
}

walker create_node {
    has value: int;

    obj __specs__ {
        static has auth: bool = False;
    }

    can create_node with `root entry {
        root ++> (node_obj:=test_node(value=self.value));
        print(jid(node_obj));
        report node_obj;
    }
}

walker fetch_node {
    has node_id: str;

    obj __specs__ {
        static has auth: bool = False;
    }

    can fetch_node with `root entry {
        # grab the node with the given id
        node_obj = &self.node_id;
        report node_obj;
    }
}

walker test_walker {
    has visited_nodes: list = [];

    obj __specs__ {
        static has auth: bool = False;
    }

    can traverse with `root entry {
        visit [-->];
    }

    can log_visit with object exit {
        self.visited_nodes.append(here);
    }

    can print_visited_nodes with exit {
        print(self.visited_nodes);
    }
}

In both JacLang and Jac Cloud, the with exit ability should execute only once, at the end of the entire walker execution, not after each node exit. This ensures consistent behavior, where the final state of the walker (e.g., visited_nodes) is processed and output at the end of the walker's walk.

@ChrisIsKing ChrisIsKing added jac cloud Issues related to the jac-cloud package jivas Issues of high priority to the Jivas Product labels Oct 7, 2024
@amadolid
Copy link
Collaborator

amadolid commented Oct 9, 2024

Hello @ypkang , @ChrisIsKing ,

Please let me know your thoughts about this PR
#1354

@amadolid amadolid linked a pull request Oct 10, 2024 that will close this issue
@ChrisIsKing
Copy link
Collaborator Author

Closing issue. Fixed in PR #1353.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jac cloud Issues related to the jac-cloud package jivas Issues of high priority to the Jivas Product
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants