Skip to content

Bump dependencies to latest major versions#14

Merged
JonasGruenwald merged 8 commits into
JonasGruenwald:mainfrom
vshakitskiy:main
Oct 17, 2025
Merged

Bump dependencies to latest major versions#14
JonasGruenwald merged 8 commits into
JonasGruenwald:mainfrom
vshakitskiy:main

Conversation

@vshakitskiy
Copy link
Copy Markdown
Contributor

Closes #13.

Additionally, carpenter package has a PR to fit into Gleam's new features. Until that PR is merged, a local package will be within the packages folder.

I ran the playground, and the tool seems to be working. However, some tests unexpectedly receive ProcLib(InitP, 3) messages instead of Erlang(Apply, 2).

@vshakitskiy
Copy link
Copy Markdown
Contributor Author

I think that after certain version, gleam_erlang package updated the way how process are spawned.
gleam_erlang v0.34.0:

@external(erlang, "erlang", "spawn")
fn spawn(a: fn() -> anything) -> Pid

@external(erlang, "erlang", "spawn_link")
fn spawn_link(a: fn() -> anything) -> Pid

gleam_erlang v1.0.0:

@external(erlang, "proc_lib", "spawn_link")
pub fn spawn(running: fn() -> anything) -> Pid

@external(erlang, "proc_lib", "spawn")
pub fn spawn_unlinked(a: fn() -> anything) -> Pid

So yea, the fail on tests are intended, nothing to worry about :D

Comment thread test/internal/api_local_test.gleam
@JonasGruenwald
Copy link
Copy Markdown
Owner

Instead of vendoring carpenter, I would instead suggest to reference Guillaume's fork as a git dependency like so:

carpenter = { git = "https://github.com/ghivert/carpenter.git", ref = "main" }

I might eventually get rid of it, since it's not absolutely needed, but git dep feels a little lighter for me for now.

@vshakitskiy
Copy link
Copy Markdown
Contributor Author

Yep, that's much better

Comment thread src/spectator/internal/components/ets_table_live.gleam Outdated
@JonasGruenwald
Copy link
Copy Markdown
Owner

Thanks for your changes so far!
I'm noticing something strange when testing locally: The server component processes don't seem to get cleaned up, when I repeatedly hit reload on the process list, it looks like this:

Screenshot 2025-10-17 at 00 57 52

I'm not really familiar with the lustre v5 API, so I'm not sure what the issue is, will try to look into it but lmk if you have any ideas

@JonasGruenwald
Copy link
Copy Markdown
Owner

JonasGruenwald commented Oct 16, 2025

According to the docs:

https://hexdocs.pm/lustre/lustre.html#start_server_component

A server component will keep running until the program is terminated or the shutdown action is sent to it.

I think we'll need a shutdown message to the component in the close handler, I'd say like this:

  let socket_close = fn(state: Socket(a)) {
    server_component.deregister_subject(state.self)
    |> lustre.send(to: state.component)

    lustre.shutdown()
    |> lustre.send(to: state.component)
  }

Though it's odd because that's not in the current server component example on the lustre repo.
The examples were just updated now: lustre-labs/lustre@3cb9d0e
So the above is the way to go.

Comment thread src/spectator.gleam
@JonasGruenwald
Copy link
Copy Markdown
Owner

JonasGruenwald commented Oct 17, 2025

Please also set Gleam to 1.12.0 and erlang / otp to 28 in .github/workflows/test.yml and also in mise.toml,
as the newer current versions of packages won't work under the version of Gleam currently specified there, which will cause CI to fail I'm pretty sure.

@vshakitskiy
Copy link
Copy Markdown
Contributor Author

The server components are now cleaning up properly. Thanks for pointing that out!

Copy link
Copy Markdown
Owner

@JonasGruenwald JonasGruenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your help!

@JonasGruenwald JonasGruenwald merged commit f60b653 into JonasGruenwald:main Oct 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bump dependencies to latest major versions

2 participants