Skip to content

Conversation

@0xfurai
Copy link
Owner

@0xfurai 0xfurai commented Sep 28, 2025

…reated_at timestamp during updates


Note

Preserves created_at during full monitor updates by fetching the existing record and using a new buildSetMapFromModelForUpdate helper.

  • Repository (apps/server/src/modules/monitor/monitor.mongo.repository.go):
    • Full Update: In UpdateFull, fetch existing monitor via FindByID and carry forward created_at when updating; maintain proxy handling ($unset when empty, set when provided).
    • Helper Function: Replace buildSetMapFromModel with buildSetMapFromModelForUpdate(preserveCreatedAt, includeProxyId, proxyObjectID) to keep original created_at and set updated_at to now.

Written by Cursor Bugbot for commit 3298aaa. This will update automatically on new commits. Configure here.

@cloudflare-workers-and-pages
Copy link

Deploying peekaping with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3298aaa
Status: ✅  Deploy successful!
Preview URL: https://ca2159f8.peekaping.pages.dev
Branch Preview URL: https://fix-monitor-update-change-cr.peekaping.pages.dev

View logs

@0xfurai
Copy link
Owner Author

0xfurai commented Sep 28, 2025

related to #128

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

return err
}
set := buildSetMapFromModel(monitor, true, proxyObjectID)
set := buildSetMapFromModelForUpdate(monitor, existingMonitor.CreatedAt, true, proxyObjectID)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Nil Monitor Access Causes Panic

The UpdateFull function can panic when updating a non-existent monitor. If FindByID returns a nil monitor, accessing existingMonitor.CreatedAt causes a nil pointer dereference. This changes the function's behavior from silently updating zero documents to a runtime crash.

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Sep 28, 2025

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.31%. Comparing base (d0cc2ca) to head (3298aaa).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...er/src/modules/monitor/monitor.mongo.repository.go 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #192      +/-   ##
==========================================
- Coverage   19.32%   19.31%   -0.01%     
==========================================
  Files         170      170              
  Lines       18120    18124       +4     
==========================================
  Hits         3501     3501              
- Misses      14458    14462       +4     
  Partials      161      161              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@0xfurai 0xfurai merged commit a77456f into main Sep 28, 2025
9 of 11 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.

2 participants