Skip to content

The submit form accepts the languages it offers - #100

Merged
kisielewski merged 1 commit into
mainfrom
fix/the-submit-form-accepts-c
Sep 2, 2026
Merged

The submit form accepts the languages it offers#100
kisielewski merged 1 commit into
mainfrom
fix/the-submit-form-accepts-c

Conversation

@kisielewski

Copy link
Copy Markdown
Member

The submit form's file field accepted .cpp, .cc, .py and .txt. The catalogue behind its own language select has eight C toolchains, and every one of them accepts .c and nothing else — so choosing C11 (GCC) and uploading main.c was refused by the form in front of the Runner, with "Dozwolone rozszerzenia: .cpp, .cc, .py, .txt". A C solution could be pasted into the editor and never uploaded as a file.

.txt was wrong the other way: no toolchain of this type accepts it, so the form offered a file the Runner would have refused as a compilation error.

Found by submitting a C program through the real screen, which is the only place it shows: the select and the file field are set from two different lists in two different files, and nothing compared them.

The change

The accept lists move into src/components/editor/languages.ts, beside the catalogue they have to agree with, and src/renderers/index.ts asks for them. standard-io@1 now takes .c, .cpp, .cc, .cxx, .c++ and .py — every extension the Runner accepts for a toolchain of this type, and none it does not.

Deliberately a superset of any one toolchain's own extensions: the browser's filter is a convenience and the Runner is the gate, so narrowing it to the chosen language would only hide a file somebody legitimately renamed, while the real refusal still arrives with a message naming what that toolchain takes.

What checks it

npm run check:languages, new, and in CI beside check:package. It compiles languages.ts — which imports nothing — and asserts both directions: every toolchain the form offers has an extension it can be uploaded under, and nothing is offered that no toolchain would take.

Sabotaged before it was believed. Putting the old list back:

FAIL: every toolchain the form offers has a file it accepts: c89-gcc, c89-clang,
      c99-gcc, c99-clang, c11-gcc, c11-clang, c23-gcc, c23-clang cannot be uploaded
FAIL: and nothing is offered that no toolchain would take: .txt

CLAUDE.md's step table and count are updated with it, as ci.yml asks.

Its file field took `.cpp`, `.cc`, `.py` and `.txt`. The catalogue behind the
select has eight C toolchains that accept `.c` and nothing else, so a C
solution could be pasted and never uploaded — and `.txt` is refused by every
toolchain of this type.

The list moves next to the catalogue it has to agree with, and
`check:languages` holds them together.
@kisielewski
kisielewski merged commit a0c3e3d into main Sep 2, 2026
3 checks passed
@kisielewski
kisielewski deleted the fix/the-submit-form-accepts-c branch September 2, 2026 07:19
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.

1 participant