fix(tokens): name the request as the source of its built-in tokens
CI / installer (macos-14) (pull_request) Successful in 3s
CI / check (pull_request) Successful in 27s
CI / starter (bun) (pull_request) Successful in 30s
CI / starter (deno) (pull_request) Successful in 31s
CI / starter (edge) (pull_request) Successful in 36s
CI / core-freshness (pull_request) Has been skipped
CI / installer (ubuntu-latest) (pull_request) Successful in 13s
CI / starter (node) (pull_request) Successful in 33s

matcha tokens listed req as '— (nothing provides it)'. An agent reading
that would write a provider for req. A needed token with no producing
node must come from the request (req, params, body, …): app.ready() has
already validated the graph, so a truly missing token would have failed
it. Mark those source: "request" in the JSON and 'the request (built
in)' in the text.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-10-30 10:54:29 -05:00
1 parent a4827f2e13
commit 9acb0b34c9
2 files changed
+21 -1

No files matched your search

+14 -1
View File
@@ -220,7 +220,11 @@ fn tokens_text(data: &Value) -> String {
"{}\n provided by: {}\n needed by: {}",
str_of(&t["token"]),
if provided.is_empty() {
"— (nothing provides it)"
if t["source"] == "request" {
"the request (built in)"
} else {
"— (nothing provides it)"
}
} else {
&provided
},
@@ -287,6 +291,15 @@ mod tests {
);
}
#[test]
fn tokens_text_names_the_request_for_its_built_in_tokens() {
let data = json!([{ "token": "req", "source": "request", "providedBy": [], "neededBy": [{ "kind": "step", "name": "user" }] }]);
assert_eq!(
tokens_text(&data),
"req\n provided by: the request (built in)\n needed by: user"
);
}
#[test]
fn tokens_text_says_when_nothing_provides_a_token() {
let data = json!([{ "token": "user", "providedBy": [], "neededBy": [{ "kind": "handler", "name": "Me.get", "route": "/me" }] }]);