H1: Josie harvest semantics in autopilot

Replace retry-to-success grind with one-roll-per-charge. Every node
swing — Common through Legendary — consumes a charge regardless of
outcome. Rarity no longer pauses the autopilot.

Removed: autoHarvestPerNodeAttempts cap, isRarePlus filter, RarePending
field, renderRarePendingFooter, stopRareNode reason. Pluralize "fails"
since whiffs are now expected.

Per gogobee_harvest_charges_plan.md H1.
This commit is contained in:
prosolis
2026-05-17 12:24:18 -07:00
parent 3b5a6ad4b8
commit 20689a693b
4 changed files with 32 additions and 138 deletions

View File

@@ -10,26 +10,6 @@ import (
// region state) and lives behind the same setupAuditTestDB gate as the
// other expedition tests.
func TestIsRarePlus(t *testing.T) {
cases := []struct {
in DnDRarity
want bool
}{
{RarityCommon, false},
{RarityUncommon, false},
{RarityRare, true},
{RarityEpic, true},
{RarityVeryRare, true},
{RarityLegendary, true},
{"", false},
}
for _, c := range cases {
if got := isRarePlus(c.in); got != c.want {
t.Errorf("isRarePlus(%q) = %v, want %v", c.in, got, c.want)
}
}
}
func TestRenderAutoHarvestFooter_EmptyIsEmpty(t *testing.T) {
s := autoHarvestSummary{Yields: map[string]int{}, Names: map[string]string{}}
if got := renderAutoHarvestFooter(s); got != "" {
@@ -57,6 +37,12 @@ func TestRenderAutoHarvestFooter_YieldsAndFailsAndNoise(t *testing.T) {
if !strings.Contains(got, "1 close call") || strings.Contains(got, "close calls") {
t.Errorf("expected singular 'close call', got %q", got)
}
// Plural "fails" when fails>1 — Josie semantics make this common.
s.Fails = 3
got = renderAutoHarvestFooter(s)
if !strings.Contains(got, "3 fails") {
t.Errorf("expected plural 'fails', got %q", got)
}
}
func TestRenderWalkTally_EmptyIsEmpty(t *testing.T) {
@@ -78,33 +64,3 @@ func TestRenderWalkTally_SortsByID(t *testing.T) {
t.Errorf("Alphite should precede Zinc: %q", got)
}
}
func TestRenderRarePendingFooter_EmptyIsEmpty(t *testing.T) {
if got := renderRarePendingFooter(nil); got != "" {
t.Errorf("expected empty rare-pending footer, got %q", got)
}
}
func TestRenderRarePendingFooter_DedupsByID(t *testing.T) {
r := ZoneResource{ID: "war_standard", Name: "Hobgoblin War Standard", Rarity: RarityRare, Action: HarvestScavenge}
got := renderRarePendingFooter([]ZoneResource{r, r, r})
// Single mention even with 3 copies in the pending slice.
if strings.Count(got, "Hobgoblin War Standard") != 1 {
t.Errorf("expected single mention, got %q", got)
}
if !strings.Contains(got, "!scavenge") {
t.Errorf("expected action hint '!scavenge' in footer, got %q", got)
}
if !strings.Contains(got, "Rare") {
t.Errorf("expected rarity label in footer, got %q", got)
}
}
func TestRenderRarePendingFooter_MultiplePlural(t *testing.T) {
a := ZoneResource{ID: "a", Name: "Aaa", Rarity: RarityRare, Action: HarvestForage}
b := ZoneResource{ID: "b", Name: "Bbb", Rarity: RarityVeryRare, Action: HarvestForage}
got := renderRarePendingFooter([]ZoneResource{a, b})
if !strings.Contains(got, "are sitting in this room") {
t.Errorf("expected plural verb for two items, got %q", got)
}
}