Skip to content

fix(doctest): detect a crashed lez_core instead of passing silently - #42

Draft
dlipicar wants to merge 1 commit into
logos-blockchain:mainfrom
dlipicar:fix/doctest-detect-module-crash
Draft

fix(doctest): detect a crashed lez_core instead of passing silently#42
dlipicar wants to merge 1 commit into
logos-blockchain:mainfrom
dlipicar:fix/doctest-detect-module-crash

Conversation

@dlipicar

Copy link
Copy Markdown

The blind spot

"Confirm the module is loaded" asserted the bare substring '"status":"loaded"'. capability_module is always loaded and satisfies that substring on its own, so a lez_core that loaded and then crashed still passed the step. The failure only surfaced several steps later at the first call, as a bare RPC_FAILED with nothing explaining why.

That is exactly what the nightly has been showing on both platforms (run):

load-module  -> {"module":"lez_core","status":"ok","version":"0.3.0"}
status       -> {"name":"lez_core","status":"not_loaded", ...}   ← PASSED
module-info  -> {"name":"lez_core","status":"not_loaded", ...}   ← PASSED
call name    -> {"code":"RPC_FAILED", ...}                       ← first red

What this PR does

  • Match lez_core's own entry ("name":"lez_core","status":"loaded") so the step fails where the problem actually is.
  • Add a cat logs.txt right after loading. When a module subprocess dies, the host writes the dlopen error and Module process crashed there — and the spec only ever cat'ed the log before loading, so CI never captured the reason.

What it does not do

This makes the failure legible; it does not fix the underlying crash.

The crash is a missing shared-library dependency. An .lgx is a gzipped tar, so Nix's reference scanner sees no store paths inside it and records an empty closure for the .lgx derivation. A cache-substituted .lgx therefore arrives without the store paths its binaries dlopen() — for lez_core that is wallet_ffi's pyo3libpython3.13. Cache miss (built locally) = green, cache hit = dead module, which is why this looked like a ~1/3 flake for months.

Fix in flight as logos-co/nix-bundle-lgx#7 (verified against logos-storage-module, which hits the same defect via libcxx-16.0.6 on macOS). Once that lands and this module re-pins, the crash should go away — and with this PR, if it doesn't, CI will say why.

🤖 Generated with Claude Code

"Confirm the module is loaded" asserted the bare substring
'"status":"loaded"'. capability_module is always loaded and satisfies
that substring on its own, so a lez_core that loaded and then crashed
still passed this step. The failure only surfaced several steps later
at the first `call`, as a bare RPC_FAILED with nothing explaining why.

That is exactly what the nightly has been showing on both platforms:

  load-module  -> {"module":"lez_core","status":"ok","version":"0.3.0"}
  status       -> {"name":"lez_core","status":"not_loaded", ...}   PASSED
  module-info  -> {"name":"lez_core","status":"not_loaded", ...}   PASSED
  call name    -> RPC_FAILED

Match lez_core's own entry so the step fails where the problem is, and
add a `cat logs.txt` right after loading — when a module subprocess
dies, the host writes the dlopen error and "Module process crashed"
there, and the spec only ever cat'ed the log *before* loading.

This makes the failure legible; it does not fix the underlying crash.
That is a missing shared-library dependency: an .lgx is a gzipped tar,
so Nix records no references for it, and a cache-substituted .lgx
arrives without the store paths its binaries dlopen(). Fix in flight as
logos-co/nix-bundle-lgx#7.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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