Conversation
- processor.py:233-252: Added is_redeployment parameter to _create_haul_payload - processor.py:280-284: When is_redeployment=True and no dateRecovered is found, the method keeps datetime.now(timezone.utc) as recorded_at instead of falling back to lastUpdated (which would truncate to the same second as dateDeployed) - processor.py:855: Pass is_redeployment=serial_number_user_id in to_deploy when calling _create_haul_payload
There was a problem hiding this comment.
Pull request overview
This PR updates EdgeTech re-deployment haul handling to avoid (device_id, recorded_at) uniqueness collisions in EarthRanger when EdgeTech data lacks any dateRecovered (i.e., “skipped haul” cases), and documents the new behavior.
Changes:
- Added an
is_redeploymentflag to_create_haul_payloadand altered timestamp selection logic to avoid usinglastUpdatedduring re-deployments when nodateRecoveredis available. - Updated processing to pass the re-deployment context into
_create_haul_payload. - Added a regression test and expanded README documentation around re-deployment haul timestamp collision scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| app/actions/edgetech/processor.py | Adds is_redeployment to haul payload creation and changes fallback behavior to reduce recorded_at collisions. |
| app/actions/tests/test_edgetech_processor.py | Adds a regression test for “skipped haul” re-deployment timestamp collision behavior. |
| README.md | Documents why collisions occur (seconds truncation + unique constraint) and the chosen mitigation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…deterministic, guaranteed no collision regardless of when the processor runs 2. self._utcnow() instead of datetime.now(timezone.utc) (processor.py:268) — uses the existing testable helper for the default fallback 3. Deterministic test (test file) — asserts the exact expected value (dateDeployed - 1s) instead of just != 4. README x2 — updated both references to describe dateDeployed - 1s instead of datetime.now(UTC)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…me.now(timezone.utc)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.