From e3e3befc894dc7671cc48608afe6bd093b391654 Mon Sep 17 00:00:00 2001 From: PureXYZ <13581337+PureXYZ@users.noreply.github.com> Date: Sun, 14 Jun 2026 17:30:29 -0400 Subject: [PATCH] Key drop-call latch on SteamID64, not Steam name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "drop them a rifle" coda dedup'd on the broke friend's Steam display name, so a mid-match name change would let the same drop call re-fire — the old name was latched, the new one wasn't recognized. Identity everywhere else is already SteamID64-keyed; this was the one name-as-key spot. Thread the feed's SteamID64 (the feed map key) into each econ entry and key the per-match latch on it, falling back to the name only when a fixture omits the id. The displayed name still comes live from GSI, so a rename shows the new name without re-triggering the call. Adds a regression test: same SteamID, name flips Mouse -> m0use between freezes, drop coda stays suppressed. Co-Authored-By: Claude Opus 4.8 (1M context) --- scripts/simulate.ts | 14 ++++++++++++++ src/coach/lines.ts | 9 ++++++--- src/gsi/roster.ts | 1 + src/gsi/types.ts | 6 ++++-- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/scripts/simulate.ts b/scripts/simulate.ts index edd0a41..69848d6 100644 --- a/scripts/simulate.ts +++ b/scripts/simulate.ts @@ -1558,6 +1558,20 @@ console.log("\n=== scenario: B6 — LLM-off economy drop coda (kitted primary const second = economyLine(kitted(econ), latch); expect(!!first && first.includes("Mouse"), "first drop call names the broke friend"); expect(!/Mouse/.test(second ?? ""), "the drop latch suppresses re-naming the same friend next freeze"); + + // Mid-match Steam-name change: the latch keys on the stable SteamID64, so the same + // broke friend renaming between freezes still can't re-trigger the drop coda. + const renameLatch = new Set(); + const before = economyLine(kitted([ + { isPrimary: true, money: 3000, equipValue: 4000, alive: true }, + { steamid: "76561198000000001", isPrimary: false, name: "Mouse", money: 1000, alive: true }, + ]), renameLatch); + const afterRename = economyLine(kitted([ + { isPrimary: true, money: 3000, equipValue: 4000, alive: true }, + { steamid: "76561198000000001", isPrimary: false, name: "m0use", money: 1000, alive: true }, + ]), renameLatch); + expect(!!before && before.includes("Mouse"), "drop call fires before the rename"); + expect(!/m0use/.test(afterRename ?? ""), "a mid-match Steam-name change doesn't dodge the drop latch (keyed on SteamID)"); } // --------------------------------------------------------------------------- diff --git a/src/coach/lines.ts b/src/coach/lines.ts index cf7c119..e569371 100644 --- a/src/coach/lines.ts +++ b/src/coach/lines.ts @@ -159,9 +159,12 @@ function appendDrop(line: string, ctx: MatchContext, droppedTo?: Set): s const who = broke.name as string; // Anti-repeat: the economy cooldown is shorter than a round, so without a latch // this would re-name the same broke friend freezetime after freezetime. The caller - // owns the per-match set (cleared at matchStart), mirroring weakLinkCalled. - if (droppedTo?.has(who)) return line; - droppedTo?.add(who); + // owns the per-match set (cleared at matchStart), mirroring weakLinkCalled. Key on + // the stable SteamID64 (falling back to the name only when a fixture omits it) so a + // mid-match Steam-name change can't dodge the latch and re-fire the same drop call. + const key = (broke.steamid as string | undefined) ?? who; + if (droppedTo?.has(key)) return line; + droppedTo?.add(key); return `${line} ${pick("dropCoda", [ `And ${who}'s broke, sling them a rifle, you can afford it.`, `${who}'s got nothing. Drop them a gun, quit hoarding.`, diff --git a/src/gsi/roster.ts b/src/gsi/roster.ts index 4b2cedf..a91449b 100644 --- a/src/gsi/roster.ts +++ b/src/gsi/roster.ts @@ -625,6 +625,7 @@ export class RosterManager { .map(([id, f], i) => { const m = members[i]; // members[0..live.length-1] align with live by construction return { + steamid: id, // feed key = SteamID64; the drop latch dedups on this, not the name name: m.name, money: m.money, isPrimary: m.isPrimary, diff --git a/src/gsi/types.ts b/src/gsi/types.ts index 3abf9dc..1c2f527 100644 --- a/src/gsi/types.ts +++ b/src/gsi/types.ts @@ -188,9 +188,11 @@ export interface TeamContext { * gear and alive, so the coach can tell a kitted $5k from a force-buy $5k and * never name a drop to a dead teammate. equipValue is present only for the * primary's own feed (the only feed whose own gear we read); alive mirrors the - * member's. Present only when team tactics are enabled; covers only the wired subset. + * member's. steamid is the feed's stable SteamID64 — the key the drop latch dedups + * on so a mid-match Steam-name change can't re-fire the same drop call. Present only + * when team tactics are enabled; covers only the wired subset. */ - econ?: { name?: string; money: number; isPrimary: boolean; equipValue?: number; alive?: boolean }[]; + econ?: { steamid?: string; name?: string; money: number; isPrimary: boolean; equipValue?: number; alive?: boolean }[]; /** * Cross-round buy-sync read for a coordinating squad — e.g. "Andy full-bought * while Mouse and Cadian saved". Present whenever 2+ wired buyers are visible at