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. - Restore the --db-server required-when-embedded guard on the workbook publish path. - Extract _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. - Extend the English publish.options.db-server help text to warn about the silent-drop-on-mismatch footgun. - Fix Portuguese grammar: "banco de dado" -> "banco de dados" (plural); "associado a credenciais" -> "associado as credenciais" (crase). - Regenerate .mo catalogs to pick up the new keys. - Unit tests: db-username and oauth-username exit paths, plus datasource-not-blocked coverage. - E2E test: friendly exit when --db-server is missing. Comment on test_wb_publish_embedded clarifies it only proves not-crashing (a mismatched --db-server would still exit 0 while silently dropping the creds; tracked internally). Re-cut from the closed PR #470 stack. Previously PR C in the #467/#469/#470 backport chain; PR B's base branch was deleted after merge, orphaning PR #470. This lands the same content on a fresh branch off development. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Add the new error translation to all supported locales and ensure E2E tests reject unresolved message keys.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds fail-fast validation requiring --db-server when publishing workbooks with embedded credentials, plus tests and localization updates. A missing translation fallback remains to be addressed.
Changes:
- Adds shared workbook validation and user-facing errors.
- Adds unit and E2E coverage.
- Updates help text and Portuguese translations.
File summaries
| File | Summary |
|---|---|
tests/e2e/online_tests.py |
Adds missing-server E2E coverage. |
tests/commands/test_publish_command.py |
Adds workbook and datasource credential tests. |
tabcmd/locales/pt/tabcmd_messages_pt.properties |
Corrects Portuguese wording. |
tabcmd/locales/en/tabcmd_messages_en.properties |
Adds validation and help messages. |
tabcmd/commands/datasources_and_workbooks/publish_command.py |
Adds workbook credential validation. |
Review details
Suppressed comments (1)
tests/e2e/online_tests.py:518
- This fallback makes the E2E test pass when localization is broken: it explicitly accepts the unresolved msgid, so missing
.moentries for this new error will not be detected. Since the expected behavior is a clear user-facing message, reject the raw key while still requiring the rendered guidance.
# Localized string OR the raw key (if .mo has not been regenerated yet) both signal our guard.
combined = (result.stdout or "") + (result.stderr or "")
assert "publish.errors.db_server_required" in combined or "--db-server is required" in combined, (
- Files reviewed: 5/7 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.
| publish.description=Publish a workbook, data source, or extract to the server | ||
| publish.errors.unexpected_server_response=Unexpected response from the server: {0} | ||
| publish.errors.server_resource_not_found=The resource you specified does not exist, or you do not have permission to see it. Check your project name and permissions | ||
| publish.errors.db_server_required=--db-server is required when publishing a workbook with --db-username or --oauth-username. Use --db-server to specify the database server address the embedded credentials should be associated with. |
…ll locales Copilot flagged the new key as English-only, so users in de/es/fr/ga/ it/ja/ko/pt/sv/zh would see the raw msgid (`publish.errors.db_server_required`) instead of any actual message. Adds the English placeholder text to each of the 10 non-EN properties catalogs and regenerates the .mo bundles via `doit localize` so the rendered guidance appears in every locale until real translations arrive. Tightens the e2e assertion to require the rendered English text (dropping the raw-msgid fallback path) so localization regressions fail loudly instead of silently.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Fix the missing test argument and validate all directory workbooks before publishing to prevent partial success.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
| if source in ["twbx", "twb"]: | ||
| # TSC's workbook publish path requires ConnectionItem.server_address whenever | ||
| # embedded connection credentials are supplied; datasource publish does not. | ||
| PublishCommand._require_db_server_for_workbook(args, str_filename, logger) |


Re-cut of the closed #470 stack — its base branch (
jac/regen-mo-post-458) was deleted after #469 merged, orphaning it. Same content, fresh branch offdevelopment.Motivation
PR #458 fixed the two publish crashes when using
--db-username/--db-password/--save-db-password, but callers who omit--db-serverstill hit a rawValueErrorfromtableauserverclient's_add_connections_element. Fail fast inrun_commandwith a clear, localizable message before we build the ConnectionItem, so users get an actionable error instead of an internal stack trace.Behavior change
--db-serverrequired-when-embedded guard on the workbook publish path._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.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 new keys.Comment on
test_wb_publish_embeddedclarifies it only proves not-crashing — a mismatched--db-serverwould still exit 0 while silently dropping the creds (tracked internally).Test plan
pytest tests/→ 341 passed, 2 skippedtest_publish_with_db_username_missing_db_server_exits— workbook +--db-usernamew/o--db-server→ friendly exittest_publish_with_oauth_username_missing_db_server_exits— workbook +--oauth-usernamew/o--db-server→ friendly exittest_publish_with_oauth_creds— positive control (complete oauth creds → no block)test_publish_datasource_with_db_username_no_db_server— negative control (datasource path is NOT blocked, workbook-only behavior)test_wb_publish_embedded_missing_db_server_fails— asserts the friendly error message via the CLI🤖 Generated with Claude Code