Repository navigation
fix(engine): a page cannot cannibalise itself - #8
Merged
Merged
Conversation
The keywords table told an owner to "fix 'rapid prototype ai development' keyword cannibalization issues". They had no such problem. The stored value was: ["https://www.hitasoft.com/services/rapid-ai-prototyping", "https://www.hitasoft.com/services/rapid-ai-prototyping"] One page, recorded twice. Cannibalisation is more than one of YOUR OWN pages ranking for a single keyword, so they compete with each other. All three parsers append every matching result to cannibalisationResult, and the same URL can arrive more than once -- as an organic result and again as a sitelink or a variant. The gate then asked `len(...) > 1`, which counts duplicates, so a single page was reported as cannibalising itself. Both ends now count DISTINCT pages: * the parsers store distinct URLs, order preserved -- that is the order the pages ranked in, which is the order a reader expects; * the serializer counts distinct too, so rows written before this fix read correctly without a migration. The live row above stops warning immediately. This is a wrong answer rather than an error, which is the kind no test catches by accident: the feature worked, it was just counting the wrong thing. A test now pins both ends.
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.
The keywords table told an owner to "fix
rapid prototype ai developmentkeyword cannibalization issues". They had no such problem. The stored value was:One page, recorded twice.
Cause
Cannibalisation is more than one of your own pages ranking for a single keyword, so they compete with each other.
All three parsers append every matching result to
cannibalisationResult, and the same URL can arrive more than once — as an organic result and again as a sitelink or a variant. The gate then askedlen(...) > 1, which counts duplicates, so a single page was reported as cannibalising itself.Fix — both ends count distinct pages
Why it survived this long
This is a wrong answer, not an error. The feature worked; it was counting the wrong thing. Nothing crashes, no log line appears, and no test catches it by accident — it needs someone to look at a real keyword and know what cannibalisation means. A test now pins both ends.
263 tests pass.