Repository navigation
test(nix): guard root dependency module identity - #56881
albertominetti wants to merge 1 commit into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
This fixes the crash from #56856, but merging every same-version duplicate looks too broad to me.
How I checked: in this checkout and the base, I installed with the nix/node_modules.nix steps (filtered install, canonicalize, normalize-binaries) and built with the nix/opencode.nix steps (bun 1.4.2).
- Base:
packages/themeuses a different@opentui/corecopy (+eff4d38d…) frompackages/tuiandpackages/cli(+d25f280c…). The binary goes straight to the crash screen withe.replace is not a function. - This PR: all three use one copy, and the TUI reaches the home screen with an empty config.
- Tests: the new test passes.
Public API: unchanged. The change only affects the node_modules layout of the Nix build. The node_modules hash in nix/hashes.json will change.
Main concern: the script merges all 15 duplicate groups in this install, not just @opentui/core. Several of them use different versions of their own dependencies, and the copy that's kept is whichever comes first alphabetically by hash. For example, the @ai-sdk/provider-utils@4.0.23 copy that packages/core uses links to zod@4.1.8. It gets replaced by a copy that links to zod@3.25.76. The @opentelemetry/* copies linked to @opentelemetry/api@1.9.1 are replaced by ones linked to 1.9.0. That changes which dependency versions run in the Nix build compared with every other build, and could cause problems in the provider and telemetry code. Details are in the inline comment.
|
|
||
| for (const [slug, list] of versions) { | ||
| for (const entry of list) { | ||
| const key = slug + "@" + entry.version.split("+")[0] |
There was a problem hiding this comment.
This merges all copies with the same version string, whatever their dependencies are, and keeps whichever comes first alphabetically by hash. On the filtered install, some of the 15 merged groups use different versions of their own dependencies:
@ai-sdk/provider-utils@4.0.23:+d6123d32…(used bypackages/coreand@ai-sdk/openai-compatible) links tozod@4.1.8. It is replaced by+27912429…, which links tozod@3.25.76.@opentelemetry/core,resources,sdk-*and the other@opentelemetry/*copies: the+e40b0dfd…copies link to@opentelemetry/api@1.9.1and are replaced by+460773ef…copies that link to1.9.0.
Could you merge only copies whose dependency links point to the same targets, treating dependencies that were themselves merged as the same? For @opentui/core, the two copies differ only in bun-ffi-structs, which is itself a same-version duplicate, so that would still fix #56856 without changing what other packages resolve. Restricting the merge to the packages that need a single copy (@opentui/*) would also work.
|
Verified a smaller alternative at the affected base Replace Checked with Bun 1.4.2 on Linux x86_64:
I also ran this PR's current Only the verified x86_64-linux hash is updated. ARM Linux/macOS hashes remain unchanged and need platform-local regeneration before claiming those builds work. Investigation and patch prepared with AI assistance. |
Cover the crash from anomalyco#56856: theme colors must survive spinner conversion, every OpenTUI consumer must resolve one runtime entrypoint, and the install must keep distinct Zod and OpenTelemetry peer contexts now that root dependencies participate in the filtered install (anomalyco#56889). nix/scripts is not a workspace, so turbo never runs these tests; run them explicitly in the Linux unit job.
18a92ce to
ab8c385
Compare
|
Rebased onto current
Verified on this head: The PR workflows are currently waiting on maintainer approval to run ( |
|
Superseded by #64111. Renaming the head branch to follow the current branch naming rule closed this PR, so the same commit and description now live there. |

Issue for this PR
Follow-up regression coverage for #56856. The production fix was independently merged in #56889 and is already in
dev; this PR does not change the Nix install or dependency hashes.Type of change
What does this PR do?
Adds a regression test that:
e.replace is not a functioncrash path),nix/scriptsis not a turbo workspace, so the tests are also run explicitly in the Linux unit job ofcheck-test.How did you verify your code works?
devmerge,bun install --frozen-lockfile --ignore-scripts --no-progresssucceeded.bun testinnix/scripts: 5 passed, 0 failed, 13 expectations.oxlint nix/scripts/dependency-identity.test.ts: 0 warnings, 0 errors; Prettier clean.Screenshots / recordings
Not applicable; this PR adds tests.
Checklist