feat(monitoring): attribute SaaS citations by registrable domain

Persist host/registrable_domain/site_key on monitoring article URL
aliases, populate them on desktop-publish completion, and use them in
the citation pipeline to count how often SaaS-published content
appears as a citation source. Expose a /citation-summary endpoint with
a 7/30-day window switch and surface the new source-share metrics in
the tracking dashboard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-30 17:12:09 +08:00
parent 6e6e19cccb
commit fb166fa9fe
15 changed files with 836 additions and 143 deletions
@@ -425,6 +425,26 @@ func TestBuildMonitoringCitationFactCanDisableContentResolution(t *testing.T) {
}
}
func TestScoreMonitoringAliasCandidateUsesDomainWithTitleEvidence(t *testing.T) {
lastPath := "article-42"
input := monitoringAliasLookupInput{
NormalizedURL: "https://m.example.com/article-42",
RegistrableDomain: "example.com",
LastPathSegment: &lastPath,
TitleKey: normalizeMonitoringAliasTitle("北京口腔医院全面测评"),
}
candidate := monitoringAliasCandidate{
NormalizedURL: "https://www.example.com/posts/article-42",
RegistrableDomain: "example.com",
LastPathSegment: "article-42",
TitleKey: normalizeMonitoringAliasTitle("北京口腔医院全面测评"),
}
if score := scoreMonitoringAliasCandidate(input, candidate); score < 90 {
t.Fatalf("scoreMonitoringAliasCandidate() = %d, want strong domain/title match", score)
}
}
func TestBuildMonitoringRawPayloadDeepSeekIncludesSearchResultsInCitationInputs(t *testing.T) {
searchTitle := "搜索网页结果"