✓
Passing This code compiles and runs correctly.
Code
// PINS: a `for` template inside an orisha:router arm resolves its
// `__koru_inline_scoped_N(arg)` effect splice and its `done`
// `__koru_continue_N` marker on the string-codegen path — the same
// contract 350_026 pins for `if`, here covering the arg-carrying
// splice the effect-branch engine mints for `! each`.
~import orisha
~import std/io
const req_hit = "GET /t HTTP/1.1\r\n\r\n";
var exchange_hit = koru_orisha.koru_pump.Exchange{ .fd = 0, .raw = req_hit };
const req_loop = "GET /loop HTTP/1.1\r\n\r\n";
var exchange_loop = koru_orisha.koru_pump.Exchange{ .fd = 0, .raw = req_loop };
~orisha:handler = orisha:router(req)
! [GET /t] -> { status: 200, body: "t", content_type: "text/plain" }
! [*] |> for("ab")
! each i |> std/io:print.ln("tick")
| done -> { status: 404, body: "looped", content_type: "text/plain" }
// [GET /t] is request-free — the router collects literal '->' arms into
// handler-lite and a lite hit ships the complete pre-rendered response
// wire-carried — since orisha 06d2b61 the whole message rides in .body (allocated renders free once via release-body), so this answer reads a.body.
~orisha:answer(x: &exchange_hit): a |> std/io:print.ln("{{ a.body:s }}") |> orisha:release-body(a.body, allocated: a.body_allocated)
~orisha:answer(x: &exchange_loop): b |> std/io:print.ln("{{ b.body:s }}") |> orisha:release-body(b.body, allocated: b.body_allocated)
Actual
HTTP/1.1 200 OK
Content-Length: 1
Content-Type: text/plain
X-Powered-By: koru/orisha
X-Orisha: reactor
t
tick
tick
looped
Expected output
HTTP/1.1 200 OK
Content-Length: 1
Content-Type: text/plain
X-Powered-By: koru/orisha
X-Orisha: reactor
t
tick
tick
looped
Flows
subflow ~handler click a branch to expand · @labels scroll to their anchor
router (req)
flow ~answer click a branch to expand · @labels scroll to their anchor
answer (x: &exchange_hit)
flow ~answer click a branch to expand · @labels scroll to their anchor
answer (x: &exchange_loop)
Test Configuration
MUST_RUN
koru.json:
{
"name": "router_for_template_arm",
"version": "0.1.0",
"paths": {
"std": "../../../../../koru_std",
"orisha": "../../../../../../orisha/lib"
}
}