feat(api,cli,mcp): ranked + classified cited-source rankings (#675)#676
Open
arberx wants to merge 1 commit into
Open
feat(api,cli,mcp): ranked + classified cited-source rankings (#675)#676arberx wants to merge 1 commit into
arberx wants to merge 1 commit into
Conversation
Reworks GET /projects/:name/analytics/sources from a top-5-per-category breakdown into the full ranked, per-provider, classified cited-domain surface an operator acts on. - Contracts: new SurfaceClass taxonomy (own / direct-competitor / ota-aggregator / editorial-media / other) computed DETERMINISTICALLY from already-stored project + competitor domains — zero LLM calls. classifySurfaceFromCategory() is the core; classifySurface(uri) wraps it. SourceBreakdownDto gains ranked + byProvider RankedSourceList views with an explicit long-tail rollup (truncated counts always reconcile to totals) and a surface-class roll-up over the full scope. Major travel OTAs (Tripadvisor, Booking, Expedia, …) added to the category rules. - API: ?limit=N caps each ranked / per-provider list (positive-int validated); probe runs stay excluded. Route now returns a typed SourceBreakdownDto (loose response removed) — SDK regenerated. - CLI: new `canonry sources <project>` (--rank, --by-provider, --limit, --window, --format json|jsonl). - MCP: canonry_analytics_sources (monitoring tier); classification flipped deferred → included. Tests assert the calculation invariants exactly (slot/domain sums reconcile, per-provider totals sum to overall, surface-class roll-up spans the full scope, limit truncation, probe exclusion, empty / infra-only edge cases). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Reworks
GET /projects/:name/analytics/sourcesfrom a top-5-per-category breakdown into the full ranked, per-provider, classified cited-domain surface an operator acts on — exposed via a newcanonry sourcescommand and thecanonry_analytics_sourcesMCP tool.own/direct-competitor/ota-aggregator/editorial-media/other) computed deterministically from already-stored project + competitor domains (zero LLM calls); major travel OTAs (Tripadvisor, Booking, Expedia, …) added to the category rules.SourceBreakdownDtogainsranked+byProviderlists with an explicit long-tail rollup (truncated counts always reconcile to totals) and a full-scope surface-class roll-up;?limit=Ncaps each list, probe runs stay excluded, and the route is now a typed response (loose response removed, SDK regenerated).