Files
OpsLog/internal/extsvc/lotw_exit_test.go
T
rouggy 61e5736f1e fix(lotw): stop reporting suppressed QSOs as uploaded
Reported: ten fresh contacts upload and appear on LoTW; twenty older ones,
bulk-edited to exactly the same LOTW_SENT/RCVD state, are accepted by OpsLog
and never arrive. The operator's reading was that a failed attempt could not be
overridden. It is simpler and worse than that.

TQSL's exit codes, from its own cmdline documentation:

	 8  NO QSOs were processed — already uploaded OR OUT OF DATE RANGE
	 9  some processed, some ignored — same two reasons
	14  some already uploaded, the rest signed

8 and 9 were both read as plain success. So on 8 — nothing uploaded at all —
OpsLog announced "already uploaded (duplicate)" and stamped every selected
contact as sent. They were never on LoTW and now looked as if they were, which
is exactly the reported symptom, and it is not recoverable by re-uploading
because the operator has no reason to try.

"Out of date range" is the cause that bites here: a contact older than the
callsign certificate's validity is silently left out. Older QSOs failing while
today's succeed is the signature.

Now: 8 is a failure and nothing is stamped — a duplicate left at "R" is
harmless and will be refused again, whereas a contact wrongly marked sent is
one nobody will look at twice. 9 and 14 succeed but carry Ignored, and the
caller says so in the console and a toast.

TQSL's own sentence ("20 QSO records are out of date range") is captured and
shown. It was being read and thrown away, and it is the whole answer to "why is
my contact not on LoTW".
2026-08-13 08:55:29 +02:00

45 lines
1.5 KiB
Go

package extsvc
import "testing"
// TQSL's own exit codes, from its cmdline documentation:
//
// 0 success
// 8 NO QSOs were processed — already uploaded OR out of date range
// 9 some processed, some ignored — same two reasons
// 14 some already uploaded, the rest signed
//
// 8 and 9 both used to be read as plain success, and that is how a contact came
// to be stamped "uploaded to LoTW" while LoTW had never seen it. The one that
// bites is "out of date range": a contact older than the callsign certificate's
// validity is silently left out of the submission.
func TestTQSLDetailKeepsTheReason(t *testing.T) {
out := `13:22:01: Signing using Callsign G0ABC, DXCC Entity ENGLAND
13:22:02: /tmp/x.adi: 20 QSO records are out of date range
13:22:02: Final Status: No QSOs were processed (8)`
got := tqslDetail(out, "summary")
if got == "summary" {
t.Fatal("threw away TQSL's explanation — that sentence is the whole answer to \"why is my contact not on LoTW\"")
}
if !contains(got, "out of date range") {
t.Errorf("the reason was lost: %q", got)
}
}
func TestTQSLDetailFallsBackToTheSummary(t *testing.T) {
if got := tqslDetail("nothing useful here", "summary"); got != "summary" {
t.Errorf("got %q, want the plain summary when TQSL said nothing specific", got)
}
}
func contains(h, n string) bool {
return len(h) >= len(n) && (func() bool {
for i := 0; i+len(n) <= len(h); i++ {
if h[i:i+len(n)] == n {
return true
}
}
return false
})()
}