Fix #434: map "Local" auth_setting to ServerDefault - #446
Open
jacalata wants to merge 2 commits into
Open
Conversation
tabcmd Classic accepts "Local" as an auth type on the CLI and CSV column 7. tabcmd 2 kept "Local" in the accepted list but TSC's UserItem.Auth enum has no Local value, so when the user reached server.users.add() the wire representation raised ValueError. Map Classic's "Local" -> TSC.UserItem.Auth.ServerDefault in Userdata.to_tsc_user() so CSVs authored for Classic import cleanly. Case-insensitive to match Classic behavior. Fixes #434.
A silent remap is surprising: an operator who typed Local (or imported a Classic CSV that uses it) previously got a user with ServerDefault auth and no signal that anything changed. Emit a WARNING that names the user and states both the input and remapped auth so the operator can spot unexpected remaps in a large batch. Adds a matching assertion in the existing test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #434.
Motivation
tabcmd Classic accepts
Localas an auth type on the CLI and in CSVcolumn 7, but TSC's
UserItem.Authenum has noLocalvalue, sopassing it through crashed on
server.users.add. Anyone importing aClassic-authored CSV containing
Localin column 7 hit a hard failure.Behavior change
For users:
Userdata.to_tsc_user()mapsLocal(case-insensitive)to
TSC.UserItem.Auth.ServerDefaultand logs a WARNING naming theaffected user so the operator sees the remap happened. A silent remap
would be surprising -- if the site's actual default auth isn't the
same as Classic's Local, created users would have a different auth
method than intended.
Test plan
tests/commands/test_user_utils.py— 3 new tests cover exact-caseLocal, lowercaselocal, and non-Localpass-throughtest_user_utils.pysuite: 18 passed🤖 Generated with Claude Code