Skip to content

fix(config): reject vars keys git would lowercase or refuse - #4830

Merged
max-sixty merged 1 commit into
mainfrom
nightly/clean-44031200023
Nov 19, 2026
Merged

max-sixty merged 1 commit into
mainfrom
nightly/clean-44031200023

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

wt config state vars set Ticket=ABC printed "Set Ticket for main", but git stores config variable names lowercased, so the value reads back as ticket. A hook or custom column that references {{ vars.Ticket }} renders empty, and vars list / state get show a different key than the one that was set. A key that starts with a digit (1st=…) passed validation and then failed with git's bare error: invalid key.

validate_vars_key now requires a lowercase first letter followed by lowercase letters, digits, and hyphens, which is the subset git stores verbatim. The vars help text and its generated doc mirrors say so.

Interface note: the validator is shared by set, get, and clear, so vars get Ticket and vars clear Ticket now error too, where before git's case-insensitive lookup let them match the stored ticket. No stored key can contain uppercase, so the lowercase spelling always works. Lowercasing input on set would be the alternative if keeping existing scripts that pass mixed-case keys working matters more than a clear failure. Neither choice fixes a template that already spells the key in mixed case.

Found by the nightly survey of src/commands/config/state.rs. The new test_vars_set_rejects_keys_git_cannot_store_verbatim (uppercase and leading-digit cases) failed before the change and passes after it. The existing invalid-key snapshot and test_docs_are_in_sync are updated.

Git stores config variable names lowercased, so `wt config state vars set
Ticket=ABC` reported success while templates referencing {{ vars.Ticket }}
rendered empty (the value reads back as `ticket`). A key starting with a
digit passed validation and then failed with git's bare "invalid key".

validate_vars_key now requires a lowercase first letter followed by
lowercase letters, digits, and hyphens, and the help text says so.
@worktrunk-bot worktrunk-bot added the nightly-cleanup Issues found by nightly code quality sweep label Nov 17, 2026
@max-sixty
max-sixty merged commit bac2845 into main Nov 19, 2026
36 of 45 checks passed
@max-sixty
max-sixty deleted the nightly/clean-44031200023 branch November 19, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nightly-cleanup Issues found by nightly code quality sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants