fix: keep KNOWN_PROVIDERS in sync with PROVIDERS registry (#53) - #54
Merged
Conversation
…demo GIFs
`--provider fixture` was rejected at runtime even though argparse advertised
it as a valid choice. Argparse reads choices from `PROVIDERS.keys()`, but
`load_config` validated against a hardcoded `KNOWN_PROVIDERS = {"yahoo",
"tradier"}` that drifted when FixtureProvider was added. This made
`tenortui --provider fixture` fail with `Configuration error: Unknown
provider 'fixture'`, which is what got captured in the docs-site demo GIFs
— rendering them as broken-looking shell-error videos.
- Derive `KNOWN_PROVIDERS` from `PROVIDERS.keys()` so the registry is the
single source of truth.
- Add a regression test that asserts every registered provider is accepted
by `load_config(provider_override=...)`.
- Update settings-screen test to compute the next provider from
`KNOWN_PROVIDERS` rather than hardcoding "tradier".
- Add comments to the three VHS tapes documenting why `--provider fixture`
is the right choice (deterministic, offline, no API keys).
- Re-record `launch-and-search.gif`, `expiry-and-greeks.gif`, and
`watchlist-flow.gif` so the docs site shows the working TUI.
Closes #53
Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
Closes #53.
The "See it in action" GIF on https://jayravaliya.com/tenor-tui/ was rendering as a broken shell-error video because of a config-validation bug, not (just) a stale-asset issue.
Root cause:
--provider fixturelooked valid (argparse reads choices fromPROVIDERS.keys()), butload_config()validated the resolved provider against a hardcodedKNOWN_PROVIDERS = {"yahoo", "tradier"}that had drifted whenFixtureProviderwas added. Sotenortui --provider fixtureexited withConfiguration error: Unknown provider 'fixture', and that error is exactly what VHS captured into the demo GIFs.Fix:
src/tenortui/config.py— deriveKNOWN_PROVIDERSfromPROVIDERS.keys()so the registry is the single source of truth.tests/test_config.py— add a parametrized regression test that asserts every registered provider is accepted byload_config(provider_override=...), plus a guard thatKNOWN_PROVIDERSmatchesPROVIDERS.keys().tests/test_settings_screen.py— provider-cycle test now computes the expected next provider fromKNOWN_PROVIDERSinstead of hardcoding"tradier"(which was correct only when fixture was excluded).docs/tapes/*.tape— added a comment to each tape documenting why--provider fixtureis the right choice for recordings.docs/site/docs/assets/demos/*.gif— all three demo GIFs re-recorded against the fixed code; they now show the working TUI instead of shell errors.CHANGELOG.md— entry under[Unreleased] / Fixed.Test plan
poetry run python -m pytest— 434 passedpoetry run ruff check src/ tests/— cleanpoetry run ruff format --check src/ tests/— 56 files formattedmake docs-strict— builds cleanmake demos— all 3 GIFs regenerated; spot-checked frames show TUI options chain rendering withfixtureprovider (not the previous shell-error capture)Notes / follow-ups
fixturebecause it sorts viaKNOWN_PROVIDERS. That's a minor UX wart (an end user pressing Enter on the default-provider row could land on the demo provider). Hiding internal-only providers from user-facing pickers is a reasonable separate ticket — kept it out of this PR to keep the diff focused on the bug.Co-authored by Claude