-
Notifications
You must be signed in to change notification settings - Fork 17
Move OpenHuman flow logic and tests upstream: deserialize_graph, compat and gate coverage #96
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
base: main
Are you sure you want to change the base?
Changes from all commits
2fad06e
02d6bd1
51927c6
7727cd9
a877b22
90945cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -481,3 +481,76 @@ fn a_nested_path_under_an_envelope_accessor_is_accepted() { | |
|
|
||
| assert!(failures(&graph).is_empty(), "{:?}", failures(&graph)); | ||
| } | ||
|
|
||
| // ---- prompts that are real jq, and literal args ---- | ||
| // | ||
| // Ported from OpenHuman's host-side gate tests, which pinned these scenarios | ||
| // through a wrapper around this module. | ||
|
Comment on lines
+485
to
+488
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This new section takes AGENTS.md reference: AGENTS.md:L3-L5 Useful? React with 👍 / 👎. |
||
|
|
||
| #[test] | ||
| fn a_jq_string_concatenation_prompt_is_accepted() { | ||
| let graph = graph(json!([ | ||
| { "id": "greet", "kind": "agent", "name": "Greet", | ||
| "config": { "prompt": "=\"Hi \" + .item.name" } }, | ||
| ])); | ||
|
|
||
| assert!(failures(&graph).is_empty(), "{:?}", failures(&graph)); | ||
| } | ||
|
|
||
| /// Regression for the quote-toggle desync: an escaped quote inside a jq string | ||
| /// literal must not flip the string-stripping pass's in-string state, or the | ||
| /// text between the escaped and the closing quote leaks out as bare code and | ||
| /// trips the prose heuristic. | ||
| #[test] | ||
| fn an_escaped_quote_inside_a_jq_string_is_not_mistaken_for_prose() { | ||
| let graph = graph(json!([ | ||
| { "id": "greet", "kind": "agent", "name": "Greet", | ||
| "config": { "prompt": "=\"Say \\\"hello world\\\" nicely\" + .item.name" } }, | ||
| ])); | ||
|
|
||
| assert!(failures(&graph).is_empty(), "{:?}", failures(&graph)); | ||
| } | ||
|
|
||
| #[test] | ||
| fn literal_tool_args_are_not_inspected() { | ||
| let graph = graph(json!([ | ||
| { "id": "post", "kind": "tool_call", "name": "Post", | ||
| "config": { "slug": "SLACK_SEND_MESSAGE", | ||
| "args": { "channel": "general", "count": 3, "cc": ["a@b.com"] } } }, | ||
| ])); | ||
|
|
||
| assert!(failures(&graph).is_empty(), "{:?}", failures(&graph)); | ||
| } | ||
|
|
||
| #[test] | ||
| fn a_binding_to_a_schema_less_agent_is_unverifiable_not_refused() { | ||
| let graph = graph(json!([ | ||
| { "id": "summarize", "kind": "agent", "name": "Summarize", | ||
| "config": { "agent_ref": "researcher", "prompt": "summarize" } }, | ||
| { "id": "post", "kind": "tool_call", "name": "Post", | ||
| "config": { "slug": "SLACK_SEND_MESSAGE", | ||
| "args": { "channel": "=nodes.summarize.item.json.channel" } } }, | ||
| ])); | ||
|
|
||
| assert!(failures(&graph).is_empty(), "{:?}", failures(&graph)); | ||
| } | ||
|
|
||
| /// Skipping `.json` is refused even when the agent declares a matching schema: | ||
| /// the fault is the envelope, not the field inside it. | ||
| #[test] | ||
| fn skipping_the_envelope_is_refused_even_when_the_schema_matches() { | ||
| let graph = graph(json!([ | ||
| { "id": "summarize", "kind": "agent", "name": "Summarize", | ||
| "config": { "prompt": "summarize", | ||
| "output_parser": { "schema": { "type": "object", | ||
| "properties": { "channel": { "type": "string" } } } } } }, | ||
| { "id": "post", "kind": "tool_call", "name": "Post", | ||
| "config": { "slug": "SLACK_SEND_MESSAGE", | ||
| "args": { "channel": "=nodes.summarize.item.channel" } } }, | ||
| ])); | ||
|
|
||
| let failures = failures(&graph); | ||
| assert_eq!(failures.len(), 1, "{failures:?}"); | ||
| assert!(failures[0].contains("json"), "{failures:?}"); | ||
| assert!(failures[0].contains("summarize"), "{failures:?}"); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added block grows
compat_tests.rsfrom 241 to 529 physical lines, exceeding the repository's mandatory 500-line cap. Move these compatibility scenarios into a smaller responsibility-focused_tests.rsmodule instead of extending this file.AGENTS.md reference: AGENTS.md:L3-L5
Useful? React with 👍 / 👎.