This reverts commit 3b786ab3.
On review the V3 (app, defaultProfile) collapse was too aggressive and
broke parity with how the rest of the ecosystem treats the profile
collection:
- Loop (NightscoutKit) and Trio (NightscoutAPI.swift:411) both POST
/api/v1/profile without _id on every settings edit, accumulating one
doc per upload via lib/server/profile.js:create(). They have done so
for years.
- The Nightscout profile collection is historical/append-only by
design; the NS UI profile editor lets users navigate prior
snapshots, and lib/server/profile.js:last() picks the most recent
for display.
- Collapsing AAPS V3 edits onto a single (app, defaultProfile) row
diverged from Loop/Trio/AAPS-V1 behavior and erased the upload
history that NS UI exposes.
The original 'AAPS edits not appearing' user complaint is sufficiently
addressed by:
- the V1 websocket retry dedup (commit 85f7e6ac), which kills the
60s ack-window race; and
- the {startDate: -1, _id: -1} secondary sort in profile.last()
(also 85f7e6ac), which deterministically picks the newest row
when startDate ties.
Both of those help every uploader (Loop, Trio, AAPS V1, AAPS V3)
without changing the ecosystem-wide profile-as-history semantic. The
characterization tests added in ddabdc6c are restored by this revert
and continue to document V3's request-level (date-based) dedup.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>