Skip to content

fix: accept yes/no on --encrypt for Classic parity - #450

Open
jacalata wants to merge 3 commits into
developmentfrom
jac/createextracts-encrypt-yesno
Open

jacalata wants to merge 3 commits into
developmentfrom
jac/createextracts-encrypt-yesno

Conversation

@jacalata

@jacalata jacalata commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Motivation

tabcmd Classic's --encrypt on createextracts takes an explicit
yes or no value. tabcmd 2 treated it as a bare boolean flag,
silently ignoring any following value. Scripts passing --encrypt no
on Classic didn't fail on tabcmd 2 but produced the wrong behavior
(they either bailed on argparse or silently kept encryption on).

Behavior change

For users: --encrypt accepts an optional yes|no|true|false
argument (case-insensitive).

  • Bare --encrypt still means True (tabcmd 2 syntax).
  • Omitted means False.
  • Explicit --encrypt no (or false/0) now means False.

Preserves tabcmd 2's current default while accepting Classic's
yes/no syntax.

Test plan

  • tests/parsers/test_parser_create_extracts.py — 8 new tests:
    omitted / bare / yes / no / true / false / case-insensitive /
    bad-value-rejected
  • Full test_parser_create_extracts.py suite: 15 passed

🤖 Generated with Claude Code

Source

Classic tabcmd's --encrypt handler (app-tabcmd/src/.../commands/CreateExtracts.java:79-101) accepts exactly yes | y | no | n (case-insensitive) and rejects anything else. Latest push (fb14edc) restores y/n — the Classic set — to the accepted values so ported scripts using the shortcuts keep working. Full tabcmd 2 set is now yes | y | no | n | true | false | 1 | 0: Classic's set intact, with true/false/1/0 added on top as a forgiving superset for users typing boolean-shaped values.

Updated test coverage: 10 argparse tests (omitted / bare / yes / no / y / n / true / false / case-insensitive / bad-value-rejected).

tabcmd Classic's `--encrypt` on `createextracts` takes an explicit
yes/no value; tabcmd 2 treated it as a bare boolean flag, silently
ignoring any following value. Scripts that pass `--encrypt no` on
Classic ended up encrypting on tabcmd 2 because argparse consumed the
"no" as a positional or bailed.

Make --encrypt accept an optional yes|no|true|false argument
(case-insensitive). Bare `--encrypt` still means True; omitted means
False; explicit `--encrypt no` means False. This preserves current
tabcmd 2 default behavior while matching Classic syntax.
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
tabcmd
   __main__.py121212 0%
   _version.py111111 0%
   tabcmd.py151515 0%
   version.py955 44%
tabcmd/commands
   commands.py101010 0%
   constants.py771818 77%
   server.py1351818 87%
tabcmd/commands/auth
   session.py3945050 87%
tabcmd/commands/datasources_and_workbooks
   datasources_and_workbooks_command.py1571818 89%
   datasources_workbooks_views_url_parser.py14255 96%
   delete_command.py601616 73%
   export_command.py1202525 79%
   get_url_command.py1274747 63%
   publish_command.py1252929 77%
   runschedule_command.py2177 67%
tabcmd/commands/extracts
   create_extracts_command.py4288 81%
   decrypt_extracts_command.py2722 93%
   delete_extracts_command.py3766 84%
   encrypt_extracts_command.py2722 93%
   extracts.py2022 90%
   reencrypt_extracts_command.py2722 93%
   refresh_extracts_command.py481010 79%
tabcmd/commands/group
   create_group_command.py2955 83%
   delete_group_command.py2722 93%
tabcmd/commands/project
   create_project_command.py4688 83%
   delete_project_command.py3544 89%
   publish_samples_command.py3044 87%
tabcmd/commands/site
   create_site_command.py3455 85%
   delete_site_command.py2722 93%
   edit_site_command.py3822 95%
   list_command.py771212 84%
   list_sites_command.py2922 93%
tabcmd/commands/user
   add_users_command.py2955 83%
   create_site_users.py581111 81%
   create_users_command.py5999 85%
   delete_site_users_command.py4355 88%
   user_data.py2223131 86%
tabcmd/execution
   _version.py222 0%
   global_options.py13488 94%
   localize.py661111 83%
   logger_config.py6066 90%
   tabcmd_controller.py4277 83%
TOTAL288445984% 

jacalata and others added 2 commits August 7, 2026 00:00
Classic tabcmd's CreateExtracts.java:79-101 accepts exactly `yes|y|no|n`
(case-insensitive) on --encrypt and rejects anything else. This PR was
dropping the `y`/`n` shortcuts, which breaks any ported Classic script
that used them. Keeping Classic's set intact is the standing rule —
tabcmd 2 may be more forgiving than Classic, but must not narrow.

Add `y` and `n` to the accepted set (both directions). tabcmd 2 now
accepts the union `yes|y|no|n|true|false|1|0`, case-insensitive.
Rewrite the source comment to cite the Classic source-of-truth path
in the monolith rather than the incorrect earlier claim that Classic
accepted "yes/no/true/false".

Add two tests pinning `y`→True and `n`→False so a future refactor
can't quietly drop them again.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 18, 2026 20:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Add regression tests for the supported 1 and 0 aliases and update the help text to reflect all accepted values.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates createextracts --encrypt to accept Classic-compatible boolean values while preserving bare-flag behavior.

Changes:

  • Supports yes/no, y/n, true/false, and 1/0 values.
  • Adds parser coverage for accepted and rejected inputs.
File summaries
File Description
tests/parsers/test_parser_create_extracts.py Tests encryption argument behavior.
tabcmd/execution/global_options.py Implements optional encryption-value parsing.
Review details

Suppressed comments (1)

tabcmd/execution/global_options.py:125

  • The parser now explicitly supports the 1/0 aliases (and the PR description calls out 0), but the added tests cover only y/n and true/false. Please add regression cases for both numeric spellings so this part of the accepted interface is protected from future changes.
    if lowered in ("yes", "y", "true", "1"):
        return True
    if lowered in ("no", "n", "false", "0"):
        return False
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

const=True,
default=False,
type=_parse_yes_no,
metavar="yes|no",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants