Skip to content

Switch to WCIF v2.2 - #315

Closed
dunkOnIT wants to merge 2 commits into
thewca:mainfrom
Rubiks-boy:support-wcif-v2
Closed

dunkOnIT wants to merge 2 commits into
thewca:mainfrom
Rubiks-boy:support-wcif-v2

Conversation

@dunkOnIT

@dunkOnIT dunkOnIT commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Contributed by @Rubiks-boy, 100% LLM-written. No human vouch for the code at this stage - just opened as a draft for discussion

@Rubiks-boy

Rubiks-boy commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Managed to do some testing against my locally running WCA dev env. I created a test comp with 8 competitors and then did a bunch of re-importing/exporting with various cutoffs, and all 3 types of advancement criteria (rank, %, result), and everything seemed to work fine!

sequential rounds / in this screenshot, I was using top 50%:

Screenshot 2026-10-12 at 12 25 37 PM

trying to import dual rounds:

Screenshot 2026-10-12 at 12 36 24 PM

defp validate_supported_wcif(%{"formatVersion" => "2." <> _version} = wcif) do
error =
Enum.find_value(wcif["events"], fn
%{"id" => "fto"} -> "FTO is not supported by WCA Live"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

added an additional guard for importing FTO comps, since rn it causes the site to completely crash. I assume we'll force FTO comps to use ILR?

@jonatanklosko jonatanklosko left a comment

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.

Thanks for the PR! I dropped a few minor comments and I will have an agent apply them :)

Comment on lines +164 to +169
for {type, internal_type} <- [
{"ranking", "ranking"},
{"percent", "percent"},
{"resultAchieved", "attemptResult"}
] do
test "import/export maps #{type} advancement to the destination round" do

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.

It should instead be a single test with WCIF including all the types, and assertions on the result.

Comment on lines +224 to +229
for {type, value, internal_type} <- [
{"ranking", 50, "ranking"},
{"resultAchieved", 1000, "attemptResult"},
{"resultAchieved", nil, "anyResult"}
] do
test "#{internal_type} qualification and dates survive import/export" do

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.

Same as above.

assert result.average == 2620
assert result.ranking == 1

[event] = Export.export_competition(Repo.reload!(competition))["events"]

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 belongs to the export test suite.

cutoff: wcif_round["cutoff"] |> wcif_cutoff_to_attrs(),
advancement_condition:
wcif_round["advancementCondition"] |> wcif_advancement_condition_to_attrs(),
advancement_condition: condition |> wcif_advancement_condition_to_attrs(),

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 have it as wcif_advancement_condition_attrs, since the input is participation ruleset that we are converting.

round.advancement_condition &&
round.advancement_condition |> advancement_condition_to_wcif(),
"participationRuleset" => %{
"participationSource" => participation_source_to_wcif(round, previous),

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 rename to participation_source_wcif since we are converting advancement condition instead.

jonatanklosko added a commit that referenced this pull request Oct 18, 2026
Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
Assisted-By: Claude Opus 5.5
@jonatanklosko

Copy link
Copy Markdown
Member

Merged menually with the extra changes :)

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.

3 participants