feat(tui): venues visibility and the help & glossary system (#394 C7) - #406
Merged
Conversation
The console PRD's C7 slice -- O7 (venues/brokers visibility) and O8 (the help & glossary system), one service per truth and two front-ends over it. The brokers service (O7): `keel.commands.brokers.list_installed_brokers()` walks the entry-point registry (`discover_brokers()`), constructs each adapter credential-less, and renders one BrokerInfo per installed adapter -- name, venue, wired-for-deployment vs optional-dev-venue (ONE explicit constant, `WIRED_FOR_DEPLOYMENT`, with its reasoning in place), session- bound or 24/7, quote currencies, asset classes, order kinds, preview synthesis (native/synthesized/none), fee summary, the ADAPTER's declared endpoint vocabulary and data feeds (new DECLARED_ENDPOINTS/ DECLARED_DATA_FEEDS on AlpacaAdapter, derived from TRADING_HOSTS and SUPPORTED_DATA_FEEDS), and the package version. Capability display only -- never key-presence inference (#233-aligned), no secret material anywhere (the field set is closed and pinned). Front-ends: `keel brokers list` (--json follows status --json's convention) and the TUI Venues browser under Profile (`console.build_venues_lines`) -- the browser renders the service's own shared wording (`brokers.capability_facts`), the SELECTED adapter is highlighted and the active deployment's binding (config+db pair, endpoint/data feed where the venue declares them) is named; the two-front-ends-one-payload equality is pinned by test. The glossary (O8): docs/glossary.md is the ONE hand-written home for console term definitions -- seeded with the console's needed vocabulary (rail, attestation + instrument attestation, exemption, screening, promotion gate, paper/live mode, kill switch, autonomy, qabd, riba, gharar, maysir/maisir, purification, session-bound venue, market clock, trust window, DCA benchmark, granularity, trials ledger). The fiqh terms' definitions are VERBATIM passages of docs/fiqh-basis.md with their section citations, and gharar says "not stated" there exactly as C3's shariah screen does -- pinned against the document, and pinned equal to the shariah screen's own vocabulary so the surfaces cannot drift. The TUI renders it bounded-read and mtime-cached (the research readers' discipline); rule-PARAMETER help is never duplicated: the Help menu's parameter view renders `rules.describe_params` -- the rule classes' own docstrings, defaults and types, by introspection. The contextual help registry (O8): every console module contributes its screens' "what am I looking at" / "what will this do" rows (CONTEXT_HELP, plain subject/description pairs kept WITH the owning module; keel.commands.help_console is the registry and renderer), `?` opens the current mode's overlay from EVERY console mode (pinned by a structural scan of run_live's dispatch), and the Help menu becomes real: glossary, screens & actions (the consolidated catalog), rule parameters, keys & safety. The typed actions' help states the prompt cannot be pre-filled. Fixes #394
eaitbrahim
added a commit
that referenced
this pull request
Aug 19, 2026
…te contextual help (#407) Thirteen adversarial-review findings on PR #406: Blockers: - bind ? in the discover overlay (the one dispatched mode without it); the every-mode structural test now extracts run_live's dispatch blocks by AST span, so the last block can no longer absorb the normal mode's ? handler and pass dishonestly - glossary rail entry: eighteen guards (guards.py and fiqh-basis both say eighteen), and the Source line cites the rails table's true coverage (prudential rails 2-14, 16) with rails 1/17/18/19 as prose sections - glossary promotion gate entry: the four floors (min_trades, min_expectancy, min_rr, min_win_rate) AND the PBO/degradation-slope conjunction; pooling stated as per-parameter-set, sample-size axis only, overfitting gate NOT pooled; the DCA comparison located in the simulate report, not the gate Major: - one raising adapter no longer kills the brokers listing: the service renders an honest error row (name + error, 78-col wrapped) and both front-ends (keel brokers list, the Venues browser) ride the same total service Minor/nits: - keys-&-safety rows state the C7 reality (h opens the Help menu, ? opens the context overlay, closes return to the Help menu) and the console menus are described as the live C3-C5 menus they are - m closes the context-help overlay; ? opens it from the keys-&-safety screen too; dead profile_menu_venues_at wired into the live loop - glossary autonomy/attestation sentences completed (attestation kept a verbatim contiguous fiqh-basis passage, twin-updated in the shariah screen's vocabulary) - record-flow/reset-hwm help rows carry the cannot-be-pre-filled disclosure; screening and instrument attestation added to the verbatim fiqh pins; WIRED_FOR_DEPLOYMENT derived from the tracked configs' own broker.name selections as a drift guard
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.
Closes the console PRD's C7 slice: O7 (venues/brokers visibility, service-first) and O8 (the newbie help & glossary system). Test-first: the new suites were written red (
tests/commands/test_brokers.py,tests/commands/test_help_console.py— both failed at import before a line of implementation), then made green.The brokers service (O7) — one service, two front-ends
keel/commands/brokers.py::list_installed_brokers()walks the entry-point registry (discover_brokers()), constructs each adapter credential-less, and renders one frozenBrokerInforow per installed adapter:capabilities(), the newDECLARED_ENDPOINTS/DECLARED_DATA_FEEDSonAlpacaAdapter— derived fromTRADING_HOSTS/SUPPORTED_DATA_FEEDS, never a second list). Pinned: the payload fields equal the adapters' declarations, per field.NO_KEY_INFERENCE_LINE.WIRED_FOR_DEPLOYMENT = {coinbase, alpaca}) with its reasoning in place — no registry signal carries it.keel brokers list(+--jsonfollowingstatus --json's convention, no disclaimer after JSON; the README's trademark line in the docstring) and the TUI Venues browser under Profile (console.build_venues_lines): same payload via the service's sharedcapability_factswording, the SELECTED adapter highlighted[selected], the active deployment's binding (config+db pair; endpoint/data feed where the venue declares them) named. The one-payload/two-front-ends equality is pinned by test; the browser's facts are read once per entry, never per poll.The glossary (O8) — one source, anchored
docs/glossary.mdis the ONE new hand-written file and the only place console terms are defined. Seeded with the console's needed terms (rail; attestation + instrument attestation; exemption; screening; promotion gate; paper/live mode; kill switch; autonomy; qabd; riba; gharar; maysir/maisir alias; purification; session-bound venue; market clock; trust window; DCA benchmark; granularity; trials ledger). Design as built:docs/fiqh-basis.md, each carrying the document's exact section heading as its citation;ghararsays "not stated in docs/fiqh-basis.md" exactly as C3's shariah screen does. Pinned against the document (spot-pins: qabd, riba word-for-word) and pinned equal tocompliance_console.VOCABULARY, so the two surfaces cannot drift.MAX_GLOSSARY_BYTES,cached_glossaryper(path, mtime_ns)); an absent file (an installed deployment has no docs/ checkout) is a calm empty state naming the path.rules.describe_params(the classes' own docstrings/defaults/types/choices, by introspection) — pinned to containdescribe_params' actual doc strings forturtle_breakout's full param set; the glossary'sgranularityentry points there too.The contextual help registry (O8)
Each console module owns its screens' rows (
CONTEXT_HELP: plain(subject, description)pairs keyed by mode — text lives with the module that owns the screen);keel/commands/help_console.pyis the registry (CONSOLE_MODES+ lazy mode→owner resolution) and renderer.?opens the current mode's overlay from every console mode and q/Esc/? returns to the screen it was opened from — pinned three ways: the registry is total overrun_live's dispatched modes, a structural scan asserts everymode ==branch inrun_livehandlesord("?"), and behavioral run_live tests drive the overlay open/close. The typed actions' help states the prompt cannot be pre-filled (pinned: ≥4 occurrences, on the trading/compliance/strategy screens). The Help menu entry becomes a real sub-menu: glossary · screens & actions (the consolidated catalog) · rule parameters · keys & safety (the pre-C7 help screen, kept whole).Gates
uv run pytest -q— 3598 passed, 3 skippeduv run ruff check keel tests packages— cleanuv run mypy— clean (277 files)Fixes #394