Skip to content

fix(filter)!: resolve only public members - #161

Merged
pdevito3 merged 1 commit into
v2from
fm/qk-restore-d1-d5-d1-break
Oct 9, 2026
Merged

pdevito3 merged 1 commit into
v2from
fm/qk-restore-d1-d5-d1-break

Conversation

@pdevito3

@pdevito3 pdevito3 commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

For later consideration in a major version. Do not merge now.

Summary

This PR brings back the public-only member lookup that the D1 restore (#155) removed. It is a breaking change, so it needs a major version. The captain decides if and when it merges.

#155 merged into main. This PR is rebased on current main and holds only the break commit. The diff reverts only the member lookup of the D1 restore.

Change

A filter segment matches only a public property or a public field, ignoring case:

  • An internal, protected, or private member is an unknown property. The filter throws UnknownFilterPropertyException.
  • A query name on a non-public member also throws UnknownFilterPropertyException.
  • With AllowUnknownProperties, a clause on a non-public member becomes True == True and does not filter.

This is the main behavior before #155, with one exception. An indexer stays an unknown property, like on current main and v1.14.2. On main before #155, an indexer threw ArgumentException. That error was a fault and not part of the public-only design, so this PR does not bring it back.

Results

Input v1.14.2 and main This PR
InternalScore > 30 (internal property) x.InternalScore > 30 UnknownFilterPropertyException
secretRank == 7 (private field) x.secretRank == 7 UnknownFilterPropertyException
Owner.InternalAlias == "Ann" filters UnknownFilterPropertyException
score > 30, query name on InternalScore x.InternalScore > 30 UnknownFilterPropertyException
secretRank > 100 with AllowUnknownProperties x.secretRank > 100 True == True
Item == "x" (indexer) UnknownFilterPropertyException UnknownFilterPropertyException

Migration

Make a member public to filter on it.

Tests

  • The D1 unit pins in QueryKit.UnitTests/PropertyResolverTests.cs now expect the public-only result. The indexer pins do not change.
  • The D1 Postgres pins in QueryKit.IntegrationTests/Tests/PropertyResolverTests.cs now expect UnknownFilterPropertyException for the internal Nickname property, and no filter from the clause with AllowUnknownProperties.
  • dotnet test: unit 469 passed, integration 297 passed, 0 failures.
  • No README section documents member visibility, so the README does not change.

Base automatically changed from fm/qk-restore-d1-d5-d1 to main October 1, 2026 20:39
@pdevito3
pdevito3 force-pushed the fm/qk-restore-d1-d5-d1-break branch from d501fbb to 8784984 Compare October 1, 2026 21:41
A filter segment now matches only a public property or a public field, ignoring case. An internal, protected, or private member is an unknown property. A query name on a non-public member is also an unknown property. An indexer stays an unknown property.

Examples:
  InternalScore > 30 (internal property)
    before: x.InternalScore > 30
    after:  UnknownFilterPropertyException
  secretRank == 7 (private field)
    before: x.secretRank == 7
    after:  UnknownFilterPropertyException
  score > 30, query name on InternalScore
    before: x.InternalScore > 30
    after:  UnknownFilterPropertyException
  secretRank > 100 with AllowUnknownProperties
    before: x.secretRank > 100
    after:  the clause does not filter
  Title == "x" (public property)
    before and after: x.Title == "x"

BREAKING CHANGE: a filter on an internal, protected, or private member throws UnknownFilterPropertyException. Make the member public to filter on it.
@pdevito3
pdevito3 force-pushed the fm/qk-restore-d1-d5-d1-break branch from 8784984 to d5acc04 Compare October 9, 2026 21:08
@pdevito3
pdevito3 changed the base branch from main to v2 October 9, 2026 21:08
@pdevito3
pdevito3 merged commit d8001e5 into v2 Oct 9, 2026
2 checks passed
@pdevito3
pdevito3 deleted the fm/qk-restore-d1-d5-d1-break branch October 9, 2026 21:10
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.

1 participant