aboutsummaryrefslogtreecommitdiff
path: root/cmds/rss_test.go
diff options
context:
space:
mode:
authorSam Scholten2026-08-30 20:34:38 +1000
committerSam Scholten2026-08-30 20:34:38 +1000
commiteff960c54620bfba47d40bc3792ba805dea3dab3 (patch)
treea04fd365bb08a5a043b99665f8d7435ba1e989e0 /cmds/rss_test.go
parent25f47ca899527ed2b16d19209c0546413e057126 (diff)
downloadfluxrec-eff960c54620bfba47d40bc3792ba805dea3dab3.tar.gz
fluxrec-eff960c54620bfba47d40bc3792ba805dea3dab3.zip
rss: provenance + score calibration in items
Item titles gain a rune-capped source-feed suffix so list views (which only ever show the channel title) display provenance inline. Item bodies open with feed, model score, and the batch-wide score median; the median is computed over every scored entry at poll time and stored on the run row as a nil-safe pointer, so old rows render without it. /api/status exposes the median too.
Diffstat (limited to 'cmds/rss_test.go')
-rw-r--r--cmds/rss_test.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/cmds/rss_test.go b/cmds/rss_test.go
index 406f853..ca216ca 100644
--- a/cmds/rss_test.go
+++ b/cmds/rss_test.go
@@ -13,20 +13,22 @@ func TestRenderRSSGolden(t *testing.T) {
at := func(day, h, m int) time.Time {
return time.Date(2024, 3, day, h, m, 0, 0, time.UTC)
}
+ med := 0.55 // over all scored entries in the first batch, not just kept
runs := []core.RunRow{
{
- RanAt: at(1, 6, 0), EntriesSeen: 40,
+ RanAt: at(1, 6, 0), EntriesSeen: 40, ScoreMedian: &med,
Kept: []core.KeptItem{
{EntryID: 101, URL: "https://example.com/a?x=1&y=2", Title: "Alpha & Omega",
FeedTitle: "Feed A", PublishedAt: at(1, 5, 0),
Content: "x < y", Score: 0.9, Kind: core.KindRanked},
{EntryID: 102, URL: "https://example.com/b", Title: "Beta",
- FeedTitle: "Feed B", PublishedAt: at(1, 5, 30),
- Content: "second body", Score: 0.2, Kind: core.KindRandom},
+ FeedTitle: "A Feed With An Extremely Long And Descriptive Title Here",
+ PublishedAt: at(1, 5, 30),
+ Content: "second body", Score: 0.2, Kind: core.KindRandom},
},
},
{
- RanAt: at(1, 12, 0), EntriesSeen: 12,
+ RanAt: at(1, 12, 0), EntriesSeen: 12, // nil median: pre-field run row
Kept: []core.KeptItem{
{EntryID: 103, URL: "https://example.com/c", Title: "Gamma",
FeedTitle: "Feed A", PublishedAt: at(1, 11, 0),
@@ -45,25 +47,25 @@ func TestRenderRSSGolden(t *testing.T) {
<title>fluxrec recommendations</title>
<description>Top-scored Miniflux entries, refreshed on a schedule.</description>
<item>
- <title>Gamma</title>
+ <title>Gamma — Feed A</title>
<link>https://example.com/c</link>
<guid isPermaLink="false">mf:103</guid>
<pubDate>Fri, 01 Mar 2024 11:00:00 +0000</pubDate>
- <description>Feed A</description>
+ <description>Feed A · score 0.80</description>
</item>
<item>
- <title>Alpha &amp; Omega</title>
+ <title>Alpha &amp; Omega — Feed A</title>
<link>https://example.com/a?x=1&amp;y=2</link>
<guid isPermaLink="false">mf:101</guid>
<pubDate>Fri, 01 Mar 2024 05:00:00 +0000</pubDate>
- <description>Feed A&#xA;&#xA;x &lt; y</description>
+ <description>Feed A · score 0.90 · batch median 0.55&#xA;&#xA;x &lt; y</description>
</item>
<item>
- <title>Beta</title>
+ <title>Beta — A Feed With An Extremely Long And Descri…</title>
<link>https://example.com/b</link>
<guid isPermaLink="false">mf:102</guid>
<pubDate>Fri, 01 Mar 2024 05:30:00 +0000</pubDate>
- <description>Feed B&#xA;&#xA;second body</description>
+ <description>A Feed With An Extremely Long And Descriptive Title Here · score 0.20 · batch median 0.55&#xA;&#xA;second body</description>
</item>
</channel>
</rss>`