fix: a watched callsign is never parked; refuse uploads to unconfigured services
ZD8GB — watch-listed, six streams a period, two of them RR73 — was refused as "parked" for the rest of the session. Parking answers "it will not answer, stop wasting the evening on it", which is a fair verdict about a station the LOG picked out and the wrong one about a station the OPERATOR named: a DXpedition running a pileup takes more than two series of calls to get through to, which is exactly why it is on the list. The rest between series still applies, so it cannot monopolise the transmitter — it simply never becomes ineligible. Send to (right-click) now refuses a service with no credentials and says which are missing. The upload runs on its own goroutine and reports into the QSL Manager's console, which is not open when the command came from the QSO list, so an upload to an unconfigured service looked exactly like one that worked. The toast is also raised only once the backend has accepted the request, and Cloudlog / Wavelog and HamQTH name themselves in it.
This commit is contained in:
@@ -11820,10 +11820,58 @@ func (a *App) UploadQSOsManual(service string, ids []int64) error {
|
||||
return fmt.Errorf("unknown service %q", service)
|
||||
}
|
||||
cfg := a.loadExternalServices()
|
||||
// NOT CONFIGURED IS AN ANSWER, AND IT BELONGS HERE.
|
||||
//
|
||||
// The upload runs on its own goroutine and reports through the QSL Manager's
|
||||
// console, which is not open when the command was given from a right-click in
|
||||
// the QSO list: an upload to a service with no credentials looked exactly
|
||||
// like one that worked. Refused synchronously instead, where the caller can
|
||||
// show it.
|
||||
if err := uploadConfigured(svc, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
go a.runManualUpload(svc, ids, cfg)
|
||||
return nil
|
||||
}
|
||||
|
||||
// uploadConfigured reports whether a service has what it needs to be uploaded
|
||||
// to at all — the credentials it cannot work without, not a guarantee they are
|
||||
// correct. The service says whether they are; this says whether to ask.
|
||||
func uploadConfigured(svc extsvc.Service, cfg extsvc.ExternalServices) error {
|
||||
has := func(v string) bool { return strings.TrimSpace(v) != "" }
|
||||
switch svc {
|
||||
case extsvc.ServiceCloudlog:
|
||||
if !has(cfg.Cloudlog.URL) || !has(cfg.Cloudlog.APIKey) {
|
||||
return fmt.Errorf("Cloudlog / Wavelog is not configured — set its URL and API key in Settings → External services")
|
||||
}
|
||||
case extsvc.ServiceQRZ:
|
||||
if !has(cfg.QRZ.APIKey) {
|
||||
return fmt.Errorf("QRZ.com is not configured — set the logbook API key in Settings → External services")
|
||||
}
|
||||
case extsvc.ServiceClublog:
|
||||
if !has(cfg.Clublog.Email) || !has(cfg.Clublog.Password) || !has(cfg.Clublog.APIKey) {
|
||||
return fmt.Errorf("Club Log is not configured — set the account email, password and API key in Settings → External services")
|
||||
}
|
||||
case extsvc.ServiceHRDLog:
|
||||
if !has(cfg.HRDLog.Callsign) || !has(cfg.HRDLog.Code) {
|
||||
return fmt.Errorf("HRDLog.net is not configured — set the callsign and upload code in Settings → External services")
|
||||
}
|
||||
case extsvc.ServiceEQSL:
|
||||
if !has(cfg.EQSL.Username) || !has(cfg.EQSL.Password) {
|
||||
return fmt.Errorf("eQSL.cc is not configured — set the username and password in Settings → External services")
|
||||
}
|
||||
case extsvc.ServiceHamQTH:
|
||||
if !has(cfg.HamQTH.Username) || !has(cfg.HamQTH.Password) {
|
||||
return fmt.Errorf("HamQTH is not configured — set the username and password in Settings → External services")
|
||||
}
|
||||
case extsvc.ServiceLoTW:
|
||||
if !has(cfg.LoTW.StationLocation) {
|
||||
return fmt.Errorf("LoTW is not configured — set the TQSL station location in Settings → External services")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) runManualUpload(svc extsvc.Service, ids []int64, cfg extsvc.ExternalServices) {
|
||||
emit := func(line string) {
|
||||
if a.ctx != nil {
|
||||
|
||||
+6
-2
@@ -6,13 +6,17 @@
|
||||
"Auto-call sees a decode that arrives after the others. A decoder sends a period in a burst and stragglers follow — a deep decode a second behind the rest — and the straggler was judged on its own, with the thirty stations of its own period nowhere in sight. The period now stays open until the next one starts, and a late arrival is weighed against all of it.",
|
||||
"Icom CI-V: address 00 can be set, and “Other (custom address)” stays chosen. Zero was treated as “not configured” and every save put the rig back to the IC-7610’s 98 — the model list following it, since it is derived from the address rather than stored.",
|
||||
"Cloudlog / Wavelog upload: a simplex contact is no longer uploaded as split. Every QSO carried a receive band and frequency equal to the transmit side, and Wavelog draws both — an ordinary FT8 contact read “17m/17m”. In ADIF an absent BAND_RX means “same as transmit”, so they are now written only when they differ. The record forwarded to another logger on the UDP link still carries them in full (Log4OM reads BAND_RX).",
|
||||
"Cluster: “S/F” in a spot comment is read as FT8, alongside “superfox”, “sfox” and “F/H”. They are all the same DXpedition transmit mode, and the comment was falling through to the band plan and coming out DATA."
|
||||
"Cluster: “S/F” in a spot comment is read as FT8, alongside “superfox”, “sfox” and “F/H”. They are all the same DXpedition transmit mode, and the comment was falling through to the band plan and coming out DATA.",
|
||||
"Auto-call never parks a watched callsign. After a few series of unanswered calls a station is set aside for the session — the right answer for one the LOG picked out, the wrong one for a station YOU named: a DXpedition running a pileup takes more than two series to get through to, which is exactly why it is on the list. The rest between series still applies.",
|
||||
"Right-click → Send to: an upload to a service with no credentials is refused, and says which ones are missing and where. It used to run on its own and report into the QSL Manager’s console, which is not open when the command came from the QSO list — so it looked exactly like an upload that worked. Cloudlog / Wavelog and HamQTH also name themselves properly in the toast."
|
||||
],
|
||||
"fr": [
|
||||
"L’auto-call voit un décodage qui arrive après les autres. Un décodeur envoie une période en rafale, puis les retardataires — un décodage « deep » une seconde plus tard — et le retardataire était jugé tout seul, sans les trente stations de sa propre période. La période reste maintenant ouverte jusqu’au début de la suivante, et un arrivant tardif est pesé face à l’ensemble.",
|
||||
"Icom CI-V : l’adresse 00 peut être saisie, et « Other (custom address) » reste sélectionné. Le zéro était pris pour « non configuré » et chaque enregistrement remettait le poste sur le 98 de l’IC-7610 — la liste des modèles suivant, puisqu’elle est déduite de l’adresse et non enregistrée.",
|
||||
"Upload Cloudlog / Wavelog : un contact simplex n’est plus envoyé comme un split. Chaque QSO portait une bande et une fréquence de réception égales à l’émission, et Wavelog affiche les deux — un FT8 ordinaire se lisait « 17m/17m ». En ADIF, un BAND_RX absent signifie « identique à l’émission » : ils ne sont donc écrits que s’ils diffèrent. L’enregistrement transmis à un autre logiciel par UDP les porte toujours en entier (Log4OM lit BAND_RX).",
|
||||
"Cluster : « S/F » dans un commentaire de spot est lu comme du FT8, au même titre que « superfox », « sfox » et « F/H ». C’est le même mode d’émission DXpédition, et le commentaire retombait sur le plan de bande pour ressortir en DATA."
|
||||
"Cluster : « S/F » dans un commentaire de spot est lu comme du FT8, au même titre que « superfox », « sfox » et « F/H ». C’est le même mode d’émission DXpédition, et le commentaire retombait sur le plan de bande pour ressortir en DATA.",
|
||||
"L’auto-call ne met jamais de côté un indicatif de la watchlist. Après quelques séries d’appels sans réponse, une station est écartée pour la session — la bonne réponse pour une station choisie par le CARNET, la mauvaise pour une station que VOUS avez nommée : un DX en pile-up demande plus de deux séries pour passer, et c’est précisément pour ça qu’il est sur la liste. Le repos entre séries s’applique toujours.",
|
||||
"Clic droit → Envoyer vers : un envoi vers un service non configuré est refusé, en disant ce qui manque et où. Il partait tout seul et rendait compte dans la console du gestionnaire QSL, qui n’est pas ouverte quand la commande vient de la liste des QSO — ça ressemblait donc exactement à un envoi réussi. Cloudlog / Wavelog et HamQTH s’annoncent aussi sous leur nom dans le message."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4559,11 +4559,16 @@ export default function App() {
|
||||
const LABELS: Record<string, string> = {
|
||||
qrz: 'QRZ.com', clublog: 'Club Log', lotw: 'LoTW',
|
||||
hrdlog: 'HRDLog.net', eqsl: 'eQSL.cc', hamlog: 'HAMLOG.online',
|
||||
hamqth: 'HamQTH', cloudlog: 'Cloudlog / Wavelog',
|
||||
};
|
||||
const label = LABELS[service] ?? service;
|
||||
showToast(`Uploading ${ids.length} QSO${ids.length > 1 ? 's' : ''} to ${label}…`);
|
||||
try { await UploadQSOsManual(service, ids as any); }
|
||||
catch (e: any) { setError(String(e?.message ?? e)); }
|
||||
try {
|
||||
// Awaited BEFORE the toast: the backend refuses a service with no
|
||||
// credentials, and announcing an upload that was never started is how an
|
||||
// operator concludes their QSOs are on a site they never signed up to.
|
||||
await UploadQSOsManual(service, ids as any);
|
||||
showToast(`Uploading ${ids.length} QSO${ids.length > 1 ? 's' : ''} to ${label}…`);
|
||||
} catch (e: any) { setError(String(e?.message ?? e)); }
|
||||
}
|
||||
// Right-click "Export filtered to ADIF (no limit)": exports every QSO that
|
||||
// matches the current filter, bypassing the on-screen row threshold.
|
||||
|
||||
@@ -1000,7 +1000,19 @@ func (e *Engine) judge(c Candidate, p Period, only []string) (bool, string) {
|
||||
if rank(c) == 0 {
|
||||
return false, "nothing-needed"
|
||||
}
|
||||
if e.rounds[call] >= e.set.MaxRounds {
|
||||
// A WATCHED callsign is never parked.
|
||||
//
|
||||
// Parking is the answer to "it will not answer, stop wasting the evening on
|
||||
// it" — a fair verdict about a station the LOG picked out, and the wrong one
|
||||
// about a station the OPERATOR did. A DXpedition running a pileup takes more
|
||||
// than two series of calls to get through to, which is precisely why it was
|
||||
// put on the list; watched ZD8GB was refused for the rest of the session
|
||||
// after fourteen unanswered calls, while it went on transmitting six streams
|
||||
// a period.
|
||||
//
|
||||
// The rest between series still applies, so it does not monopolise the
|
||||
// transmitter — it simply never becomes ineligible.
|
||||
if e.rounds[call] >= e.set.MaxRounds && !c.Watched {
|
||||
return false, "parked" // its series are spent for the session
|
||||
}
|
||||
// RESTING. A series that ended in a brake is followed by a real pause,
|
||||
|
||||
@@ -922,3 +922,27 @@ func TestTheFirstCallStartsWithNoMisses(t *testing.T) {
|
||||
t.Fatalf("misses=%d — the station's own silent period was not counted", e.misses)
|
||||
}
|
||||
}
|
||||
|
||||
// Parking answers "it will not answer, stop wasting the evening on it" — which
|
||||
// is a verdict about a station the LOG picked out, not about one the OPERATOR
|
||||
// did. From the air: a watched ZD8GB, six streams a period, refused for the
|
||||
// rest of the session after two series of unanswered calls.
|
||||
func TestAWatchedCallsignIsNeverParked(t *testing.T) {
|
||||
spent := func(c Candidate) *Engine {
|
||||
e := New(Settings{Enabled: true, MaxRounds: 2, Rest: 0})
|
||||
for i := 0; i < 2; i++ {
|
||||
e.giveUp(strings.ToUpper(c.Call), c) // a series ended by a brake
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
plain := cq("PLAIN", NeedDXCC, 0)
|
||||
if a := spent(plain).OnPeriod(period(0, plain)); a.Kind == DoReply {
|
||||
t.Errorf("%+v — a station whose series are spent was called again", a)
|
||||
}
|
||||
|
||||
dx := cq("ZD8GB", NeedDXCC, 0, watched)
|
||||
if a := spent(dx).OnPeriod(period(0, dx)); a.Kind != DoReply {
|
||||
t.Errorf("%+v — a watched DXpedition was parked for the session", a)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"hamlog/internal/extsvc"
|
||||
)
|
||||
|
||||
// An upload to a service with no credentials used to look exactly like one that
|
||||
// worked: it ran on its own goroutine and reported into the QSL Manager's
|
||||
// console, which is not open when the command came from the QSO list.
|
||||
func TestUploadRefusesAnUnconfiguredService(t *testing.T) {
|
||||
var empty extsvc.ExternalServices
|
||||
for _, svc := range []extsvc.Service{
|
||||
extsvc.ServiceCloudlog, extsvc.ServiceQRZ, extsvc.ServiceClublog,
|
||||
extsvc.ServiceHRDLog, extsvc.ServiceEQSL, extsvc.ServiceHamQTH, extsvc.ServiceLoTW,
|
||||
} {
|
||||
err := uploadConfigured(svc, empty)
|
||||
if err == nil {
|
||||
t.Errorf("%s: an unconfigured service was accepted", svc)
|
||||
continue
|
||||
}
|
||||
if !strings.Contains(err.Error(), "Settings") {
|
||||
t.Errorf("%s: %q does not say where to fix it", svc, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Configured: nothing in the way.
|
||||
cfg := extsvc.ExternalServices{}
|
||||
cfg.Cloudlog.URL, cfg.Cloudlog.APIKey = "https://log.f4bpo.fr", "cl123"
|
||||
if err := uploadConfigured(extsvc.ServiceCloudlog, cfg); err != nil {
|
||||
t.Errorf("a configured Cloudlog was refused: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user