Repository navigation
feat(lookup): add Catalog::lookup_entries for listing a kind's vocabulary - #509
Merged
Merged
Conversation
…lary lookup_entries returns one LookupMatch per entry of a listable kind in catalog order, with no matching or ranking: Builtin matches for Action, Value, and Event, EnumDomain matches for Enum. Both are built by the same per-entry constructors lookup uses, so the two cannot diverge. Undeclared locales and non-listable kinds return WorkshopError::Unsupported. Wright's listEntries operation (ADR-0031, wrightkit/wright#799) pages over the result; enum members remain covered by lookup_within. Fixes #506
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
Adds
Catalog::lookup_entries(locale, kind)— a public call that returns oneLookupMatchper catalog entry of a listable kind in catalog order, with no query, matching, or ranking. This supplies the owner side of Wright'slistEntriesoperation (ADR-0031, wrightkit/wright#799): Wright pages over the result and assembles no signatures.Kind::Action,Kind::Value,Kind::Event→LookupMatch::Builtin, signature included.Kind::Enum→LookupMatch::EnumDomainper declared domain; enum members remain covered bylookup_withinwith no query.WorkshopError::Unsupported, as inlookup; non-listable kinds (Structural,Operator,Setting) →WorkshopError::Unsupported.lookup's loops (builtin_match,enum_domain_match, sharedcheck_locale), so listing and ranked lookup cannot diverge.LookupMatchvariants added or reordered; no catalog-generated items (ADR-0016).docs/lookup.md: new "Listing entries" section next to "Scoped lookup".Fixes #506
Test plan
listing_entries_keeps_catalog_order_for_each_builtin_kind: for Action, Value, and Event the listed ids equalentries_of(kind)ids in the same order, no duplicates.listing_entries_keeps_catalog_order_for_enum_domains: listed domains equalenum_domains()in the same order.listed_entries_are_the_matches_lookup_returns: every listed entry of each listable kind equals thelookupmatch of the same kind and id for a query of that id — in en-US (primary) and zh-CN. The comparison matches on kind and id becausemodifyGlobalVariableis declared under bothStructuralandAction, so a bare-id query can rank a different kind's Builtin first.listing_entries_rejects_undeclared_locales_and_unlistable_kinds: undeclared locale and non-listable kinds returnWorkshopError::Unsupported.cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace --all-targets,cargo run -p workshop-rs --bin workshop-catalog-gen -- check,cargo +1.85.0 clippy --workspace --all-targets -- -D warnings,cargo +1.85.0 test --workspace --all-targets,git diff --check— all pass locally.