Skip to content

[BUG]: keywords.json deviated from generator file keywords.txt #3120

Description

@carloscasellas

Issue Type

Test suite / internal tooling (not user-facing output)

Context (Environment, Version, Language)

Input Format:
JSON (test fixture generation)

Output Language:
N/A — affects test fixture data, not generated output

CLI, npm, or app.quicktype.io:
Repo-internal script (test/keywords.py, test/make-keyword-tests.sh)

Version:
Current master

Description

test/inputs/json/priority/keywords.json is supposed to be fully generated by test/keywords.py (invoked via test/make-keyword-tests.sh), which reads keyword names from test/keywords.txt. In practice, the checked-in keywords.json has been hand-edited at some point and now contains three keywords that are not in keywords.txt:

  • clone
  • equalityContract
  • printMembers

These are C# record-type compiler-generated member names, presumably added to specifically cover a C# records naming collision. But because they only exist in the generated output and not in the generator's input list, running the generator script again silently drops them.

Input Data

cd test
python3 - <<'EOF'
import subprocess, sys
out = subprocess.run([sys.executable, 'keywords.py'], capture_output=True, text=True).stdout
cur = open('inputs/json/priority/keywords.json').read()
print('IDENTICAL' if out == cur else f'DIFFERS (disk {len(cur)} bytes vs generated {len(out)} bytes)')
EOF

Expected Behaviour / Output

Running test/make-keyword-tests.sh (or keywords.py directly) should reproduce the checked-in keywords.json byte-for-byte, since it's documented/implied to be generated output. (The sibling files keyword-unions.schema and keyword-enum.schema do regenerate byte-identically — only keywords.json has drifted.)

Current Behaviour / Output

keywords.json on disk is 10,272 bytes; regenerating produces 10,137 bytes. The three keywords listed above are present in the checked-in file but silently vanish if anyone regenerates it, because keywords.txt — the generator's source list — was never updated to include them.

Steps to Reproduce

  1. cd test
  2. ./make-keyword-tests.sh
  3. git diff inputs/json/priority/keywords.json
  4. Observe clone, equalityContract, and printMembers (and their associated test objects) being removed

Possible Solution

Add the three keywords to test/keywords.txt (in sorted position, with a comment noting they cover C# record member names), then regenerate all three files from make-keyword-tests.sh so the generator becomes authoritative again. Low-risk, mechanical fix — the only care needed is confirming the C# records fixture (csharp-records) still exercises these three names after the regeneration reshuffles chunk boundaries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions