Skip to content

Lasm 0.3.9

Choose a tag to compare

@github-actions github-actions released this 03 Nov 06:54
· 1722 commits to main since this release
1a60c2c

Lasm 0.3.9

A bug-fix release. Upgrade with npm install -D @lasm/cli@0.3.9.

Fixes

  • Request.path resolves . and .. the same way on every platform (#27).

    • The bug: before 0.3.9, whether /hello/../hello/Ada reached a Lasm.Fetch handler as written or already resolved depended on the platform.
    • The fix: req.path is now resolved the way a browser resolves a URL path (the WHATWG URL rules), on every platform:
      • /hello/../hello/Ada is /hello/Ada;
      • escaped dots (%2e, %2E) count as dots;
      • \ counts as /;
      • a .. above the root stays at the root.
    • The proof: req.segments never contains . or ... Lean checks this as Request.segments_no_dot_segments, so a handler that maps segments to files or keys can't reach a parent.
    • Tests: the target-equivalence corpus has new cases for encoded, mixed and above-root dot segments and for backslashes. The cases run on every target.
    • See FETCH.md.
  • A :// in the query no longer breaks routing (#76). A request such as /authorize?redirect_uri=http://localhost/cb, with an unencoded URL in its query, had its whole URL read as the path, so no route matched. The path is now taken before the query and fragment. Lasm.Fetch checks this with build-time tests, and the target-equivalence corpus has a new case for it. Found while building the Porter example app.

  • Cookies and redirects on the function platforms (#80, #82).

    • Request cookies: a request's cookies now reach Lean as one Cookie header, joined with ; , on every server target. Before, Lambda's HTTP API sent the header twice, and Azure joined repeated lines with commas.
    • Azure: every Set-Cookie header of a reply now arrives. Before, only one did. Azure's host still alters a value outside A-Z a-z 0-9 - . _ ~ in all but one cookie per reply (azure-functions.md).
    • Netlify: a redirect with an empty body, such as a 303 after sign-in, now arrives with its Location and cookies. Before, it arrived as an empty 200.
    • How they were found: the Porter example app. A new serverless-adapters.yml workflow checks each platform's own local runtime.
  • Deep recursion goes about 16 times deeper on Node (#66).

    • Before: non-tail recursion stopped with "Stack overflow detected" after about 640,000 frames, where native Lean reaches about 13 million.
    • Now: Lean threads under Node get a 1 GiB stack by default, so the limit is about 10 million frames on Linux and macOS.
      • The default is capped at a quarter of the machine's or container's memory, so a 128 MB Lambda keeps 64 MiB.
      • Windows defaults to 256 MiB, about 2.5 million frames.
      • LASM_VM_STACK_MB still overrides the default.
    • The overflow message: it still exits with status 134, as native Lean does, and now says which stack ran out and how to raise it or rewrite the function.
    • Other targets: the WASI, edge and browser limits are set by the host engine, so they are unchanged. They are documented in FUNDAMENTAL_LIMITATIONS.md.
    • Tests: a new depth check runs on every PR, for every target, on Linux, macOS and Windows.
  • Lasm.JS errors are no longer wrapped twice (#51). Two kinds of failure reached Lean as Error: TypeError: … instead of TypeError: …:

    • a settled JavaScript value that couldn't be converted;
    • an awaited promise that rejected with a Lasm.JS error.

    Fixed on Node and on the edge targets. Found by mutation testing.

  • The dev build service lets the process exit (#49). createBuildService({ unref: true }), which the Vite plugin uses, kept Node running after the work finished. Found by mutation testing.

Testing (no change to how programs build or run)

  • Mutation testing (Stryker) of the critical JavaScript: the host bridge, the Lasm.UI applier, the build service, the edge glue, notices, the link driver and the target links.
    • Every module now scores above 80%.
    • CI fails if a score drops.
    • Scores and method are in TESTING.md.
  • Two more example apps, each with proofs and outside checks:
    • Ledger follows TigerBeetle's data model. TigerBeetle itself is the differential oracle.
    • Folio, a Markdown site generator, passes the CommonMark spec suite and matches commonmark.js byte for byte.
  • Conduit:
    • Concurrent reads no longer see half-done writes on Node and Bun (#59).
    • Its two recorded gaps are fixed and proved.