Skip to content

#1112: sort_by validates field format and reports one with no data - #1143

Open
morphqdd wants to merge 4 commits into
zerocracy:masterfrom
morphqdd:1112
Open

morphqdd wants to merge 4 commits into
zerocracy:masterfrom
morphqdd:1112

Conversation

@morphqdd

Copy link
Copy Markdown
Contributor

The docblock of sort_by says it raises Fbe::Error if the property is nil, already set, or not a valid field name, but the body only checked nil, already-set, and is_a?(String). The sibling as validates against /\A[_a-z][a-zA-Z0-9_]*\z/.

That alone does not catch a typo like sort_by('nubmer'): the name is a syntactically valid field, so nothing rejects it. The query still runs, but filter_map { _1[@sorting]&.first } drops every row since none of the matched facts carry a nubmer property, so the repository looks exhausted and restarts, and nothing above debug is logged.

Added the same format check as uses, and made the per-repository sorted-values lookup raise Fbe::Error naming the field when matched facts exist but none of them carry it, instead of silently looking like an exhausted queue.

Closes #1112

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.

Fbe::Iterate#sort_by documents a check on the field name that it does not do

1 participant