Treat non-US reverse DNS prefixes as category roots - #8697
Open
timtebeek wants to merge 1 commit into
Open
Conversation
A recipe library published under, say, `uk.co.acme.recipes` had no matching category descriptor for `uk`, so the marketplace synthesized one and rendered the library under a meaningless "Uk" > "Co" > "Acme" path. Marking these prefixes as roots drops them from the displayed path, both in `CategoryTree` and in the category inference `YamlRecipeBundleReader` does from a recipe name. Second level domains (`uk.co`, `jp.co`, `au.com`, ...) are rooted alongside their parent, otherwise dropping "Uk" only promotes "Co" to the top level. Matching is anchored at the full partial package, so a segment named `co` deeper in a package is unaffected.
This was referenced Aug 28, 2026
Member
Author
|
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.
Symptom
A customer publishing a recipe library under a non-US reverse DNS prefix shows up in the marketplace nested under a meaningless top-level segment.
uk.co.acme.recipesrenders as Uk > Co > Acme > Recipes;de.example.recipesrenders as De > Example > Recipes.This happens because a package segment with no matching category descriptor gets a synthetic category built from its capitalized name.
com,org,io,ai,techandsoftwarealready haveroot: truedescriptors incore-categories.yml— everything else does not.Fix
Add
root: truecategory descriptors torewrite-core/src/main/resources/META-INF/rewrite/core-categories.yml. A root descriptor is not rendered as a node and its children are hoisted, which is enforced inCategoryTree.getCategories()and inYamlRecipeBundleReader.inferCategoriesFromName().Generic TLDs:
Country code TLDs:
Second level domains, rooted in addition to their parent — without these, dropping "Uk" only promotes "Co" to the top level:
Matching is anchored at the full partial package (
uk.co, not any segment namedco), so short entries that are also English words are only ever consumed in first position. Nothing that could plausibly be a category in its own right is rooted.nois quoted, since YAML 1.1 would otherwise resolve it to a boolean.Tests
CategoryTreeTest#reverseDnsPrefixesAreCategoryRoots—uk.co.acmeandde.exampleare top-level categories;uk,uk.coanddeare not.YamlRecipeBundleReaderTest#twoSegmentReverseDnsPrefixesAreOmittedFromTheInferredPath—uk.co.acme.recipes.FindAndReplaceinfersAcme>Recipes.YamlRecipeBundleReaderTest#singleSegmentReverseDnsPrefixesAreOmittedFromTheInferredPath—de.example.recipes.SomeRecipeinfersExample>Recipes.All three fail against the current
core-categories.ymland pass with it.