Processor overhaul of options and validate_query method#621
Open
dale-wahl wants to merge 16 commits into
Open
Conversation
A default is the form's starting value. It was also being filled back in while parsing, which meant a value the user never sent could pass the checks that follow. Three ways in: an option missing from the submission, a cleared text field, and an unticked multi-select all quietly became the default again. Parsing strictly now says so instead: - a missing option raises, naming it, since our own form submits every field it shows. Options a form legitimately leaves out stay exempt: unchecked toggles, file uploads (sent outside the form values), and fields gated by an unmet requires or board_specific condition. - a cleared text field stays empty; a cleared numeric field raises, as there is no honest empty number. - unticking every option of a multi-select means an empty selection. A browser leaves a select with nothing selected out of the submission altogether, which is indistinguishable from the field never having been shown, so the form now submits an empty marker alongside it; parsing discards the marker. The chan scope fields were kept out of submissions by the form disabling them, which is a hand-rolled "requires"; they now declare it instead. Parsing tolerantly (silently_correct) still fills the default in, so internal callers that ask to be corrected quietly are unaffected.
…e template uses substring check)
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.
Merge order: #619 -> #620 -> this PR
Building on the two previous PRs, this updates processors with better checks in
parse_allandvalidate_queryso that they "fail fast" and provide more information to the user on how to select options.A few bugs were also identified that could have provided odd or unexpected results.
collocationsasked for three-word groups in a two-word window and quietly gave you two-word groups instead.tfidfwith a bad SMART string would finish empty and successful.column-networkwith one column on both sides read the whole dataset to produce a network with no edges (assuming no loops/comma separation).I also tightened some option by adding coerce_type and/or min/max bounds. There was also a bug with multi-selects whose default was a bare string in a template check that became a sub-string check.
What I did
Two halves. I added checks that could be expressed in the option itself, it is (e.g. [#620]'s added
mandatoryflag or the existingcoerce_type/min/max). And in other cases created or updated thevalidate_querymethod.In some instances, I was able to further reduce/remove
validate_querymostly with the newmandatoryflag.validate_query, where a declaration cannot express it
hash-similarity-networkcolumn-networkcollocationstfidftopic-modellerovertime-vocabularywordcloudattribute-frequencies,lexical-filter,convert-textaudio-to-text,consolidate-urls,extract-urls-filter,similar-word2vecBugs found on the way
preset-histogram— the guard removing "Overall" tested"all" in count_options["timeframe"], i.e. the setting's keys (type,default,options), never the choices. It was not removed and could be picked, which would fail. Now["timeframe"]["options"].clarifai-api—amountwas markedsensitive, a copy-paste from the API key, so an image count was scrubbed from stored parameters as if it were a secret.Added tests
test_option_default_validityandtest_option_keys_knownnow check the options a processor builds for a parent with columns as well as without. Processors routinely offer different options for each — a text field becomes alist of columns to pick from — and only the column-less shape was ever checked, which is allowed those string defaults above to survive.
parse_allalso names the module and the file:line of the option definition when it warns about a bad default, so the warning can be acted on: "columns" is used by dozens of processors, and the warning is logged far from the module atfault. Hopefully we can clean up any stragglers I missed.
Notes
Builds on [#620] (the
mandatoryflag and the parsing contract) and targets that branch; it should retarget to master once #620 merges.prompt_compassis deliberately not here. You'll see fixes to it shortly in master (Fixing it turned up a staleapi-/thirdpartyprefix and a couple ofKeyErrors; also having some difficulty using DMI's ollama remotely so want to look into that separately).