refactor(collections): rule evaluators take the real row; both 45-field converter twins deleted

checkRulesAgainstBook/evaluateRule and the service's EvaluateRules
existed in two parallel universes: one over database.MediaItems (what
every query actually returns) and one over ListMediaItemsRow (what two
hand-written 45-field mediaItemsToListMediaItemsRow converters
produced — verbatim twins in the handler and the dashboard service,
with a URL-resolution side effect baked into a "converter"). The rule
fields (genre/series/author/language/publisher/copyright_year/tags)
all exist on MediaItems, so the evaluators now take the real row and
the converters, their three call-site loops, and the dead
ApplyAutoAssignRules entry point (zero callers) are gone.

The rules surface is wire-covered by the collections rules scenarios;
handlers+services suites and the full pin/H1/H3 battery green.
This commit is contained in:
John O'Keefe committed 2026-10-17 16:48:39 -04:00
1 parent b47a2b86a7
commit 18727fef93
7 files changed
+54 -193

No files matched your search

+3 -3
View File
@@ -51,7 +51,7 @@ func TestCompareValues_NotEquals(t *testing.T) {
}
func TestEvaluateRule_Genre(t *testing.T) {
item := database.ListMediaItemsRow{
item := database.MediaItems{
Genre: pgtype.Text{String: "Science Fiction", Valid: true},
}
@@ -65,7 +65,7 @@ func TestEvaluateRule_Genre(t *testing.T) {
}
func TestEvaluateRule_Author(t *testing.T) {
item := database.ListMediaItemsRow{
item := database.MediaItems{
Author: pgtype.Text{String: "Isaac Asimov", Valid: true},
}
@@ -79,7 +79,7 @@ func TestEvaluateRule_Author(t *testing.T) {
}
func TestEvaluateRule_CopyrightYear(t *testing.T) {
item := database.ListMediaItemsRow{
item := database.MediaItems{
CopyrightYear: pgtype.Int4{Int32: 2021, Valid: true},
}