You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: allow repeated --filter flags for exports - #443
--filter previously accepted one value and required multi-pair filters
to be joined with &. That parsing scheme prevents literal & inside a
value (e.g. Product Name=AT&T gets split). Making --filter
repeatable removes the need for callers to encode delimiters.
Related to #442, which handles the same problem when the filter comes in
via URL syntax rather than the flag.
Behavior change
For users:--filter is now repeatable. Each flag carries exactly
one COLUMN=VALUE pair.
--filter "Region=West&Product=Widget" # still works (back-compat)
--filter "Region=West" --filter "Product=Widget" # preferred
--filter "Product=AT&T" # new: repeated form allows '&' in value
Back-compat: when only one --filter is present, the value is still
split on &. This means a single flag carrying one filter with & in
its value (e.g. --filter "Product=AT&T" alone) is still ambiguous.
Workaround: pass the filter in the URL query string instead of via --filter. #442 landed the URL-path handling for literal &, so tabcmd get "views/View/Sheet.csv?Product%20Name=AT&T%20841000%20Phone"
works correctly (space must be encoded as %20; & may be literal).
Previously `--filter` accepted only one value, and multi-pair filtering
required joining pairs with '&' (e.g. `--filter "A=1&B=2"`). That
parsing scheme conflicts with values that legitimately contain '&'
(e.g. `Product Name=AT&T ...`).
Make `--filter` repeatable via argparse action="append". Each flag now
carries exactly one COLUMN=VALUE pair — no '&' splitting — so literal
'&' in a value passes through untouched.
Back-compat: when only one --filter flag is present, the value is still
split on '&' so existing scripts keep working. Users who need '&' in a
value should switch to the repeated-flag form.
Adds parser tests for the new syntax and unit tests for
apply_filters_from_args covering both forms.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
All call sites pass logger explicitly, so the default was unreachable.
Tightens the type from Optional[Logger] to Logger, drops any fallback
branch inside.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The updated filter-path still risks truncating values containing = and can error on ambiguous single-flag & splits unless parsing is made more robust (and covered by a regression test).
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
apply_filters_from_args currently claims repeated flags allow literal '&' or '=' inside values, but the implementation delegates to DatasourcesAndWorkbooks.apply_filter_value, which splits on every '=' and will truncate values like Notes=x=y. Also, the back-compat single-flag split on '&' can yield fragments without '=', which can raise IndexError downstream. Consider parsing COLUMN=VALUE here with split('=', 1) and only treating '&' as a delimiter when every segment contains '=' (otherwise treat '&' as literal and warn) to avoid crashes and preserve values. tests/commands/test_datasources_and_workbooks_command.py:217
Current tests cover '&' in values, but they don't assert the stated behavior that '=' inside a filter value is preserved (e.g. Notes=x=y). Adding a regression test would catch truncation bugs in filter parsing.
- apply_filter_value now splits on the first '=' only, so values
containing '=' (e.g. Notes=x=y) are no longer truncated.
- apply_filters_from_args only treats a literal '&' in a single
--filter value as a back-compat pair delimiter when every resulting
segment actually looks like COLUMN=VALUE; otherwise the '&' is
treated as literal (e.g. Company=AT&T), avoiding the previous
IndexError risk on ambiguous splits.
- Add regression tests for both cases.
Co-Authored-By: Claude Code <noreply@anthropic.com>
URL filters are still split on every & in apply_values_from_url_params before this method is called. Consequently ?Product%20Name=AT&T%20841000%20Phone is applied as Product Name=AT and this guard merely skips the T 841000 Phone fragment, so the literal ampersand is not preserved and the result is incorrect. Rejoin URL fragments that are part of a value (or otherwise handle them in the URL parser) before calling apply_filter_value, and add a regression test for the documented URL workaround.
Regenerate compiled catalogs with updated filter help
The updated help text is only in the .properties source, but the application loads tabcmd/locales/*/LC_MESSAGES/tabcmd.mo at runtime and the checked-in English catalog still contains the old translation. As a result, the packaged/normal CLI help will not describe repeatable filters until the localization pipeline regenerates and includes the compiled catalogs.
logger.warning("Unable to read filter param '{}', expected COLUMN=VALUE. Skipping".format(value))
return
This branch has not been deployed
No deployments
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
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.
Motivation
--filterpreviously accepted one value and required multi-pair filtersto be joined with
&. That parsing scheme prevents literal&inside avalue (e.g.
Product Name=AT&Tgets split). Making--filterrepeatable removes the need for callers to encode delimiters.
Related to #442, which handles the same problem when the filter comes in
via URL syntax rather than the flag.
Behavior change
For users:
--filteris now repeatable. Each flag carries exactlyone
COLUMN=VALUEpair.Back-compat: when only one
--filteris present, the value is stillsplit on
&. This means a single flag carrying one filter with&inits value (e.g.
--filter "Product=AT&T"alone) is still ambiguous.Workaround: pass the filter in the URL query string instead of via
--filter. #442 landed the URL-path handling for literal&, sotabcmd get "views/View/Sheet.csv?Product%20Name=AT&T%20841000%20Phone"works correctly (space must be encoded as
%20;&may be literal).Test plan
pytest tests/commands/test_datasources_and_workbooks_command.py tests/parsers/test_parser_export.py— 34 passed--filterwith&in the value returns theexpected row
&-joined form still parses and filterscorrectly
🤖 Generated with Claude Code