mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
fix: gate UUID write-path normalization on UUID_HANDLING flag and fix docs accuracy
Co-authored-by: bewest <394179+bewest@users.noreply.github.com>
This commit is contained in:
co-authored by
bewest
parent
d1c9f185ac
commit
002f34fcda
+13
-35
@@ -7,47 +7,25 @@ All notable changes to cgm-remote-monitor are documented in this file.
|
||||
### Added
|
||||
|
||||
#### UUID/Identifier Handling (REQ-SYNC-072)
|
||||
- **Treatments API**: UUID values in `_id` field are now extracted to `identifier`
|
||||
- Loop overrides: UUID in `_id` → extracted to `identifier`
|
||||
- Loop carbs/doses: `syncIdentifier` field used for dedup (not copied)
|
||||
- xDrip+: `uuid` field used for dedup (not copied)
|
||||
- AAPS: `identifier` unchanged (already correct)
|
||||
- **Entries API**: CGM entries with UUID `_id` now handled correctly (GAP-SYNC-045)
|
||||
- **Deduplication**: Server uses `identifier`, `syncIdentifier`, or `uuid` for upsert matching
|
||||
- **Scope**: Only UUID values in `_id` field trigger normalization; other fields preserved
|
||||
|
||||
- **`UUID_HANDLING` env var** (default: `true`): Feature flag that controls UUID `_id` normalization for treatments and entries.
|
||||
- When `true`: UUID values sent as `_id` are extracted to the `identifier` field and a server-generated ObjectId is assigned. GET/DELETE by UUID are routed through the `identifier` field.
|
||||
- When `false`: UUID `_id` values are stripped (UUID identity not preserved) and UUID-based queries return empty results.
|
||||
- **Treatments API**: Loop overrides with UUID `_id` are now normalized correctly, preventing duplicate records (Issue #8450).
|
||||
- **Entries API**: CGM entries (e.g., Trio) with UUID `_id` are now handled correctly.
|
||||
- **Scope**: Only UUID values in the `_id` field are affected. Other client identity fields (`syncIdentifier`, `uuid`, `identifier`) are preserved but not modified.
|
||||
|
||||
#### Test Infrastructure
|
||||
- **NODE_ENV=test safety check**: Tests now refuse to run without `NODE_ENV=test`, preventing accidental production database destruction (GAP-SYNC-046)
|
||||
- New npm scripts: `test:unit`, `test:integration` for faster development cycles
|
||||
- Comprehensive test suite for UUID handling across v1 and v3 APIs
|
||||
|
||||
### Changed
|
||||
|
||||
#### Node.js Requirements
|
||||
- **Minimum**: Node.js 20 LTS (was Node 14/16)
|
||||
- **Tested**: Node 20, 22, 24
|
||||
- Updated `engines` field in package.json
|
||||
|
||||
#### MongoDB Requirements
|
||||
- **Minimum**: MongoDB 4.4 (was 4.2)
|
||||
- **Tested**: MongoDB 4.4, 5.0, 6.0
|
||||
- Improved compatibility with MongoDB 5.x+ `$set` behavior
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Loop Override Sync** (Issue #8450): Overrides with UUID `_id` no longer cause duplicate records
|
||||
- **mmol BG Display**: Fixed OpenAPS tooltips showing incorrect values for mmol/L users
|
||||
- **AAPS Entry Dedup**: Added retry logic for CI flakiness in concurrent upload tests
|
||||
- **NODE_ENV=test safety check**: Tests now refuse to run without `NODE_ENV=test`, preventing accidental production database modification.
|
||||
- Comprehensive test suite for UUID handling behavior across write and read paths.
|
||||
|
||||
### Documentation
|
||||
|
||||
- Updated README.md with current Node.js and MongoDB requirements
|
||||
- Added "Running Tests Locally" section to CONTRIBUTING.md
|
||||
- Updated treatments schema documentation with identifier normalization behavior
|
||||
|
||||
### Security
|
||||
|
||||
- Enabled Traditional Chinese localization
|
||||
- Updated README.md with `UUID_HANDLING` and MongoDB pool configuration env vars.
|
||||
- Added entries schema documentation (`docs/data-schemas/entries-schema.md`).
|
||||
- Updated treatments schema documentation with identifier normalization behavior.
|
||||
- Added test environment variables reference to CONTRIBUTING.md.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user