Skip to content

Provider namespacing: generic --providers/--cash-only/--awards-only (work-4byx)#12

Merged
ak2k merged 3 commits into
mainfrom
worktree-work-4byx-provider-namespacing
May 17, 2026
Merged

Provider namespacing: generic --providers/--cash-only/--awards-only (work-4byx)#12
ak2k merged 3 commits into
mainfrom
worktree-work-4byx-provider-namespacing

Conversation

@ak2k

@ak2k ak2k commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces the four PP-specific flags on flight search (--no-pp, --pp-only, --pp-airlines, --pp-cabin) with a generic provider-namespaced surface that scales to N providers without flag growth. Lands before work-2eoa (Seats.aero) so that follow-up issue ships as a registry addition + a config.toml section, not eight new flags requiring deprecation.

Closes the namespacing half of bd work-4byx.

New surface

flight search ... --providers pp,seats         # default: all configured
flight search ... --cash-only                  # skip all award providers
flight search ... --awards-only                # skip cash table
flight search ... --provider-opt pp.airlines=United,Delta    # repeatable

Per-provider tuning (airlines, cabins, etc.) moves out of the CLI into ~/.config/flight-cli/config.toml:

[providers.pp]
airlines = ["United", "Delta"]
cabins = ["Economy", "Business"]

Precedence: defaults < config.toml < --provider-opt CLI overrides.

Deprecation strategy

The old flags remain functional with hidden=True (no longer in --help) and emit a runtime warning when set. They forward into the new shape via _resolve_providers. Conflicts between old and new (e.g. --no-pp + --cash-only) raise a clear error rather than silently picking one. Scheduled to remove after one release.

What didn't change

  • Today's only configured provider is PointsPath, so pp is the only meaningful entry in --providers / config / --provider-opt for now. The data flow is provider-blind end-to-end; work-2eoa becomes a [providers.seats] table + a SeatsProvider registration.
  • Deprecated flight fare / flight gflight commands also route through _resolve_providers so legacy invocations still produce the expected behavior with the same warning.

Test plan

  • 194 tests pass (29 new across tests/test_config.py, tests/test_provider_selection.py, tests/test_registry.py)
  • Pyright clean: 0 errors, 0 warnings, 0 informations
  • Live smoke: --cash-only, --providers pp, --provider-opt pp.cabins=Economy, deprecated --no-pp, conflict detection
  • Help output for flight search shows the four new flags; legacy flags hidden

Follow-ups

  • Once work-2eoa lands, the resolver's legacy_pp_* parameters can be removed entirely (one-release deprecation window).
  • work-4uls (surface hygiene) layers on top of this — same _config.py loader picks up [http] and [cache] sections for --rps/--impersonate/--no-cache migration.

ak2k added 2 commits May 16, 2026 22:11
…work-4byx)

Replaces the per-provider PP flag block (--no-pp/--pp-only/--pp-airlines/
--pp-cabin) with a generic provider-namespaced surface that scales to N
providers. Lands before work-2eoa (Seats.aero) so that issue ships as a
registry addition + a config.toml section, not eight new flags.

New surface on `flight search`:
  --providers pp[,seats]    CSV of providers to use (default: all enabled)
  --cash-only               Skip every award provider
  --awards-only             Skip cash table; show award providers only
  --provider-opt KEY=VAL    Repeatable; e.g. pp.airlines=United,Delta

Per-provider tuning moves out of the CLI into
~/.config/flight-cli/config.toml ([providers.<name>] tables). CLI
--provider-opt overrides config.toml values for a single invocation.

Deprecated aliases retained for one release (hidden=True so --help is
clean; runtime warning surfaces when set). Conflicts between old and
new flags raise a clear error rather than silently picking one.

Pyright-clean. 29 new tests across test_config.py, test_provider_selection.py,
and test_registry.py covering loader, CLI parsing, alias forwarding,
conflict detection, config<-CLI merge precedence, registry filter
matching.
The skill listed --no-pp; replace with the new --cash-only / --awards-only
/ --providers / --provider-opt surface so agents construct invocations
using the canonical flags. Deprecated aliases still work but the skill
shouldn't teach them.
- E501: split 3 long error-message lines under 100 chars
- B008: extract --provider-opt typer.Option to module-level _PROVIDER_OPT
  (and make the default None, not [], handling None at the callsite)
- RUF043: raw string for pytest.raises match=r"missing '\.'"
- TC003: pathlib.Path moved into TYPE_CHECKING blocks (two test files)
- PLR0912: noqa on _resolve_providers (single-purpose validator/merge)
- reportUnknownVariableType: explicit Any annotations + cast around
  tomllib's dict parses; tightens the loader's pyright surface
- reportUnusedFunction: pragma on _should_run_pp (still tested but no
  longer called from cli.py — slated for removal with the deprecated
  flag block); module-header for test fixtures whose use is via pytest
  parameter-name discovery
- Replace `any(x for x in (...))` with plain `or` chain (pyright knows
  the types now)

All in service of getting the work-4byx PR's CI green. No behavior change.
ak2k added a commit that referenced this pull request May 17, 2026
…ork-4uls)

Trims the per-command help output by hiding three implementation-detail
flags nobody touches in normal use, and front-doors output-format selection
behind a single --format flag.

Hidden flags (still work for one-off overrides; just not in --help):
  --rps           reads FLIGHT_RPS env / [http].rps config / default 1.0
  --impersonate   reads FLIGHT_IMPERSONATE / [http].impersonate / "chrome"
  --no-cache      reads FLIGHT_NO_CACHE / [cache].enabled inversion / off

Resolution order: explicit CLI flag wins, then env, then config.toml, then
hard-coded default. Bad env values raise a clear error rather than silent
fallback.

Output format:
  --format {table,json}       new front door; table is the default
  --json                      deprecated alias for --format json; runtime
                              warning, conflicts with explicit --format X
                              for X != json

csv/tsv/yaml were in the original work-4uls plan but deferred to a follow-up:
the cash-itinerary shape isn't naturally tabular without a flattening pass
that deserves its own design. Filing a separate bd issue.

_config.py grew three new helpers (http_rps, http_impersonate, cache_disabled)
and three env-var constants. 28 new tests across test_runtime_knobs.py and
test_format_resolver.py. Pyright clean.

Stacked on top of work-4byx (#12).
@ak2k ak2k merged commit d42897b into main May 17, 2026
2 checks passed
ak2k added a commit that referenced this pull request May 17, 2026
…ork-4uls)

Trims the per-command help output by hiding three implementation-detail
flags nobody touches in normal use, and front-doors output-format selection
behind a single --format flag.

Hidden flags (still work for one-off overrides; just not in --help):
  --rps           reads FLIGHT_RPS env / [http].rps config / default 1.0
  --impersonate   reads FLIGHT_IMPERSONATE / [http].impersonate / "chrome"
  --no-cache      reads FLIGHT_NO_CACHE / [cache].enabled inversion / off

Resolution order: explicit CLI flag wins, then env, then config.toml, then
hard-coded default. Bad env values raise a clear error rather than silent
fallback.

Output format:
  --format {table,json}       new front door; table is the default
  --json                      deprecated alias for --format json; runtime
                              warning, conflicts with explicit --format X
                              for X != json

csv/tsv/yaml were in the original work-4uls plan but deferred to a follow-up:
the cash-itinerary shape isn't naturally tabular without a flattening pass
that deserves its own design. Filing a separate bd issue.

_config.py grew three new helpers (http_rps, http_impersonate, cache_disabled)
and three env-var constants. 28 new tests across test_runtime_knobs.py and
test_format_resolver.py. Pyright clean.

Stacked on top of work-4byx (#12).
ak2k added a commit that referenced this pull request May 17, 2026
…ork-4uls) (#13)

* Surface hygiene: hide --rps/--impersonate/--no-cache, add --format (work-4uls)

Trims the per-command help output by hiding three implementation-detail
flags nobody touches in normal use, and front-doors output-format selection
behind a single --format flag.

Hidden flags (still work for one-off overrides; just not in --help):
  --rps           reads FLIGHT_RPS env / [http].rps config / default 1.0
  --impersonate   reads FLIGHT_IMPERSONATE / [http].impersonate / "chrome"
  --no-cache      reads FLIGHT_NO_CACHE / [cache].enabled inversion / off

Resolution order: explicit CLI flag wins, then env, then config.toml, then
hard-coded default. Bad env values raise a clear error rather than silent
fallback.

Output format:
  --format {table,json}       new front door; table is the default
  --json                      deprecated alias for --format json; runtime
                              warning, conflicts with explicit --format X
                              for X != json

csv/tsv/yaml were in the original work-4uls plan but deferred to a follow-up:
the cash-itinerary shape isn't naturally tabular without a flattening pass
that deserves its own design. Filing a separate bd issue.

_config.py grew three new helpers (http_rps, http_impersonate, cache_disabled)
and three env-var constants. 28 new tests across test_runtime_knobs.py and
test_format_resolver.py. Pyright clean.

Stacked on top of work-4byx (#12).

* ci: empty commit to retrigger checks after base retarget to main
@ak2k ak2k deleted the worktree-work-4byx-provider-namespacing branch May 17, 2026 06:13
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.

1 participant