Benchmark: sentry PR 77754 - #9
Conversation
celmis-codereviewer
left a comment
There was a problem hiding this comment.
💬 COMMENT — findings to consider
Full findings and scope are in the review summary comment on this pull request — one persistent comment, updated in place on every run.
celmis-codereviewer
left a comment
There was a problem hiding this comment.
💬 COMMENT — findings to consider
Full findings and scope are in the review summary comment on this pull request — one persistent comment, updated in place on every run.
| class AssignmentSource: | ||
| source_name: str | ||
| integration_id: int | ||
| queued: datetime = timezone.now() |
There was a problem hiding this comment.
Why: queued is assigned timezone.now() as a default value on line 18, which evaluates once when the module is imported rather than when AssignmentSource is instantiated, giving all instances the exact same timestamp from module import time.
🟠 Dataclass field default evaluates timezone.now() at module load time
In Python dataclasses, assigning a call expression like queued: datetime = timezone.now() evaluates timezone.now() once when the class definition is executed during module import. All future AssignmentSource instances created without explicitly passing queued will share this static timestamp rather than capturing the time they were created.
Use field(default_factory=timezone.now) so that timezone.now() is called every time a new instance is created.
| queued: datetime = timezone.now() | |
| queued: datetime = field(default_factory=timezone.now) |
agent: defect · rule: defect.default-argument · confidence: 0.95
🤖 Code Review for PR #9💬 COMMENT — findings to consider Findings
Scope
Performance
Powered by Code Analyzer · context: tree-sitter graph + structural, cve, security, contract, defect |
Benchmark reproduction of getsentry#77754