Skip to content

Benchmark: sentry PR 77754 - #9

Open
celmis-codereviewer wants to merge 8 commits into
cr-base-77754from
cr-pr-77754
Open

Benchmark: sentry PR 77754#9
celmis-codereviewer wants to merge 8 commits into
cr-base-77754from
cr-pr-77754

Conversation

@celmis-codereviewer

Copy link
Copy Markdown

Benchmark reproduction of getsentry#77754

@celmis-codereviewer celmis-codereviewer left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

💬 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

This comment was marked as outdated.

@celmis-codereviewer celmis-codereviewer left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

💬 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()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

Suggested change
queued: datetime = timezone.now()
queued: datetime = field(default_factory=timezone.now)

agent: defect · rule: defect.default-argument · confidence: 0.95

@celmis-codereviewer

Copy link
Copy Markdown
Author

🤖 Code Review for PR #9

💬 COMMENT — findings to consider

Findings

  • 🟠 Error: 1

Scope

  • Files changed: 7
  • Lines: +212 / -15

Performance

  • Analysis time: 527.6s · agents: structural, cve, security, contract, defect · tokens: 31,387/18,205

Powered by Code Analyzer · context: tree-sitter graph + structural, cve, security, contract, defect

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