-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Which validators are run and when? #26
Comments
I will join |
Decision: run all of them all the time. |
Additional note: Idea is that to skip validators, validators can be implemented to support something like a |
Decision: there can be only one output validator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I’ve tried to understand which validators are run and when. This is particularly interesting with respect to input validation.
There are several sources of information about this, in particular “the specification” (which exists in many different forms), and two toolchains that are inspired by the specification.
To highlight the issue, there is currently no consensus about what the following entry in
testdata.yaml
means:But there are more complicated issues as well. Here follows an attempt at an overview.
Before the deep dive, here is an attempt at a crisp summary:
input_validator_flags
orinput_validators
? Henceforce I’ll call itiv
.iv
when it is a string? Is it a string of flags, such as--max_n 10 --connected
or the name of a validator such asgrammar.ctd
?iv
is no a string, then what is it? Can it be a list of dicts?name
key ofiv
(or, if it’s a list, in any of its entries), does that mean that only the listed validators are run on the testcases in the given testgroup?secret
andsecret/foo
both haveiv
keys in theirtestdata.yaml
, how is inheritance handled? Ifsecret
has antestdata.yaml/iv
key butsecret/foo
hastestdata.yaml
but notestdata.yaml/iv
then doessecret/foo
inherit the values from its parents? Does a flag for validatorgrammar.py
specified insecret
apply tosecret/foo
? Does that depend on ifsecret/foo
hastestdata.yaml
,testdata.yaml/iv
or mentionsgrammar.py
intestdata.yaml/iv
.The most important issue is 2, because it breaks a core functionality it makes two toolchains (problemtools and BAPCtools) incompatible.
Specification
What does the specification say? At https://www.kattis.com/problem-package-format/spec/problem_package_format is says:
However, I have learned that this is not the intended mode of reading. The only source for the intended meaning is currently the source code, which is here:
The
<s>
tags seem to be unbalanced, but one way to make sense of this are the two readings:and
class "dep kattis"
, presumably meaning “relevant to Kattis, deprectated”However, I’m a bit out of my depth of how to interpret the tags.
Current behaviour of
input_validator_flags: foo
The most important thing for me to align what
input_validator_flag: foo
indata/a/b/testdata.yaml
should mean. (This feature is extremely useful and widely used.) It should have high priority that there exists a nonzero number of accessible and authoritative sources that specify the name and intended functionality of this flag.I believe the current implementation of
problemtools
input_validators
on all test-cases andfoo
as an argument to all(?) those validators for the testcases indata/a/b
.BAPCtools does something else, it
foo
on the testcases indata/a/b
.The three traditions (specification, problemtools, BAPCtools) further disagree on inheritance, having very different opinions on what to do when
data/a/testdata.yaml
exists and setsinput_validator_flag: bar
data/a/b/testdata.yaml
exists but does not containinput_validator_flags
. Specification says:bar
not set. Problemtools: travels upwards in settings tree and findsbar
.data/a/b/testdata.yaml
does not exist. Shouldbar
, when interpreted as a validator, run? As the only validator? Or is the absence of a specified validator atb
an indication that all validators should run?Provided validators
The specification says:
Alas, the semantics of the word “provided” is not clear from the rest of the specification. It may mean “all input validators found in
input_validators
”. Or, the named validators somewhere intestdata.yaml
settings files can restrict or extend which validators are “provided”.Testdata settings inheritance
The specification says:
I don’t think that is what is implemented by Problemtools (but it is implemented by BAPCtools). Suggestions:
(i) slightly better as “…if
such a filea setting is not provided for a test data group then the…”.(ii) slightly better as “… to specify settings for a test data group, such as grading or validation”.
Speculative behaviour of
input_validator_flags
/input_validator(s)
This should have low priority.
What BAPCtool seems to implement is this:
(What is new is the “list” type.) This may indeed be the intended definition of the speculative part of the specification. However, the inheritance rules are very unclear to me; there is no agreement on whether keys in
testdata.yaml
files are inherited, much less about what happens when those keys are lists of dicts.The text was updated successfully, but these errors were encountered: