Apply code-review fixes: identity/pagination, load races, TLS pin, leaks
Addresses a multi-agent code review (26 confirmed findings + a URLSession leak) across correctness, concurrency, security, and cleanup: - MongoDocument.id: deterministic fallback (was UUID() on every access) to stop SwiftUI List/ForEach identity churn; getAll pagination drives its cursor off the real _id via documentId, so a missing _id stops paging instead of looping on a fabricated cursor. - View models: per-load generation guard (+ captured-tab guard on ONU detail) so a cancelled or overlapping load can't commit stale results or land data on the wrong tab. - JSONValue.intValue: guard Int(d) against NaN/inf/out-of-range (crash). - ServerTrustEvaluator: hash the real SubjectPublicKeyInfo (prepend the algorithm-specific ASN.1 SPKI header) so a standard openssl-captured public-key pin actually matches; unknown key types fail closed. - AppEnvironment.configure: clear stale cookies + Keychain creds on host change. - FirmwareFile.isCompatible: empty metadata no longer passes as compatible-for-all. - APIClient: invalidate URLSession on deinit (per-configure/probe leak). - Dashboard best-effort sections keep last-good on transient failure; unified optical thresholds; LoginView prefill-once; populatedBuckets unique ForEach id; Format rounding rollover; dead-code/docstring/dedup cleanups. Verification pending on the Mac (no Swift toolchain on the Linux dev box). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8de962eeb8
commit
203465913c
21 changed files with 303 additions and 103 deletions
|
|
@ -129,12 +129,14 @@ struct ONUDetailView: View {
|
|||
|
||||
@ViewBuilder private func opticalSection(_ s: ONUStateDoc) -> some View {
|
||||
Section {
|
||||
opticalRow("RX optical", s.rxOpticalDBm, green: -28, warn: -30)
|
||||
opticalRow("TX optical", s.txOpticalDBm, green: 3, warn: 3)
|
||||
opticalRow("RX optical", s.rxOpticalDBm,
|
||||
green: OpticalThreshold.rxGreenFloor, warn: OpticalThreshold.rxRedFloor)
|
||||
opticalRow("TX optical", s.txOpticalDBm,
|
||||
green: OpticalThreshold.txGreenFloor, warn: OpticalThreshold.txGreenFloor)
|
||||
} header: {
|
||||
Text("Live optical")
|
||||
} footer: {
|
||||
Text("Green RX ≥ −30 dBm, TX ≥ 3 dBm (user guide §7).")
|
||||
Text("Green RX ≥ −28 dBm, TX ≥ 3 dBm (user guide §7).")
|
||||
}
|
||||
Section("FEC error counters") {
|
||||
fecRow("ONU pre-FEC", s.onuPreFEC, isPost: false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue