--db-server validation + e2e tests + review polish - #470
Open
jacalata wants to merge 9 commits into
Open
Conversation
PR #458 fixed the two publish crashes when using --db-username / --db-password / --save-db-password, but callers who omit --db-server still hit a raw ValueError from tableauserverclient's _add_connections_element. Fail fast in run_command with a clear, localizable message before we build the ConnectionItem so users get an actionable error instead of an internal stack trace. Update the existing no-db-server test to assert the exit path and add the parallel coverage for the --oauth-username branch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extend the online publish suite with: - A positive assertion for the happy path: test_wb_publish_embedded now passes --db-server matching the connection host baked into EmbeddedCredentials.twb (see-internal-slack). Without a matching server_address, tableauserverclient silently drops the embedded credentials at publish time, so covering the match is what actually proves the fix. - A negative assertion: test_wb_publish_embedded_missing_db_server_fails runs publish with --db-username but no --db-server and expects a non-zero exit. The check now fires in run_command before any network work, so hardcoded placeholder creds are sufficient. Threads a db_server keyword through the _publish_creds_args helper and records the workbook's connection host as a class constant. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Scope the guard to workbook publishes only. Datasource publishes go through _add_credentials_element on the TSC side, which never requires server_address, so the previous unconditional check was a regression for `tabcmd publish live_mysql.tds --db-username ...` and similar. The guard now checks the target filename extension early (before auth, for fast failure) and repeats per-file inside the workbook branch of the loop for the folder-publish case. Rename the `credentials` parameter of `publish_workbook_file` to `connection` — it holds a single ConnectionItem, not a list. Tests: - Add test_publish_with_oauth_creds covering the oauth branch's server_address assignment (previously untested). - Add test_publish_datasource_with_db_username_no_db_server verifying datasource publishes are not blocked when --db-server is omitted. - Strengthen the e2e negative test to run tabcmd via subprocess.run, capture stdout/stderr, and assert on the localized guard message (or the raw key when .mo has not been regenerated). Any earlier unrelated failure — bad auth, missing asset, session expiry — now fails the test rather than passing it. - Trim the misleading class-constant comment on TWB_FILE_EMBEDDED_ CONNECTION_SERVER; reword the "before we touch the database" comment to reference the guard's contract instead of a specific location. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The guard against workbook publish with embedded credentials but no --db-server was duplicated in run_command (early pre-auth check and in-loop per-file check). Extract it into a single classmethod so the two call sites cannot drift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The e2e test only proves the publish call did not crash. It does not verify credentials actually embedded on the server side; a mismatched --db-server would exit 0 while silently dropping the creds at TSC's request-factory boundary. Document the limitation so future readers do not mistake it for full coverage. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Callers who pass --db-username without --db-server now get a friendly error. But callers who pass a mismatched --db-server still hit the silent-drop bug at the TSC boundary. Document the mismatch footgun in the help text so users notice before they publish. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two small corrections in the pt locale: - "banco de dado" -> "banco de dados" (plural is the standard form) - "associado as credenciais" -> "associado as credenciais" (crase, "a"+"as") Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Re-runs doit localize so en (M4 caveat added) and pt (grammar fixed) message catalogs match their .properties sources. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
yyk16293
approved these changes
Sep 11, 2026
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.
Third in the #467 backport-split (PR C). Stacked on top of PR B (
jac/regen-mo-post-458, #469).What this does
Adds the follow-up work that was reverted out of PR A (#467) to keep the backport clean:
--db-serverrequired-when---db-usernameguard on the workbook publish path.--db-serveris missing.Plus fresh-eyes review Medium fixes and one Copilot nit:
_require_db_server_for_workbook(args, filename, logger)helper so the duplicated guard cannot drift between the early pre-auth check and the in-loop per-file check.test_wb_publish_embeddedclarifying it only proves not-crashing (a mismatched--db-serverwould still exit 0 while silently dropping the creds; tracked internally).publish.options.db-serverhelp text to warn about the silent-drop-on-mismatch footgun.banco de dado->banco de dados(plural);associado a credenciais->associado as credenciais(crase)..mocatalogs to pick up the M4 and PT changes.Stacked-PR notes
jac/regen-mo-post-458(PR B, Regenerate .mo catalogs after #458 backport #469). Rebase todevelopmentafter both A and B merge.Generated with Claude Code