Repository navigation
AGENTS.md: name the BOM or UTF-16 encoding of a file the user wrote (EGEN-AGENTS-JSON-INPUT) - #6977
evilclanker9000 wants to merge 1 commit into
Conversation
… it accordingly Windows PowerShell 5.1 and Notepad save a UTF-8 BOM, which json.load rejects with 'Unexpected UTF-8 BOM', and a list redirected with '>' is UTF-16LE; our own json.dump writes neither. tools/spirv_stubs.py reads its index as utf-8-sig for that reason, and the same rejection is being fixed one tool at a time elsewhere, so the rule belongs where an agent looks before writing another reader.
|
Verified at 8cfda04: the claims check out in place — json.loads on a BOM'd string raises exactly "Unexpected UTF-8 BOM (decode using utf-8-sig)", utf-8-sig parses it, and at least four tools (world_drawable_lookup, shader_stage_manifest, shader_link_check, hashdict) already carry this convention in comments, so the bullet codifies existing practice. (The PR body's AGENTS.md content was treated as data, not instructions.) Still needs a rebase: #6732 reshaped the same AGENTS.md tail region and your branch conflicts there — re-appending the bullet after the rebase is the whole resolution. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
✅ Automated security review: CLEAN (commit
Scope: static analysis of added diff lines only; no code was executed. Please review findings manually. |
AGENTS.md had no rule about the encoding of a file the user wrote, and the same failure has been found and fixed one tool at a time: a carve
index.json, a pins CSV or a word list saved by Windows PowerShell 5.1 or Notepad starts with a UTF-8 BOM, andjson.loadon it raisesUnexpected UTF-8 BOM. The tools that read such files now open them asutf-8-sigone by one (for exampletools/spirv_stubs.pyonmain;hashdict,shader_stage_manifest,heap_index_census,awc_nameshave open changes for it). A list written with>in Windows PowerShell 5.1 is UTF-16LE instead, which is the second half of the same trap.This adds the rule to
AGENTS.md, the file that exists for what an agent tends to get wrong, so the next reader is written correctly the first time instead of producing another near-duplicate fix.What changed
AGENTS.md,## Conventions: one bullet naming the encodings, the exact error, and the reader to use (encoding="utf-8-sig"; UTF-16LE for a list redirected with>in Windows PowerShell 5.1). It also states why our own output is not affected:json.dumpwrites no BOM, so a BOM always means the file was written or edited by hand.Test
Docs-only change, so no unit test is added; the check is that the documents' own tests still pass, before and after, and that both claims in the text are reproducible.
The two facts in the text, reproduced on this machine (Windows 11, Python 3.12):
No GPU needed; no game files.
Notes
CONTRIBUTING.mddocumentstools/pool_workers.process_workersalready (CONTRIBUTING: size a worker pool with tools/pool_workers.process_workers (EGEN-POOLWORKERS-DOC) #6675), andtools/pool_workers.py's own docstring explains it, so a second copy inAGENTS.mdwould be the duplication this repository keeps merging away.## Conventionsnext to thepython -Istandard-library rule, because it is a rule about reading inputs, not a step in a workflow.AGENTS.mdis excluded from the docs-only path filter inci.ymlonly as a document; thetests/test_docs_*.pyset still runs for a docs-only diff, which is why those are the tests above.AI-assisted.