fix(graphs): return the extension display name instead of dropping it - #1321
Merged
Conversation
`getAvailableExtensions` built a display_names table, looked each extension up in it, put the result in a dict — and then discarded it when constructing the AvailableExtension response objects, which only carry name, description and enabled. So the only human-readable label the endpoint has never left it. Clients render `name`, which is the schema slug the create path takes, and the graph creation wizard headings its extension cards "roboledger" and "roboinvestor" is the visible consequence. Add display_name to the model and populate it on both paths. The fallback branch never had one at all, so hoist the table to module scope next to the descriptions it belongs with, where the same comment already explains why the constants are single-sourced. The field is optional so an older client is unaffected, and clients should fall back to the slug when it is absent.
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.
getAvailableExtensionsbuilds a display-names table, looks each extension upin it, puts the result in a dict — and then drops it when constructing the
AvailableExtensionresponse objects, which carry onlyname,descriptionand
enabled:So the only human-readable label the endpoint has never leaves it. Clients get
name, which is the schema slug the create path takes, and the visibleconsequence is the graph creation wizard heading its extension cards
"roboledger" and "roboinvestor" — plus the required-extensions alert listing
slugs.
Found while fixing dark-mode issues in that same wizard
(robosystems-app#351).
Change
display_nameadded toAvailableExtension, optional so an older client isunaffected; clients fall back to the slug when it is absent.
so the table is hoisted to module scope beside the descriptions, where the
existing comment already explains why those constants are single-sourced.
against the old source (
KeyError), so it is not vacuous.Follow-up (not in this PR)
The apps can't use the field until the TypeScript client is regenerated and
released, then adopted. Happy to take that chain next if you want it.
just test-codeclean;pytest tests/routers/graphs tests/modelsgreen(1735 passed, 4 skipped).