Skip to content

fix(nix): anchor result* source filter so result_xdr.py is packaged - #51

Merged
RaoulSchaffranek merged 1 commit into
mainfrom
fix/nix-source-filter-result-xdr
Jul 24, 2026
Merged

fix(nix): anchor result* source filter so result_xdr.py is packaged#51
RaoulSchaffranek merged 1 commit into
mainfrom
fix/nix-source-filter-result-xdr

Conversation

@RaoulSchaffranek

Copy link
Copy Markdown
Member

Problem

The prebuilt komet-node on k-framework.cachix.org crashes on startup:

ModuleNotFoundError: No module named 'komet_node.result_xdr'

src/komet_node/server.py imports komet_node.result_xdr unconditionally, and the module is committed — but it is missing from the built package on every build (cachix included), so kup install komet-node yields a node that dies before serving any request. Republishing new commits does not help, because the file is dropped again each build.

Root cause

In nix/komet-node-pyk/default.nix, the uv2nix workspace source is filtered through nix-gitignore.gitignoreSourcePure to drop the ./result nix build symlink:

workspaceRoot = lib.cleanSource (nix-gitignore.gitignoreSourcePure [
    ../../.gitignore
    ".github/"
    "result*"      # <-- no leading slash
    ...
  ] ../..);

result* has no leading slash, so by gitignore semantics it matches a path component named result… at any depth — including src/komet_node/result_xdr.py. The file is stripped from the source tree before the wheel is built. (The comment just below this list even warns that source filtering here can make cachix builds diverge from what kup requests.)

Fix

Anchor the pattern to the workspace root so it only matches the top-level build symlinks:

-        "result*"
+        "/result*"

/result* still excludes ./result, ./result-1, … but no longer matches nested source files. result_xdr.py is the only source file whose name starts with result, so this fully resolves the crash.

Verification

  • git ls-tree -r HEAD -- src/komet_node/result_xdr.py — file is tracked.
  • Before: the built komet-node-env site-packages contains every komet_node module except result_xdr.py.
  • After: rebuild and confirm komet-node --host localhost --port <p> starts without the import error (a --help smoke test alone does not catch this — the failing import runs before argument handling).

The uv2nix workspace source is filtered through
`nix-gitignore.gitignoreSourcePure` to drop the `./result` nix build
symlink. The pattern was written as `result*` with no leading slash, so
by gitignore semantics it matched a path component named `result…` at
ANY depth — including `src/komet_node/result_xdr.py`.

That file was therefore stripped from the packaged source on every build
(cachix included), while `server.py` imports it unconditionally, so the
installed `komet-node` crashed on startup with:

    ModuleNotFoundError: No module named 'komet_node.result_xdr'

Anchoring the pattern to the workspace root (`/result*`) still excludes
the top-level build symlinks (`result`, `result-1`, …) without matching
nested source files.
@RaoulSchaffranek
RaoulSchaffranek merged commit 7b2c71b into main Jul 24, 2026
1 check failed
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.

1 participant