Sprint 5 - Mischief Happens

This week I did some more incremental work on Hurl, finalizing the redirects query. On Startchart, I messed up a couple of things, fixed a couple of things and learned a couple of lessons! Hurl Add query for HTTP redirects (Link) Last week, I enabled the code to pass down necessary information about HTTP redirections to queries. Continuing on that, I've been working on the redirects query itself. Going back to the expected behavior proposed by the maintainer: GET http://foo.com HTTP 200 [Asserts] redirects count == 2 redirects nth 0 url == "http://bar.com" redirects nth 0 status == 302 redirects nth 1 url == "http://baz.com" redirects nth 1 status == 302 url == "http://baz.com" The query is treated like a list, you can perform assertions on the list itself, or get the individual HTTP redirect by index, and then assert on that. Looking at the code one more time, they already had a Value::List(Vec) variant, and queries like count and nth were already implemented, so all I had left to do was to create another Value variant for HTTP redirection. // `runner::HttpResponse` // Name suggested by the maintainer pub struct HttpResponse { url: http::Url, status: u32, } and then pub enum Value { ... HttpResponse(runner::HttpResponse), ... } And then came my favorite part about working in Rust, which was when the compiler told me everywhere else that needs to be changed. For the evaluation method itself, a.k.a. the place where everything came together, I processed the passed-down responses into runner::HttpResponse. I popped the final response which was not considered a redirect. And finally, I constructed them into a Value::List. Here's the result: fn eval_redirects(responses: &[&http::Response]) -> QueryResult { let mut values: Vec = responses .iter() .map(|r| Value::HttpResponse(HttpResponse::new(r.url.clone(), r.status))) .collect(); values.pop(); Ok(Some(Value::List(values))) } Startchart Some package-lock.json Shenanigans Never merge anything without testing first. Last week, I merged a PR from my co-maintainer Uday. I didn't think it needed more testing since I had already reviewed it before, and there was only a rebase since then. Plus, the CI pipelines were all green. Only after that did I realize, although the production build worked just fine, I couldn't run the dev build anymore. There were errors about missing dependencies: ... node:internal/modules/cjs/loader:1244 const err = new Error(message); ^ Error: Cannot find module 'colorspace' ... I made a new clone of the project and set up everything from scratch. Still the same result. I messaged Uday to confirmed it. And or course, it worked on his machine

Mar 27, 2025 - 15:42
 0
Sprint 5 - Mischief Happens

This week I did some more incremental work on Hurl, finalizing the redirects query. On Startchart, I messed up a couple of things, fixed a couple of things and learned a couple of lessons!

Hurl

Add query for HTTP redirects (Link)

Last week, I enabled the code to pass down necessary information about HTTP redirections to queries. Continuing on that, I've been working on the redirects query itself.

Going back to the expected behavior proposed by the maintainer:

GET http://foo.com
HTTP 200
[Asserts]
redirects count == 2
redirects nth 0 url == "http://bar.com"
redirects nth 0 status == 302
redirects nth 1 url == "http://baz.com"
redirects nth 1 status == 302
url == "http://baz.com"

The query is treated like a list, you can perform assertions on the list itself, or get the individual HTTP redirect by index, and then assert on that.

Looking at the code one more time, they already had a Value::List(Vec) variant, and queries like count and nth were already implemented, so all I had left to do was to create another Value variant for HTTP redirection.

// `runner::HttpResponse`
// Name suggested by the maintainer 
pub struct HttpResponse {
    url: http::Url,
    status: u32,
}

and then

pub enum Value {
    ...
    HttpResponse(runner::HttpResponse),
    ...
}

And then came my favorite part about working in Rust, which was when the compiler told me everywhere else that needs to be changed.

For the evaluation method itself, a.k.a. the place where everything came together, I processed the passed-down responses into runner::HttpResponse. I popped the final response which was not considered a redirect. And finally, I constructed them into a Value::List. Here's the result:

fn eval_redirects(responses: &[&http::Response]) -> QueryResult {
    let mut values: Vec<Value> = responses
        .iter()
        .map(|r| Value::HttpResponse(HttpResponse::new(r.url.clone(), r.status)))
        .collect();
    values.pop();
    Ok(Some(Value::List(values)))
}

Startchart

Some package-lock.json Shenanigans

Never merge anything without testing first.

Last week, I merged a PR from my co-maintainer Uday. I didn't think it needed more testing since I had already reviewed it before, and there was only a rebase since then. Plus, the CI pipelines were all green.

Only after that did I realize, although the production build worked just fine, I couldn't run the dev build anymore. There were errors about missing dependencies:

...
node:internal/modules/cjs/loader:1244
  const err = new Error(message);
              ^

Error: Cannot find module 'colorspace'
...

I made a new clone of the project and set up everything from scratch. Still the same result. I messaged Uday to confirmed it. And or course, it worked on his machine