From 321cd8f2fa53d17871f91e7eaa66ee5810996c7b Mon Sep 17 00:00:00 2001 From: QIU Date: Tue, 25 Aug 2026 16:04:47 +0000 Subject: [PATCH] fix(aprs): the login line was malformed, and the refusal was invisible An auditor ran the plan's own release gate against live APRS-IS servers. It failed at the login step, on every server tried: sent: user N0CALL pass -1 vers Look4Sat-4.5.4 got: # Invalid login: software name and version are not separated by a space Reproduced on euro.aprs2.net and noam.aprs2.net, aprsc 2.1.21. `vers` takes TWO tokens, a software name and a version. An earlier commit read the rule "softwarename must not contain a space" as "the field must be one token" and hyphenated the space between them - and the unit test asserted that as correct, so the mistake was frozen in place. Worse than the malformed line was what happened next. `# Invalid login:` is a comment but not a logresp, so parse skipped it as keepalive chatter; the login then timed out into Unknown, which is deliberately treated as "may be working"; so `ok = sent && !refused` was true and the operator was shown "APRS: report sent OK" for a login the server had refused. That is v4.6.0's defining defect - every send reported successful regardless of outcome - still live on the exact path every operator takes. The rebuild narrowed it rather than closing it. Both halves are fixed: the name and version stay separate tokens with whitespace collapsed within each, and a refusal comment is classified as a refusal before the logresp test. A socket test now replays the server's actual bytes. Three smaller things from the same review: The foreground service type goes back to dataSync. The previous commit chose location to escape dataSync's six-hour cap, but a location-typed service is refused outright unless a location runtime permission has already been granted, and the settings card requests only notifications - so it would have failed silently for anyone who declined location access. The cap that prompted the switch applies only when targetSdk is 35 or higher, which this project does not declare. A test now reads the manifest and the service source and fails if they disagree, which is the only way this class of defect is visible from a JVM test. The version string in the login was 4.5.4 while the app was 4.6.0. Now split into name and version and corrected, though it is still hardcoded - core:data has no BuildConfig, so passing it in properly is a separate change. The passcode hint said "empty = auto-computed from callsign" in all five locales. The app stopped doing that two commits ago; it now connects receive-only, and the hint says so. It was the first thing an operator read next to the field, promising the behaviour that was deliberately removed. Not fixed, and known: the notification body is rebuilt from the previous cycle's state so it can show a stale verdict, a deliberate receive-only choice is still styled as an error, and no last-success timestamp exists - so an operator still cannot establish whether their station has ever reached the network. --- app/src/main/AndroidManifest.xml | 14 +- .../look4sat/AprsForegroundService.kt | 13 +- .../look4sat/core/data/aprs/AprsIsClient.kt | 3 +- .../look4sat/core/data/aprs/AprsReporter.kt | 7 +- .../core/data/aprs/AprsIsClientSocketTest.kt | 33 ++++- .../look4sat/core/domain/aprs/AprsLogin.kt | 28 +++- .../core/domain/aprs/AprsLoginTest.kt | 105 +++++++++---- .../domain/aprs/ForegroundServiceTypeTest.kt | 140 ++++++++++++++++++ .../src/main/res/values-id/strings.xml | 2 +- .../src/main/res/values-in/strings.xml | 2 +- .../src/main/res/values-tr/strings.xml | 2 +- .../src/main/res/values-zh/strings.xml | 2 +- .../src/main/res/values/strings.xml | 2 +- 13 files changed, 297 insertions(+), 56 deletions(-) create mode 100644 core/domain/src/test/java/com/rtbishop/look4sat/core/domain/aprs/ForegroundServiceTypeTest.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 07159276..35880baf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,12 +16,14 @@ - +