fix(ujust): ship self-contained shell completions over common's broken loader - #1305
kylerankin wants to merge 1 commit into
Conversation
…n loader `common` generates ujust completions with `just --completions <shell> | sed`, but `just --completions` emits a single self-referential line (`eval "$(JUST_COMPLETE=bash just)"`) that the sed turns into `eval "$(JUST_COMPLETE=bash ujust)"`. Sourcing that registers no completion binding (`complete: ujust: no completion specification`), so `ujust <TAB>` completes nothing. `COPY --from=common /system_files/shared` in the `ctx` stage overwrites bluefin's static completions, so the broken shim ships instead of bluefin's self-contained bash/zsh completions, which do define a real binding (`complete -F _ujust ujust` / `#compdef ujust`). Preserve bluefin's completions in `__keep` before common's overlay and restore them after, so they win. Add a 20-tests.sh guard that asserts the shipped completion registers a real binding, so a dead shim fails the build instead of shipping silently. Closes projectbluefin#1171 Assisted-by: Pi <model:lemonade/Ornith-1.5-35B-A3B-GGUF-Q6_K> Signed-off-by: kylerankin <kylerankin@users.noreply.github.com>
33ec2ea to
9c5832b
Compare
Danathar
left a comment
There was a problem hiding this comment.
The Containerfile change won't build as written.
The ctx stage is FROM scratch, and every COPY in it without --from reads from the build context, not from the stage's filesystem. So:
COPY system_files/.../ujust /__keep/ujust/bash-completion # writes into the ctx stage
...
COPY /__keep/ujust/bash-completion /system_files/... # reads from the build context — no such pathThe second COPY fails with "file not found" because /__keep only exists inside the stage. The unit tests passed because they never build the image.
If you want a downstream stop-gap, the round trip is unnecessary — just copy the files from the context again after the common overlay:
COPY --from=common /system_files/shared /system_files/shared
COPY --from=common /system_files/bluefin /system_files/shared
COPY --from=brew /system_files /system_files/shared
COPY /system_files/shared/usr/share/bash-completion/completions/ujust /system_files/shared/usr/share/bash-completion/completions/ujust
COPY /system_files/shared/usr/share/zsh/site-functions/_ujust /system_files/shared/usr/share/zsh/site-functions/_ujustBut the real fix is projectbluefin/common#1129, which replaces the generated shim with hand-written bash/zsh/fish completions at the source. This is the fourth downstream attempt at the same thing (#1236, #1262, #1270). Unless common#1129 stalls, I'd rather land that and let the overlay carry the working files, so the bluefin Containerfile doesn't need a permanent carve-out.
The 20-tests.sh guard and the bats test are reasonable on their own and would be worth keeping regardless.
Problem
ujust <Tab>completes nothing in bash or zsh (bluefin#1171).projectbluefin/commongenerates the ujust completions withjust --completions <shell> | sed, butjust --completionsemits a single self-referential line (eval "$(JUST_COMPLETE=bash just)") that the sed turns intoeval "$(JUST_COMPLETE=bash ujust)". Sourcing that registers no completion binding —complete: ujust: no completion specification— so it never completes.COPY --from=common /system_files/sharedin thectxstage of this Containerfile overwrites bluefin's static completions, so the broken shim ships instead of bluefin's self-contained bash/zsh completions.Fix
__keepbefore common's overlay and restore them after, so they win over the broken generated shim.__keeplives only in thescratch-basedctxstage, which is mounted at/ctx/system_filesin the image build, so it does not leak into the image.complete -F _ujust ujust/#compdef ujust) so a dead shim fails the build instead of shipping silently.Tested
bats tests/unit/— all 254 tests pass (including the new "rejects a broken dynamic ujust completion loader" test).complete -F _ujust ujust.bash -nclean on build_files/base/20-tests.sh; no trailing whitespace; all edited files end with a newline.Closes #1171
— hive: backend=pi model=lemonade/Ornith-1.5-35B-A3B-GGUF-Q6_K