Skip to content

feat(inbound-filters): add model for new inbound filters v2#116666

Draft
shellmayr wants to merge 3 commits into
masterfrom
shellmayr/feat/inbound-filters-v2-add-model
Draft

feat(inbound-filters): add model for new inbound filters v2#116666
shellmayr wants to merge 3 commits into
masterfrom
shellmayr/feat/inbound-filters-v2-add-model

Conversation

@shellmayr
Copy link
Copy Markdown
Member

  • Add a new model for the new custom inbound filters v2
  • Conditions are currently a JSON, will make these stricter as soon as we figure out which format we prefer

Closes TET-2266

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 2, 2026

TET-2266

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

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

for 1104_add_project_custom_inbound_filter in sentry

--
-- Create model CustomInboundFilter
--
CREATE TABLE "sentry_custominboundfilter" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "date_updated" timestamp with time zone NOT NULL, "date_added" timestamp with time zone NOT NULL, "name" varchar(256) NULL, "active" boolean DEFAULT true NOT NULL, "conditions" jsonb NOT NULL, "project_id" bigint NOT NULL);
ALTER TABLE "sentry_custominboundfilter" ADD CONSTRAINT "sentry_custominbound_project_id_41117cea_fk_sentry_pr" FOREIGN KEY ("project_id") REFERENCES "sentry_project" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_custominboundfilter" VALIDATE CONSTRAINT "sentry_custominbound_project_id_41117cea_fk_sentry_pr";
CREATE INDEX CONCURRENTLY "sentry_custominboundfilter_project_id_41117cea" ON "sentry_custominboundfilter" ("project_id");
CREATE INDEX CONCURRENTLY "sentry_cif_project_id_idx" ON "sentry_custominboundfilter" ("project_id", "id");

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Backend Test Failures

Failures on 6a9ad41 in this run:

tests/sentry/backup/test_exhaustive.py::ExhaustiveTests::test_exhaustive_dirty_pkslog
tests/sentry/backup/test_exhaustive.py:39: in test_exhaustive_dirty_pks
    verify_models_in_output(expected_models, actual)
tests/sentry/backup/__init__.py:39: in verify_models_in_output
    raise AssertionError(
E   AssertionError: Some `expected_models` entries were not found: ['sentry.custominboundfilter']
E   
E               If you are seeing this in CI, it means that this test produced an `export.json` backup
E               file that was missing the above models. This check is in place to ensure that ALL models
E               of a certain category are covered by this particular test - by omitting a certain kind
E               of model from the backup output entirely, we end up in a situation where backing up the
E               model in question to JSON is untested.
E   
E               To fix this, you'll need to modify the body of the test to add at least one of these
E               models to the database before exporting. The process for doing so is test-specific, but
E               if the test body contains a fixture factory like `self.create_exhaustive_...`, that
E               function will be a good place to start. If it does not, you can just write the model to
E               the database at the appropriate point in the test: `MyNewModel.objects.create(...)`.
tests/sentry/backup/test_exhaustive.py::ExhaustiveTests::test_uniquenesslog
tests/sentry/backup/test_exhaustive.py:63: in test_uniqueness
    verify_models_in_output(expected_models, actual)
tests/sentry/backup/__init__.py:39: in verify_models_in_output
    raise AssertionError(
E   AssertionError: Some `expected_models` entries were not found: ['sentry.custominboundfilter']
E   
E               If you are seeing this in CI, it means that this test produced an `export.json` backup
E               file that was missing the above models. This check is in place to ensure that ALL models
E               of a certain category are covered by this particular test - by omitting a certain kind
E               of model from the backup output entirely, we end up in a situation where backing up the
E               model in question to JSON is untested.
E   
E               To fix this, you'll need to modify the body of the test to add at least one of these
E               models to the database before exporting. The process for doing so is test-specific, but
E               if the test body contains a fixture factory like `self.create_exhaustive_...`, that
E               function will be a good place to start. If it does not, you can just write the model to
E               the database at the appropriate point in the test: `MyNewModel.objects.create(...)`.
tests/sentry/backup/test_exports.py::ScopingTests::test_global_export_scopinglog
tests/sentry/backup/test_exports.py:402: in test_global_export_scoping
    self.verify_model_inclusion(unencrypted, ExportScope.Global)
tests/sentry/backup/test_exports.py:185: in verify_model_inclusion
    raise AssertionError(
E   AssertionError: The following models were not included in the export: ${<class 'sentry.models.custominboundfilter.CustomInboundFilter'>}; this is despite it being included in at least one of the following relocation scopes: {<RelocationScope.Global: 5>, <RelocationScope.User: 2>, <RelocationScope.Organization: 3>, <RelocationScope.Config: 4>}
tests/sentry/backup/test_exports.py::ScopingTests::test_organization_export_scopinglog
tests/sentry/backup/test_exports.py:266: in test_organization_export_scoping
    self.verify_model_inclusion(unencrypted, ExportScope.Organization)
tests/sentry/backup/test_exports.py:185: in verify_model_inclusion
    raise AssertionError(
E   AssertionError: The following models were not included in the export: ${<class 'sentry.models.custominboundfilter.CustomInboundFilter'>}; this is despite it being included in at least one of the following relocation scopes: {<RelocationScope.User: 2>, <RelocationScope.Organization: 3>}
tests/sentry/backup/test_imports.py::ScopingTests::test_global_import_scopinglog
tests/sentry/backup/test_imports.py:869: in test_global_import_scoping
    self.verify_model_inclusion(ImportScope.Global)
tests/sentry/backup/test_imports.py:797: in verify_model_inclusion
    assert model.objects.count() > 0
E   AssertionError: assert 0 > 0
E    +  where 0 = count()
E    +    where count = <sentry.db.models.manager.base.BaseManager object at 0x7f4339167230>.count
E    +      where <sentry.db.models.manager.base.BaseManager object at 0x7f4339167230> = <class 'sentry.models.custominboundfilter.CustomInboundFilter'>.objects
tests/sentry/backup/test_imports.py::ScopingTests::test_organization_import_scopinglog
tests/sentry/backup/test_imports.py:829: in test_organization_import_scoping
    self.verify_model_inclusion(ImportScope.Organization)
tests/sentry/backup/test_imports.py:797: in verify_model_inclusion
    assert model.objects.count() > 0
E   AssertionError: assert 0 > 0
E    +  where 0 = count()
E    +    where count = <sentry.db.models.manager.base.BaseManager object at 0x7f4339167230>.count
E    +      where <sentry.db.models.manager.base.BaseManager object at 0x7f4339167230> = <class 'sentry.models.custominboundfilter.CustomInboundFilter'>.objects

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.

1 participant