feat(reports): note updates + report regeneration queue - #79
Merged
Merged
Conversation
Server side of report note editing: users annotate an already-generated
report's data points and the report PDF is regenerated by CW-Reports on its
next scheduled cron run (stored next to the original, never re-emailed).
- PATCH /v1/air/notes/:note_id — wires the previously-unused
UpdateAirAnnotationDto. Service whitelists {title, note, include_in_report}
only: the PartialType DTO also admits dev_eui/created_at and an update must
never re-point a note at another device's reading.
- POST /v1/reports/:id/regenerate — queues a row in the new
cw_report_regeneration_queue after validating: template visibility (404
via findOne), device is assigned, manage-tier permission
(listManagedDevices + assertDevicesCanBeManaged), sane period (<= 62 days,
end within the 23-month retention window — data lives 24 months and regen
can lag a cron cycle), and path-safe sourceObjectName. Dedupe: at most one
pending row per (template, device, period), enforced by a partial unique
index; repeated saves re-touch it and accumulate edit_count; the 23505
insert race resolves to the winner's row.
- GET /v1/reports/:id/regenerations — pending/processing rows for the
template; the frontend history dialog badges affected reports with the
accumulated edit count.
- devices.service findDataWithinRange now joins cw_air_annotations +
cw_air_alerts for air devices (parity with findData) so period reads carry
their notes.
- supabase/updates/016_report_regeneration_queue.sql (+ idempotent
edit_count addendum) — already hand-run on prod; README run-order updated.
Regenerate database.types.ts in api + CropWatch when convenient.
Route-contract snapshot updated (PATCH air note). New specs cover the note
whitelist, regeneration validation branches, dedupe, and the unique-index
race.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CropWatchDevelopment
had a problem deploying
to
Production
July 25, 2026 15:52 — with
GitHub Actions
Failure
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CropWatchDevelopment
temporarily deployed
to
Production
July 25, 2026 15:53 — with
GitHub Actions
Inactive
CropWatchDevelopment
temporarily deployed
to
Production
July 25, 2026 15:53 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Server side of report note editing: users annotate an already-generated report's data points and the report PDF is regenerated by CW-Reports on its next scheduled cron run (stored next to the original, never re-emailed).
Route-contract snapshot updated (PATCH air note). New specs cover the note whitelist, regeneration validation branches, dedupe, and the unique-index race.