Skip to content

feat: Add sync machine button & correct network address - #29

Merged
Aradhya-Tripathi merged 2 commits into
developfrom
update-machine
Sep 11, 2026
Merged

feat: Add sync machine button & correct network address#29
Aradhya-Tripathi merged 2 commits into
developfrom
update-machine

Conversation

@Aradhya-Tripathi

Copy link
Copy Markdown
Contributor

No description provided.

@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 3/5

The Atlas address correction appears sound, but the PR is not yet safe to merge because the scheduled machine-sync path retains two previously reported synchronization failures.

Reviews (2) · Last reviewed commit: "fix: Remove the sync now logic"

Comment thread cargo/cargo/doctype/machine/machine.py Outdated
Comment on lines +153 to +157
with filelock(f"machine-sync-{self.name}", timeout=SYNC_LOCK_TIMEOUT):
self.reload()
before = self.status

return self.sync(client) != before

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Lock Ends Before Commit

The file lock is released when sync_exclusively returns, but self.save() remains uncommitted until the enclosing request or background job finishes. A second worker can acquire the lock during that window, reload the still-committed Pending state, and process the same transition again. Both callers may then notify the owner, while the second save may overwrite concurrent data or raise a write conflict. Keep synchronization in effect through the transaction commit or use a database-level concurrency mechanism.

Prompt To Fix With AI
This is a comment left during a code review.
Path: cargo/cargo/doctype/machine/machine.py
Line: 153-157

Comment:
**Lock Ends Before Commit**

The file lock is released when `sync_exclusively` returns, but `self.save()` remains uncommitted until the enclosing request or background job finishes. A second worker can acquire the lock during that window, reload the still-committed `Pending` state, and process the same transition again. Both callers may then notify the owner, while the second save may overwrite concurrent data or raise a write conflict. Keep synchronization in effect through the transaction commit or use a database-level concurrency mechanism.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread cargo/cargo/doctype/machine/machine.py Outdated
Comment on lines +146 to +147
if moved:
notify_owner(self.reference_doctype, self.reference_name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Failed Notifications Never Retry

If the first owner notification fails, such as when a concurrent owner edit makes sync_machines() raise a timestamp conflict, the exception is only logged while the machine transition still commits. Later manual syncs see the settled status and skip notification, and the scheduled sweep no longer selects the non-Pending machine. This can permanently leave the owning Datum Server or Object Storage Cluster out of sync with its machine, so owner reconciliation needs a retryable path instead of being limited to the original transition.

Prompt To Fix With AI
This is a comment left during a code review.
Path: cargo/cargo/doctype/machine/machine.py
Line: 146-147

Comment:
**Failed Notifications Never Retry**

If the first owner notification fails, such as when a concurrent owner edit makes `sync_machines()` raise a timestamp conflict, the exception is only logged while the machine transition still commits. Later manual syncs see the settled status and skip notification, and the scheduled sweep no longer selects the non-Pending machine. This can permanently leave the owning Datum Server or Object Storage Cluster out of sync with its machine, so owner reconciliation needs a retryable path instead of being limited to the original transition.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@Aradhya-Tripathi
Aradhya-Tripathi merged commit b73e05e into develop Sep 11, 2026
3 of 4 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