Skip to content

feat: add disable field filtering option - #399

Merged
arnaud-moncel merged 1 commit into
mainfrom
feat/disable-field-filtering
Oct 7, 2026
Merged

arnaud-moncel merged 1 commit into
mainfrom
feat/disable-field-filtering

Conversation

@arnaud-moncel

@arnaud-moncel arnaud-moncel commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

Note

Add disable_field_filtering option to collection customizers

  • Adds a disable_field_filtering method on CollectionCustomizer that hides end-user filtering for a named Column, ManyToOne, or OneToOne field. The schema decorator copies the field, clears filter operators for columns, and sets is_filterable to false for relations, without changing the original field map.
  • Adds an is_filterable accessor to ManyToOneSchema and OneToOneSchema (default true) in the datasource toolkit, and GeneratorField now honors it when building relation schemas.
  • ConditionTreeValidator.validate_leaf now walks each relation segment and raises a validation error at the first relation whose is_filterable is false. Direct foreign-key column filters are not blocked by the relation flag.
  • Fixes the unsupported-operator error message: an empty operator list now reports a non-filterable column, and a non-empty list reports the allowed operators.
  • Behavioral Change: disable_field_filtering raises for unknown fields, primary-key columns, OneToMany, and ManyToMany relations; nested condition trees through a disabled relation now fail validation.
📊 Macroscope summarized b172e2d. 6 files reviewed, 1 issue evaluated, 0 issues filtered, 1 comment posted

🗂️ Filtered Issues

@qltysh

qltysh Bot commented Oct 7, 2026

Copy link
Copy Markdown

2 new issues

Tool Category Rule Count
qlty Structure Function with many parameters (count = 5): initialize 2

attr_accessor :foreign_key, :foreign_key_target, :is_filterable

def initialize(foreign_key:, foreign_key_target:, foreign_collection:, is_read_only: false)
def initialize(foreign_key:, foreign_key_target:, foreign_collection:, is_read_only: false, is_filterable: true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function with many parameters (count = 5): initialize [qlty:function-parameters]

attr_accessor :origin_key, :origin_key_target, :is_filterable

def initialize(origin_key:, origin_key_target:, foreign_collection:, is_read_only: false)
def initialize(origin_key:, origin_key_target:, foreign_collection:, is_read_only: false, is_filterable: true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function with many parameters (count = 5): initialize [qlty:function-parameters]

@qltysh

qltysh Bot commented Oct 7, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (6)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
...dmin_datasource_toolkit/schema/relations/many_to_one_schema.rb100.0%
Coverage rating: A Coverage rating: A
...ce_customizer/decorators/schema/schema_collection_decorator.rb100.0%
Coverage rating: A Coverage rating: A
...min_datasource_toolkit/validations/condition_tree_validator.rb100.0%
Coverage rating: A Coverage rating: A
...n_agent/lib/forest_admin_agent/utils/schema/generator_field.rb100.0%
Coverage rating: A Coverage rating: A
...ib/forest_admin_datasource_customizer/collection_customizer.rb100.0%
Coverage rating: A Coverage rating: A
...admin_datasource_toolkit/schema/relations/one_to_one_schema.rb100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High

Constructing SchemaCollectionDecorator raises NameError for Set when set has not already been loaded, preventing the customizer from booting. This file does not require the standard-library set, so require it before initializing @unfilterable_fields.

Suggested change
require 'set'
module ForestAdminDatasourceCustomizer
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @packages/forest_admin_datasource_customizer/lib/forest_admin_datasource_customizer/decorators/schema/schema_collection_decorator.rb around line 1:

Constructing `SchemaCollectionDecorator` raises `NameError` for `Set` when `set` has not already been loaded, preventing the customizer from booting. This file does not require the standard-library `set`, so require it before initializing `@unfilterable_fields`.

@matthv
matthv self-requested a review October 7, 2026 08:34
@arnaud-moncel
arnaud-moncel merged commit b537254 into main Oct 7, 2026
33 checks passed
@arnaud-moncel
arnaud-moncel deleted the feat/disable-field-filtering branch October 7, 2026 09:05
forest-bot added a commit that referenced this pull request Oct 7, 2026
# [1.45.0](v1.44.5...v1.45.0) (2026-10-07)

### Features

* add disable field filtering option ([#399](#399)) ([b537254](b537254))
@forest-bot

Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.45.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants