Skip to content

feat: Add DEV assertion and Sentry monitoring to ChangeTracker.deactivate() when called on inactive tracker #11258

@coderabbitai

Description

@coderabbitai

Summary

During the review of PR #10816 (#10816), a suggestion was made to improve observability in ChangeTracker.deactivate() when it is called on an inactive tracker.

Currently, the method only logs a warn via loglevel when isActiveTracker(this) is false. Two enhancements were proposed:

Proposed Changes

1. DEV-mode assertion (throws)
In DEV builds, instead of silently warning, throw an assertion error to surface lifecycle mis-ordering early during development:

if (import.meta.env.DEV) {
  console.assert(isActiveTracker(this), 'deactivate() called on inactive tracker:', this.workflow.path)
}

2. DESKTOP Sentry monitoring
On Desktop (where Sentry is enabled), capture a Sentry event with a tag so occurrence frequency can be tracked over time. After ~1 month of data, decide whether to file a bug or close it:

if (isDesktop) {
  Sentry.captureEvent({
    message: 'ChangeTracker.deactivate() called on inactive tracker',
    tags: { workflow: this.workflow.path }
  })
}

File

src/scripts/changeTracker.tsChangeTracker.deactivate()

References

Requested by @christian-byrne. Issue created by @coderabbitai at the request of @jaeone94.

┆Issue is synchronized with this Notion page by Unito

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions