Skip to content

Initial trivial implementation of some draft problempackage spec options. - #3665

Open
vmcj wants to merge 3 commits into
DOMjudge:mainfrom
vmcj:ignored_problemspec_properties
Open

Initial trivial implementation of some draft problempackage spec options.#3665
vmcj wants to merge 3 commits into
DOMjudge:mainfrom
vmcj:ignored_problemspec_properties

Conversation

@vmcj

@vmcj vmcj commented Jul 5, 2026

Copy link
Copy Markdown
Member

This is some progress from #3664 in reworked format ready to be discussed.

I plan to implement some of the trivial parts of the different problemspecs to get discussion started on how much we want to implement. As we have people in the wild using main I added a warning for all problemspecs which I'm not reasonably sure of that we implement those. In other words, anything besides icpc-legacy will get a warning on imports via the API.

I did not look into uploads via the UI yet as that complicates the work quite a lot.

@vmcj
vmcj force-pushed the ignored_problemspec_properties branch from 8bfdb85 to bd7ebcf Compare July 5, 2026 18:46
@vmcj vmcj changed the title Ignored problemspec properties Initial trivial implementation of some draft problempackage spec options. Jul 6, 2026
Comment thread webapp/src/Service/ImportProblemService.php Outdated
Comment thread webapp/tests/Unit/Service/ImportProblemServiceTest.php Outdated
Comment thread webapp/src/Entity/Problem.php Outdated
Comment thread webapp/src/Service/ImportProblemService.php
@vmcj
vmcj force-pushed the ignored_problemspec_properties branch from bd7ebcf to 7abbdb6 Compare July 18, 2026 14:48
@vmcj
vmcj requested a review from meisterT July 18, 2026 14:55
@meisterT

Copy link
Copy Markdown
Member

Can you please rearrange the commits in a way you would like to merge them? That will make review easier

@vmcj
vmcj force-pushed the ignored_problemspec_properties branch from 640a0a5 to b51ee1b Compare July 24, 2026 20:13
@vmcj

vmcj commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

Can you please rearrange the commits in a way you would like to merge them? That will make review easier

Done.

vmcj added 3 commits August 23, 2026 09:26
We mostly implement the `icpc-legacy` and parts of the `legacy` & `2025-09-draft`. In the
next commits more will be added together with clear warnings on parts which are not (yet) implemented.
@vmcj
vmcj force-pushed the ignored_problemspec_properties branch from b51ee1b to 3a10bc6 Compare August 23, 2026 07:29
$final = array_merge($final, self::parseTypes($possibleType));
}
} else {
$final = array_merge($final, preg_split("/[\s,;]+/", $input));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using PREG_SPLIT_NO_EMPTY to avoid tripping over type: pass-fail, and similar things

$messages['info'][] = sprintf("Problem format version '%s' support still experimental.", $version);
} elseif ($version !== 'icpc-legacy') {
// 2023-07-draft used in Unit tests
$messages['warning'][] = sprintf("Unknown problem format version '%s'.", $version);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be danger, not warning

}
}

if (isset($yamlData['problem_format_version'])) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether this check should be one of the first checks (given that we are bailing out in some cases

* @param array{info?: string[], warning?: string[], danger?: string[]} $messages
* @param string[] $expected
*/
private function assertProblemSpecWarning(string $version, array $messages, array $expected = ['info']): void

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we ever pass in the 3rd argument $expected?

$this->assertNotEmpty($messages['info']);
$this->assertStringContainsString(
sprintf("Problem format version '%s' support still experimental.", $version),
$messages['info'][0]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this less brittle by accepting if it is in any $messages['info'], not necessarily the first one?

}

#[DataProvider('problemSpecVersionProvider')]
public function testProblemPackageFormatTest(string $problemSpecificationVersion): void

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: rename to testProblemPackageFormatVersions?


public static function problemSpecVersionProvider(): Generator
{
yield ['2025-09-draft'];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are all accepted tests, should we add one negative test as well?

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.

2 participants