Count from the log again on Reset Serial Numbers

The button started the numbers again at one. N1MM's manual says it "sets
serial numbers on all computers to the highest value in any of the logs,
plus 1", and its own handler re-reads the highest number per band out of
the log, so a mixed network came apart at exactly the point the button is
meant to repair: the N1MM stations counted on from the highest number and
this one started at one, sending numbers that had already gone out.

ContestSession.RestartNumbers fills the pool from the log, which is where
the reset now lands. SerialNumbersFrom is gone with it, and so is the pool
this station sent afterwards: N1MM sends none, because each station works
the same number out of its own copy of the log.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015NZkFxHde1iifAQemFTHxf
This commit is contained in:
2026-09-10 12:28:03 +00:00
co-authored by Claude Opus 5
parent 7ba0b44fc1
commit 980ddb586f
8 changed files with 50 additions and 35 deletions
@@ -182,19 +182,25 @@ public class NetworkedContactsTests
Assert.Equal(2, store.Qsos(session.Instance.ContestNumber).Count);
}
/// Reset Serial Numbers at all Stations starts the numbers again at one.
/// The contacts already logged keep the numbers they were sent with.
/// Reset Serial Numbers at all Stations puts the next number back to the
/// highest in the log plus one, which is what the N1MM manual says it does:
/// every station lands on the same number without repeating one that has
/// gone out. The contacts already logged keep the numbers they were sent
/// with.
[Fact]
public void SerialNumbersCanBeStartedAgainAtOne()
public void ResettingTheSerialNumbersCountsFromTheLogAgain()
{
(ContestSession session, _) = Station();
session.Add(Arriving("JA1XYZ", 1) with { Id = Qso.NewId(), SentNumber = 1 });
session.Add(Arriving("JA2XYZ", 2) with { Id = Qso.NewId(), SentNumber = 2 });
// a number claimed by a station that was logging something else, which
// is the mess the reset is for
session.Numbers.Note(400, Bands.Band20M);
Assert.Equal(401, session.NextNumberOn(null));
session.RestartNumbers();
Assert.Equal(3, session.NextNumberOn(null));
session.SerialNumbersFrom = DateTime.UtcNow;
Assert.Equal(1, session.NextNumberOn(null));
Assert.Equal([1, 2], session.Log.Qsos.Select(q => q.SentNumber));
}