MailJDTourDownloadDocsQualityTestsCoverage

Which source lines and branches the tests execute. Lines 91.5 %, branches 75.0 % (minimum 85 % and 72 %). main @ 399ffe3d · 21 October 2026 · pipeline 7238.

GCC Code Coverage Report


Directory: src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 85.7% 6 / 0 / 7
Functions: 100.0% 4 / 0 / 4
Branches: 87.5% 7 / 0 / 8

app/core/DavPushSecrets.h
Line Branch Exec Source
1 #pragma once
2
3 #include <QByteArray>
4 #include <QObject>
5 #include <QString>
6 #include <functional>
7 #include <optional>
8
9 #include "service/WebPushPayloadCodec.h"
10
11 // Sprint 96 S96.1.3 / §2.3: DAV-Push secrets live in the keyring only — the
12 // receive channel (a capability URL), the subscription private key, the
13 // auth secret and an optional provider token. Keys are named by the
14 // per-profile installation id, so two profiles never share a receiver.
15 // The interface is asynchronous like the keyring; tests use a memory store.
16 class DavPushSecretStore {
17 public:
18 using ReadCallback = std::function<void(bool found, QByteArray value)>;
19 using DoneCallback = std::function<void(bool ok)>;
20 861 virtual ~DavPushSecretStore() = default;
21 // Callbacks run later on the owner's thread and never after `owner` died.
22 virtual void read(QObject *owner, const QString &key, ReadCallback callback) = 0;
23 virtual void write(QObject *owner, const QString &key, const QByteArray &value, DoneCallback callback) = 0;
24 virtual void remove(QObject *owner, const QString &key, DoneCallback callback) = 0;
25 };
26
27 // Production: QtKeychain through CredentialStore, service "davpush".
28 class KeyringDavPushSecretStore final : public DavPushSecretStore {
29 public:
30 void read(QObject *owner, const QString &key, ReadCallback callback) override;
31 void write(QObject *owner, const QString &key, const QByteArray &value, DoneCallback callback) override;
32 void remove(QObject *owner, const QString &key, DoneCallback callback) override;
33 };
34
35 // The secret material of one account receiver (JSON in the keyring).
36 struct DavPushReceiverSecret {
37 QString channel; // ntfy topic (capability)
38 WebPushPayloadCodec::Keys keys; // subscription keys
39
3/4
✓ Branch 3 → 4 taken 14 times.
✓ Branch 3 → 7 taken 1 time.
✓ Branch 5 → 6 taken 14 times.
✗ Branch 5 → 7 not taken.
15 bool isValid() const { return !channel.isEmpty() && keys.isValid(); }
40 QByteArray serialize() const;
41 static std::optional<DavPushReceiverSecret> parse(const QByteArray &json);
42 // "up" + 12 random characters [A-Za-z0-9] (≈ 71 bit): the UnifiedPush
43 // topic form ntfy requires for subscriber-based rate limiting (ADR-96-1).
44 static constexpr int kChannelLength = 14;
45 static QString newChannel();
46 // False for channels of earlier builds (longer names), which such ntfy
47 // servers refuse; the receiver is then replaced.
48 bool hasProviderChannel() const;
49 };
50
51 namespace DavPushSecretKeys {
52 46 inline QString receiver(const QString &installationId, const QString &receiverId) {
53
3/3
✓ Branch 7 → 8 taken 46 times.
✓ Branch 8 → 9 taken 46 times.
✓ Branch 9 → 10 taken 46 times.
92 return QStringLiteral("receiver/") + installationId + QLatin1Char('/') + receiverId;
54 }
55 10 inline QString providerToken(const QString &installationId) {
56
1/1
✓ Branch 5 → 6 taken 10 times.
10 return QStringLiteral("provider-token/") + installationId;
57 }
58 } // namespace DavPushSecretKeys
59