Files
cgm-remote-monitor/tests
Ben WestandCopilot 3b786ab3c0 fix(api3): dedup AAPS profile-store edits via REST POST /v3/profile
Profile-store documents are singleton-per-(app, defaultProfile) by design:
each source (e.g. AAPS) has one current profile snapshot at a time. The
prior identifier scheme (uuidv5 of "undefined_<doc.date>") created a new
identifier on every edit because AAPS sends a new `date`
(LocalProfileLastChange) per save, accumulating duplicate profile docs in
MongoDB and causing 'AAPS profile edits not appearing' user reports.

Changes:
- operationTools.calculateIdentifier: special-case profile-store shape
  (has `defaultProfile` + `store`, no `eventType`) -> identifier =
  uuidv5("profilestore_<app>_<defaultProfile>"), so re-sends and edits
  collapse onto the same row.
- update/validate: relax immutability of `date`, `created_at`,
  `startDate` during deduplication when the storage doc is a
  profile-store, since those fields are expected to advance per edit.
- api3.aaps-patterns tests updated to assert post-fix behavior:
  edits return 200 + same identifier + single doc; distinct
  defaultProfile names still produce distinct docs.

This complements the V1 (websocket) profile dedup fix in 85f7e6ac so
both AAPS sync paths now converge on a single profile document per
source.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-20 12:25:00 -07:00
..
2021-02-18 18:23:40 +02:00
2022-08-30 12:49:01 +03:00
2021-02-08 19:28:49 +02:00
2019-11-10 21:57:49 +00:00
2020-12-14 22:30:21 +02:00
2020-02-22 17:07:21 +02:00