Skip to content

Detect stale native module before module-load via sidecar#267

Merged
dakra merged 2 commits into
mainfrom
sidecar-version-check
May 13, 2026
Merged

Detect stale native module before module-load via sidecar#267
dakra merged 2 commits into
mainfrom
sidecar-version-check

Conversation

@dakra
Copy link
Copy Markdown
Owner

@dakra dakra commented May 12, 2026

Summary

Fixes #256 — when the elisp package is upgraded ahead of the native module, the old .so was mapped into Emacs first and only then checked for version compatibility. By that point a restart was the only way to load the new binary, and M-x ghostel never re-surfaced the install prompt because the early-out at the top of ghostel--load-module short-circuited once the module was loaded.

  • build.zig writes a ghostel-module.version sidecar next to the binary; ghostel--download-module and ghostel--install-built-module-on-finish keep it in sync (the downloader resolves /releases/latest/ to the redirected tag).
  • ghostel--load-module consults the sidecar before module-load and refuses to map a stale .so, so a fresh install can be loaded in the same Emacs process — no second restart.
  • The interactive version check now runs unconditionally at the tail of ghostel--load-module, so existing installs without a sidecar still surface the install prompt at M-x ghostel instead of only warning.
  • Install paths share a ghostel--install-module-pair helper that pre-deletes the dest sidecar before moving the .so, so any mid-install failure ends in sidecar absent (loader falls back to live check) rather than sidecar stale (loader refuses to map).

Notes

  • The transition release itself still requires the one unavoidable restart for users who had no sidecar at startup; from there on, every future module-bump upgrade is single-restart.
  • src/version.zig is now the single source of truth shared by build.zig and src/module.zig. build.zig.zon and lisp/ghostel.el's ;; Version: / ghostel--minimum-module-version still need manual sync at release time (no change there).

Test plan

  • make -j4 all clean (366 elisp tests + 175 native tests + zig unit tests + evil tests + lint).
  • Sidecar round-trip + parse + stale-sidecar load-gating tests (ghostel-test-sidecar-*, ghostel-test-load-module-*).
  • Install-pair failure-degradation tests (ghostel-test-install-module-pair-*, ghostel-test-download-module-deletes-stale-sidecar-on-failure).
  • Native test asserting zig build emits a sidecar matching ghostel--module-version.
  • Manual: stash a stale ghostel-module.so + matching old sidecar, restart Emacs, confirm M-x ghostel prompts and the fresh module loads in-process without a second restart.

@dakra dakra force-pushed the sidecar-version-check branch from 920a4d2 to 82dd0d8 Compare May 12, 2026 10:35
mgeisler and others added 2 commits May 13, 2026 10:02
Add support for Ghostty's `bold-color` configuration, allowing bold
text to be rendered using bright colors or a specific fixed color.

Summary of changes:
- src/terminal.zig: Add `BoldConfig` and `bold_config` field to `Terminal`.
- src/module.zig: Add `ghostel--set-bold-config` to update bold settings.
- src/render.zig: Implement color substitution logic in `readCellProps`.
  Bold text with palette colors 0-7 is mapped to 8-15. Bold text with
  default foreground uses `bold_config.fixed_color` if mode is `fixed`.
- lisp/ghostel.el: Add `ghostel-bold-color` defcustom (default `bright`)
  and logic to apply it to new and existing terminals.
- test/ghostel-test.el: Add unit tests for both 'bright and fixed-color
  bold modes.
- src/emacs.zig: Add `bright` symbol to cached symbols.

Matches Ghostty 1.2.0 behavior.

> Written by Gemini, tested by me.
When the elisp package is upgraded ahead of the native module, the
old .so was mapped into Emacs first and only then checked for version
compatibility.  By that point a restart was the only way to load the
new binary, so users hit two restarts per upgrade and the interactive
prompt at M-x ghostel never fired because the early-out at the top of
ghostel--load-module short-circuited once the module was loaded.

build.zig now writes a ghostel-module.version sidecar next to the
binary, and ghostel--download-module / ghostel--install-built-module-
on-finish keep it in sync (the downloader resolves /releases/latest/
to the redirected tag).  ghostel--load-module consults the sidecar
before module-load and refuses to map a stale .so, so a fresh install
can be loaded in this same process — no second restart.

The interactive version check also runs unconditionally at the tail
of ghostel--load-module, so existing installs without a sidecar still
surface the install prompt at M-x ghostel instead of only warning.

Fixes #256.
@dakra dakra force-pushed the sidecar-version-check branch from 82dd0d8 to 76eb36d Compare May 13, 2026 08:26
@dakra dakra merged commit 76eb36d into main May 13, 2026
22 checks passed
@dakra dakra deleted the sidecar-version-check branch May 13, 2026 08:48
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.

Symbol’s function definition is void: ghostel--pty-password-input-p

2 participants