Skip to content

feat(gdd): Add GroupDerivedData.generated_at#120166

Open
kcons wants to merge 1 commit into
masterfrom
kcons/chunk2
Open

feat(gdd): Add GroupDerivedData.generated_at#120166
kcons wants to merge 1 commit into
masterfrom
kcons/chunk2

Conversation

@kcons

@kcons kcons commented Jul 20, 2026

Copy link
Copy Markdown
Member

Knowing when GroupDerivedData generation began allows to roughly track what log entries it had access to, and this in turn allows us to know if an incremental update is unsafe because it is based on an earlier regeneration run.

The plan is to use this for safe in-place regeneration.

@kcons
kcons requested review from a team as code owners July 20, 2026 23:59
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 20, 2026

# Column-backed features — promoted from JSON for indexing/querying.

# This is here just for demonstration purposes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

isn't this still true?

@github-actions

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/migrations/1141_add_generated_at_to_group_derived_data.py

for 1141_add_generated_at_to_group_derived_data in sentry

--
-- Add field generated_at to groupderiveddata
--
ALTER TABLE "sentry_groupderiveddata" ADD COLUMN "generated_at" timestamp with time zone DEFAULT (STATEMENT_TIMESTAMP()) NOT NULL;


# Timestamp of when the generation that produced this state *started*
# processing. Defaults to row creation time.
generated_at = models.DateTimeField(default=timezone.now, db_default=models.functions.Now())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

models.functions.Now() raises AttributeError on module import

models.functions.Now() fails because django.db.models does not expose functions; every other db_default=Now() usage in the codebase explicitly imports Now from django.db.models.functions.

Evidence
  • models is bound to django.db.models (line 4: from django.db import models).
  • django.db.models does not re-export the functions submodule, so models.functions raises AttributeError at class definition time.
  • Every other db_default=Now() usage in Sentry uses an explicit from django.db.models.functions import Now import (e.g., groupactionlogentry.py, authidentityreplica.py, outbox.py).
  • Django's own migration autogenerator also emits import django.db.models.functions.datetime rather than models.functions.Now().

Identified by Warden sentry-backend-bugs · XYU-67D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants