Skip to content

feat(difs): Add capability to read difs from Objectstore#117078

Closed
lcian wants to merge 15 commits into
masterfrom
lcian/feat/objectstore-debug-files-read-capability
Closed

feat(difs): Add capability to read difs from Objectstore#117078
lcian wants to merge 15 commits into
masterfrom
lcian/feat/objectstore-debug-files-read-capability

Conversation

@lcian

@lcian lcian commented Jun 8, 2026

Copy link
Copy Markdown
Member

This is the first step in the migration of Debug Files to Objectstore.
It makes the File FK on ProjectDebugFile nullable, and introduces new columns for Objectstore-backed DIFs.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 8, 2026
@lcian lcian changed the title wip [WIP] feat(debug-files): Add capability to read from Objectstore Jun 8, 2026
Comment thread src/sentry/debug_files/debug_files.py Outdated
Comment thread src/sentry/api/endpoints/debug_files.py
@github-actions

This comment has been minimized.

@lcian

This comment has been minimized.

@lcian

This comment has been minimized.

Comment thread src/sentry/api/endpoints/debug_files.py
Comment thread src/sentry/debug_files/debug_files.py Outdated
Comment thread src/sentry/api/endpoints/debug_files.py
Comment thread src/sentry/api/endpoints/debug_files.py
Comment thread src/sentry/models/debugfile.py
@lcian lcian force-pushed the lcian/feat/objectstore-debug-files-read-capability branch from 62fec50 to 45a2280 Compare June 10, 2026 07:49
@lcian lcian changed the title [WIP] feat(debug-files): Add capability to read from Objectstore [WIP] feat(difs): Add capability to read from Objectstore Jun 10, 2026
@alexander-alderman-webb

Copy link
Copy Markdown
Contributor

LFG!

@lcian

This comment has been minimized.

@lcian

This comment has been minimized.

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0ec16ff. Configure here.

Comment thread src/sentry/api/endpoints/debug_files.py
Comment thread src/sentry/api/serializers/models/debug_file.py Outdated
Comment thread src/sentry/api/serializers/models/debug_file.py
@github-actions

Copy link
Copy Markdown
Contributor

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

for 1114_projectdebugfile_add_objectstore_columns in sentry

--
-- Alter field file on projectdebugfile
--
SET CONSTRAINTS "sentry_projectdsymfile_file_id_bdf41a41_fk_sentry_file_id" IMMEDIATE; ALTER TABLE "sentry_projectdsymfile" DROP CONSTRAINT "sentry_projectdsymfile_file_id_bdf41a41_fk_sentry_file_id";
ALTER TABLE "sentry_projectdsymfile" ALTER COLUMN "file_id" DROP NOT NULL;
ALTER TABLE "sentry_projectdsymfile" ADD CONSTRAINT "sentry_projectdsymfile_file_id_bdf41a41_fk_sentry_file_id" FOREIGN KEY ("file_id") REFERENCES "sentry_file" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_projectdsymfile" VALIDATE CONSTRAINT "sentry_projectdsymfile_file_id_bdf41a41_fk_sentry_file_id";
--
-- Add field storage_path to projectdebugfile
--
ALTER TABLE "sentry_projectdsymfile" ADD COLUMN "storage_path" text NULL;
--
-- Add field content_type to projectdebugfile
--
ALTER TABLE "sentry_projectdsymfile" ADD COLUMN "content_type" text NULL;
--
-- Add field file_size to projectdebugfile
--
ALTER TABLE "sentry_projectdsymfile" ADD COLUMN "file_size" bigint NULL;
--
-- Add field date_created to projectdebugfile
--
ALTER TABLE "sentry_projectdsymfile" ADD COLUMN "date_created" timestamp with time zone NULL;

@lcian lcian changed the title [WIP] feat(difs): Add capability to read from Objectstore feat(difs): Add capability to read from Objectstore Jun 10, 2026
@lcian lcian changed the title feat(difs): Add capability to read from Objectstore feat(difs): Add capability to read difs from Objectstore Jun 10, 2026
@lcian lcian marked this pull request as ready for review June 11, 2026 17:36
@lcian lcian requested review from a team as code owners June 11, 2026 17:36
@lcian lcian marked this pull request as draft June 11, 2026 17:36
lcian and others added 2 commits June 11, 2026 19:37
Close the objectstore response payload after materializing a debug file into the local cache. This avoids holding the underlying stream open after copy completion.

Co-Authored-By: Codex <noreply@openai.com>
@github-actions

Copy link
Copy Markdown
Contributor

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

for 1115_projectdebugfile_add_objectstore_columns in sentry

--
-- Alter field file on projectdebugfile
--
SET CONSTRAINTS "sentry_projectdsymfile_file_id_bdf41a41_fk_sentry_file_id" IMMEDIATE; ALTER TABLE "sentry_projectdsymfile" DROP CONSTRAINT "sentry_projectdsymfile_file_id_bdf41a41_fk_sentry_file_id";
ALTER TABLE "sentry_projectdsymfile" ALTER COLUMN "file_id" DROP NOT NULL;
ALTER TABLE "sentry_projectdsymfile" ADD CONSTRAINT "sentry_projectdsymfile_file_id_bdf41a41_fk_sentry_file_id" FOREIGN KEY ("file_id") REFERENCES "sentry_file" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_projectdsymfile" VALIDATE CONSTRAINT "sentry_projectdsymfile_file_id_bdf41a41_fk_sentry_file_id";
--
-- Add field storage_path to projectdebugfile
--
ALTER TABLE "sentry_projectdsymfile" ADD COLUMN "storage_path" text NULL;
--
-- Add field content_type to projectdebugfile
--
ALTER TABLE "sentry_projectdsymfile" ADD COLUMN "content_type" text NULL;
--
-- Add field file_size to projectdebugfile
--
ALTER TABLE "sentry_projectdsymfile" ADD COLUMN "file_size" bigint NULL;
--
-- Add field date_created to projectdebugfile
--
ALTER TABLE "sentry_projectdsymfile" ADD COLUMN "date_created" timestamp with time zone NULL;

@jjbayer

jjbayer commented Jun 12, 2026

Copy link
Copy Markdown
Member

I would probably split the PR to lower the risk: one for the migration and one for the new business logic.

@lcian

lcian commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

I would probably split the PR to lower the risk: one for the migration and one for the new business logic.

The business logic does essentially nothing until we start writing in #117294.
But I'll take the suggestion and try splitting it, that might make the PR a little easier to review.

@lcian

lcian commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

Superseded by a split stack: #117500 (migration) -> #117501 (read logic) -> #117294 (write logic)

@lcian lcian closed this Jun 12, 2026
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