Skip to content

Dynamic completions: three limits, one of them worth a CI job #3

Description

@dev-bap

Summary

Three limits of the dynamic completions #12 shipped in #99. None of them makes the feature wrong; each is a case it does not cover, recorded so the next person does not have to rediscover them.

1. --place does not narrow to the --env already typed

rbx place upload --env prod --place <TAB> offers the union of place names across every env, not the places prod declares. The union is the deliberate default — --place is often completed before --env has been typed, and a place name is usually a role, so main in three envs is one candidate.

Narrowing when --env is already on the line would need each of the four shells to parse the words to its left. That is four implementations of the same fragile thing, in four languages, and it is worth writing only for a project whose envs hold genuinely different places. Worth reopening the day somebody has one.

2. bash 3.2, which is what macOS ships, has no compopt

The hook uses compopt to suppress the file-name fallback when it returns nothing. bash 3.2 does not have it, so on a stock macOS bash an empty answer falls back to listing files in the current directory, which is noise rather than a wrong answer. A bash-completion-flavoured fix, or a guard on compopt's existence, would close it.

3. The shell halves are not tested, and cannot be here

What CI tests is the contract between the halves: each generated script contains its hook, asks for exactly the two lister commands, and the listers print exactly the expected lines — including empty stdout when rbxplace.toml is missing or malformed. What it does not test is a real shell drawing a real menu, because the runner has no bash, zsh, fish or pwsh and driving a completion needs a terminal.

Manually driven during #99: bash and PowerShell, against real completions, in a temp project and an empty directory, with prefix filtering, inside a subcommand. zsh and fish were not driven at all, for want of the shells on that machine, and their grafts are the most intricate of the four — zsh rewrites the actions inside a generated _arguments call, because the file ends by invoking _rbx and appending would define the helpers one invocation too late.

A container with the four shells, asserting on menu contents, is the only thing that closes this. It is also the only item here with a real chance of catching a regression rather than documenting a limit.


Re-filed from #102 when the repository history was reset for 0.1.0. Issue and PR numbers referenced above belong to the previous numbering and no longer resolve; the reasoning does not depend on them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions