Skip to content

fix(rules): stop wiping live rule state on template update - #81

Merged
CropWatchDevelopment merged 1 commit into
masterfrom
develop
Jul 29, 2026
Merged

CropWatchDevelopment merged 1 commit into
masterfrom
develop

Conversation

@CropWatchDevelopment

Copy link
Copy Markdown
Owner

PATCH /v1/rules/:id blanket-deleted cw_rule_state for the whole template, erasing is_triggered mid-alert — the alert service could then never run its reset path, orphaning cw_rule_trigger_log rows that render as still-active alerts forever.

  • update() now deletes state only for devices removed from the template and administratively closes their open trigger-log rows (reset_at = now(), reset_value null); state for still-assigned devices survives edits.
  • remove() also closes all open trigger-log rows before deleting the template so history rows cannot be orphaned open.
  • New spec coverage for update/remove via a per-table client stub router.

PATCH /v1/rules/:id blanket-deleted cw_rule_state for the whole template,
erasing is_triggered mid-alert — the alert service could then never run its
reset path, orphaning cw_rule_trigger_log rows that render as still-active
alerts forever.

- update() now deletes state only for devices removed from the template and
  administratively closes their open trigger-log rows (reset_at = now(),
  reset_value null); state for still-assigned devices survives edits.
- remove() also closes all open trigger-log rows before deleting the template
  so history rows cannot be orphaned open.
- New spec coverage for update/remove via a per-table client stub router.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api Ready Ready Preview, Comment Jul 29, 2026 7:53am

Request Review

@CropWatchDevelopment
CropWatchDevelopment merged commit 20a2f65 into master Jul 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant