feat(pushdown): generalise orderBy rendering beyond OData (#120); $select superset guard verified (#116) - #139
Merged
Conversation
…lect superset guard verified (#116) orderBy `syntax` now renders `prefix`, `suffix`, `column_only` and `direction_only` in addition to `odata` (default, byte-identical). `direction_only` requires exactly one term on an explicit supportedColumns allowlist and emits asc|desc alone (OpenAI-style `?order=desc`). Anything a syntax cannot express emits nothing; client-side ORDER BY stays authoritative. The #116 superset guard shipped in #124 and its tests pass here; no further code is needed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
general-kroll-4-life
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #120. Closes #116.
#120 - generalise
orderBypushdown beyond ODataapplyPushdownOrderByhard-requiredsyntax: odataand always rendered<column> <asc|desc>, so an API that expresses ordering any other way (OpenAI'sdirection-only
?order=desc, GitHub's?direction=asc,sort=-nameprefixstyles) could not use the pushdown at all - unlike
top/skip/count, whichhonour any
paramName.orderByalready carriessyntaxas its render directive, and the docs listedprefixandsuffixvalues the code never rendered. The issue sketched a newalgorithmkey; to avoid two overlapping knobs the new renderings areadditional
syntaxvalues:odata(default)col asc|desc, comma-joined$orderby=created_at descprefix-colfor desc,colfor ascsort=-created_at,namesuffixcol:asc|descsort=created_at:desccolumn_onlysort=created_atdirection_onlyasc/descalone; exactly one term on an explicitsupportedColumnsallowlistorder=descAnything the syntax cannot express (unsupported column, more than one term for
direction_only, unknown syntax) emits nothing and ORDER BY stays client-side,which remains authoritative. The
odatapath is byte-identical. No registryprovider currently declares an
orderBypushdown, so renderingprefix/suffixchanges no existing wire behaviour.
#116 -
$selectsuperset guardDelivered in #124 (83c0a2e, released in v0.5.4-alpha01):
applyPushdownSelectextends the emitted
$selectwith every column pushed into$filteror$orderby, subject to the select allowlist, andApplyPushdownruns filter andorder-by before select for that reason. The four superset tests from #124 cover
the issue's acceptance criteria (superset, unsupported column skipped, no change
when already projected,
SELECT *still emits no$select) and pass here. Nofurther code is required; listed so the issue closes with the PR.
Verification
go build ./..., gofmt,go test ./...clean; lint clean on changed files.direction_onlyasc/desc, refused for an unsupported column,multiple terms, or a missing allowlist;
prefix/suffix/column_onlyrendering; unknown syntax emits nothing; OData default unchanged.
registry, mock API logging raw queries), resource with
orderBy: {paramName: order, syntax: direction_only, supportedColumns: [created_at]}:ORDER BY created_at DESC->/v1/containers?order=desc(baseline: no param)ORDER BY created_at ASC->/v1/containers?order=ascORDER BY id DESC-> no param, rows still ordered client-side🤖 Generated with Claude Code