Skip to content

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

Merged
ak2k merged 2 commits into
mainfrom
worktree-work-4uls-surface-hygiene
May 17, 2026
Merged

Surface hygiene: hide --rps/--impersonate/--no-cache, add --format (work-4uls)#13
ak2k merged 2 commits into
mainfrom
worktree-work-4uls-surface-hygiene

Conversation

@ak2k

@ak2k ak2k commented May 17, 2026

Copy link
Copy Markdown
Owner

Stacked on top of #12 (work-4byx provider namespacing). Once #12 merges, retarget this PR's base to `main` (per gh_stacked_pr_base_branch_deletion, don't merge #12 with `--delete-branch` while this PR still depends on the branch).

Summary

Trims `flight` command help screens by hiding three implementation-detail flags users almost never touch, and front-doors output-format selection behind a single `--format` flag in preparation for future formats.

Closes the surface-hygiene half of bd `work-4uls`.

What changed

Hidden flags (still functional for one-off overrides; just removed from `--help` output):

  • `--rps` — reads `FLIGHT_RPS` env → `[http].rps` config → default `1.0`
  • `--impersonate` — reads `FLIGHT_IMPERSONATE` env → `[http].impersonate` config → default `"chrome"`
  • `--no-cache` — reads `FLIGHT_NO_CACHE` env → `[cache].enabled` inversion → default cache-on

Resolution order: explicit CLI flag wins, then env, then config.toml, then default. Bad env values (e.g. `FLIGHT_RPS=foo`) raise a clear error rather than silently falling through.

Output format:

  • `--format {table,json}` — new front door, default `table`
  • `--json` — deprecated alias for `--format json`. Runtime warning; `--json --format X` for `X != json` errors out.

Scope deferred

`csv` / `tsv` / `yaml` were listed in the original `work-4uls` bd body. After surveying the cash-itinerary shape (nested itinerary → slice → leg), they're more than just "add an emitter" — they need a flattening pass with deliberate column choices. I'm filing a separate bd issue for those rather than rushing them in this PR. The `--format` plumbing is the strategically important piece; emitters layer on later.

Test plan

  • 222 tests pass (28 new across `test_runtime_knobs.py` + `test_format_resolver.py`)
  • Pyright clean: `0 errors, 0 warnings, 0 informations`
  • Live smoke: `flight search --help` no longer shows the three hidden flags; `--format json` emits JSON; `--json` still works with deprecation warning; bad format rejected; `FLIGHT_RPS=2.0` overrides default

Help-screen size

Before: 28 visible flags on `flight search --help`. After: 25 visible. Combined with the deprecations already landed in #12, the help screen is materially less crowded for the common-path user.

@ak2k ak2k force-pushed the worktree-work-4uls-surface-hygiene branch from 949f2a6 to d87de40 Compare May 17, 2026 04:53
ak2k added a commit that referenced this pull request May 17, 2026
`flight search --help` (and calendar/detail) now show flags grouped into
named panels: Itinerary / Filtering / Output / Backend & providers.
Same group names across commands so the user gets a consistent mental
map. Zero behavior change — pure rendering.

--slice parser now surfaces the specific failure mode instead of the
generic "should be ORIGIN-DEST:DATE[:r=...:e=...]":
  - missing date         → "missing date — expected ORIGIN-DEST:DATE..."
  - malformed origin-dest → "missing '-' between origin and destination"
  - empty origin/dest    → "must both be non-empty"
  - invalid date         → "invalid date 'YYYY-MM-DD'"
  - unknown key prefix   → "unknown key prefix in 'r-LH+'; valid keys are
                          r=ROUTING and e=EXTENSION (note the '=')"

The unknown-key-prefix branch closes a silent-failure path: typing
`r-LH+` instead of `r=LH+` previously got dropped by the lookahead split
without warning, so the user got a search that ignored their routing.

10 new tests in tests/test_slice_diagnostics.py pin each error path.

Stacked on top of work-4uls (#13).
@ak2k ak2k changed the base branch from worktree-work-4byx-provider-namespacing to main May 17, 2026 05:30
@ak2k ak2k closed this May 17, 2026
@ak2k ak2k reopened this May 17, 2026
ak2k added 2 commits May 17, 2026 01:37
…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 force-pushed the worktree-work-4uls-surface-hygiene branch from 7e9926a to 8409d8e Compare May 17, 2026 05:52
@ak2k ak2k merged commit 7ae4fff into main May 17, 2026
2 checks passed
ak2k added a commit that referenced this pull request May 17, 2026
`flight search --help` (and calendar/detail) now show flags grouped into
named panels: Itinerary / Filtering / Output / Backend & providers.
Same group names across commands so the user gets a consistent mental
map. Zero behavior change — pure rendering.

--slice parser now surfaces the specific failure mode instead of the
generic "should be ORIGIN-DEST:DATE[:r=...:e=...]":
  - missing date         → "missing date — expected ORIGIN-DEST:DATE..."
  - malformed origin-dest → "missing '-' between origin and destination"
  - empty origin/dest    → "must both be non-empty"
  - invalid date         → "invalid date 'YYYY-MM-DD'"
  - unknown key prefix   → "unknown key prefix in 'r-LH+'; valid keys are
                          r=ROUTING and e=EXTENSION (note the '=')"

The unknown-key-prefix branch closes a silent-failure path: typing
`r-LH+` instead of `r=LH+` previously got dropped by the lookahead split
without warning, so the user got a search that ignored their routing.

10 new tests in tests/test_slice_diagnostics.py pin each error path.

Stacked on top of work-4uls (#13).
ak2k added a commit that referenced this pull request May 17, 2026
* Help-screen grouping + better --slice diagnostics (work-ixhv)

`flight search --help` (and calendar/detail) now show flags grouped into
named panels: Itinerary / Filtering / Output / Backend & providers.
Same group names across commands so the user gets a consistent mental
map. Zero behavior change — pure rendering.

--slice parser now surfaces the specific failure mode instead of the
generic "should be ORIGIN-DEST:DATE[:r=...:e=...]":
  - missing date         → "missing date — expected ORIGIN-DEST:DATE..."
  - malformed origin-dest → "missing '-' between origin and destination"
  - empty origin/dest    → "must both be non-empty"
  - invalid date         → "invalid date 'YYYY-MM-DD'"
  - unknown key prefix   → "unknown key prefix in 'r-LH+'; valid keys are
                          r=ROUTING and e=EXTENSION (note the '=')"

The unknown-key-prefix branch closes a silent-failure path: typing
`r-LH+` instead of `r=LH+` previously got dropped by the lookahead split
without warning, so the user got a search that ignored their routing.

10 new tests in tests/test_slice_diagnostics.py pin each error path.

Stacked on top of work-4uls (#13).

* ci: empty commit to retrigger checks after base retarget to main
@ak2k ak2k deleted the worktree-work-4uls-surface-hygiene 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