Skip to content

zgx: the app starts its engine against the edge ZERON_EDGE_URL names - #1389

Open
alexandre-vl wants to merge 3 commits into
zeronsh:mainfrom
alexandre-vl:zgx-app-follows-engine-edge
Open

alexandre-vl wants to merge 3 commits into
zeronsh:mainfrom
alexandre-vl:zgx-app-follows-engine-edge

Conversation

@alexandre-vl

@alexandre-vl alexandre-vl commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The beta gave the engine it starts production's edge, sign-in client and callback port, whatever the environment said.
    • Take ZERON_EDGE_URL (and ZERON_WORKOS_CLIENT_ID, ZERON_CALLBACK_PORT) naming a self-hosted edge, as zeron itself reads them in crates/cli/src/env.rs.
    • An engine the app started on ~/.zeron loaded the session zeron login had kept there for that edge and handed it to production.
    • Production turned it down, and the engine signed out, deleting session.json.
    • So Zeron 0.3.0 signed a self-hosting user out each time it started the engine.
  • The beta now reads the engine's own variables the way env.rs does: production's, unless they name another edge, client or port. An edge alone keeps production's client and port. Zeron.app's engine is started with those.
  • Unchanged:
    • Nothing of staging's is built in.
    • The development variables (ZERON_ZGX_*) still reach nothing in the beta.
    • The manager still refuses an engine whose edge isn't the one the environment names.
  • auth::production() is now #[cfg(test)]: it has no non-test callers left.
  • Worth a close look: the beta now takes its edge from the process environment. That's the same trust zeron and the engine already place in these variables. The engine-side change, a session used only by the edge that issued it, is engine: a saved session is used only by the edge and client that issued it #1390.

Test plan

  • cargo test --locked --features beta --bin zeron-zgx -- endpoint_tests engine::manager::tests (apps/zgx) on Linux:
    • New: a_beta_build_is_production_unless_the_engines_variables_say and a_beta_build_starts_the_engine_against_the_edge_zeron_s_variables_name. Both pass, and both fail with the beta's endpoint_with put back to production().
    • Existing: a_beta_build_manages_zeron_app_s_engine fails on Linux both before and after this change (manager.rs:482). It writes macOS's engine name, Zeron Engine, beside the executable, while Linux looks for zeron-engine. CI runs apps/zgx's tests without beta, so it never runs there.
  • The same tests as a development build (no beta): 5 passed.
  • cargo clippy --locked --all-targets, with and without beta: no warnings in the files touched.
  • Not done: a packaged beta run end to end against a self-hosted edge.

The beta gave the engine it starts production's edge, sign-in client and
callback port whatever the environment said. With ZERON_EDGE_URL (and
ZERON_WORKOS_CLIENT_ID, ZERON_CALLBACK_PORT) naming a self-hosted edge,
as `zeron` itself reads them, an engine the app started on ~/.zeron
loaded the session `zeron login` had kept there for that edge, handed
it to production, which turned it down, and signed out, deleting it:
Zeron 0.3.0 signed a self-hosting user out each time it started the
engine.

The beta now reads the engine's own variables as crates/cli's env.rs
does: production's unless they name another edge, client or port (an
edge alone keeps production's client and port), and starts Zeron.app's
engine with those. Nothing of staging's is built in, and the
development variables (ZERON_ZGX_*) still reach nothing. The manager
still refuses an engine whose edge isn't the one the environment names.

a_beta_build_is_production_unless_the_engines_variables_say and
a_beta_build_starts_the_engine_against_the_edge_zeron_s_variables_name
fail without it. (a_beta_build_manages_zeron_app_s_engine fails on
Linux before and after: it writes macOS's engine name, `Zeron Engine`,
beside the executable; CI runs apps/zgx's tests without `beta`.)
@alexandre-vl

alexandre-vl commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

The red checks come from zeron/zgx and GitHub's macOS runners, not this change.

@alexandre-vl
alexandre-vl changed the base branch from zeron/zgx to main November 18, 2026 20:40
@alexandre-vl
alexandre-vl marked this pull request as ready for review November 18, 2026 21:47
@wingleeio
wingleeio requested a review from jsgrrchg November 24, 2026 17:43
An app opened from the Dock or Finder gets launchd's environment, not the
shell's, so ZERON_EDGE_URL alone left a self-hosted session `zeron login`
kept meeting production's edge. With no variable naming an edge, the app
now takes the one session.json says issued it (edgeUrl, workosClientId,
which the engine writes since zeronsh#1390), else production's.

- Production's edge and client are zeron_cli's defaults, not a copy.
- The manager checks against the same resolution, in its data dir.
- a_beta_build_manages_zeron_app_s_engine writes this platform's engine
  name, so it passes on Linux.
- CI runs apps/zgx's unit tests with --features beta too
  (scripts/ci/test-zgx.sh rust-beta): the build every package makes.

@jsgrrchg jsgrrchg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@SinaKhalili @wingleeio could one of you review this? It needs a code owner since c98b4ef touches CI, and someone other than me for the last push.

On top of the original fix (the app starts its engine against the edge ZERON_EDGE_URL names), c98b4ef adds:

  • With no variable set (the app opened from the Dock/Finder, which doesn't get the shell's env), the app follows the edge/client that issued the kept session (edgeUrl/workosClientId in session.json, written since #1390), else production.
  • Production's edge/client come from zeron_cli's defaults instead of a copy.
  • The manager's check uses the same resolution, against its data dir.
  • a_beta_build_manages_zeron_app_s_engine uses the platform's engine name, so it passes on Linux.
  • CI (your part): zgx-tests.yml runs apps/zgx's unit tests with --features beta too, via a new scripts/ci/test-zgx.sh rust-beta. That's the build every package makes, and its tests never ran in CI.

Full beta suite passes on Linux (737/0); macOS is still untested, so a macOS run would be welcome.

This branch has not been deployed

No deployments
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.

2 participants