Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jfuglas
force-pushed
the
forge/quoted-table-keys
branch
from
October 31, 2026 19:46
eca249d to
83e8f2e
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues
No issue: this came out of a repository audit.
gh pr list --state open --searchforemit.rs,parity,luaKey) and found none that overlap.What and why
#750 made the JS emitter quote any table key that is not a plain Lua identifier, but only in
tools/lib/dsl/emit.js. Forge, the compiler that builds packs (forge guide compile,forge release pack), still wrote those keys bare. This ports the same behaviour torust/crates/forge-guide/src/emit.rs:lua_key,LUA_KEYWORDS,is_int_key, and anid_mapthat writes a non-integer key as a string after the integers.This is defence in depth, not a live exploit. Tracing today's inputs found no author text that reaches those bare keys:
names,writtenandnextWhenare already quoted,legs.jsonkeys are validated, andpreTitleskeys come from data.Guides.luashould not change: a bare key that was not an identifier or a keyword would already have been a Lua syntax error, so valid output only held keyslua_keyleaves bare. The one exception isgoto, which Lua 5.1 accepts bare and the list quotes as #750 does;addon/Polestar_Guides/Guides.luahas nogoto =key. Theguide_paritygoldens incargo testcompare the mini and slice output byte for byte.The report, checked
Not a bug report. The Rust tests use the same hostile keys as
tests/emit-keys.test.jsand read the output back through Lua 5.1 (mlua).Left as it is
data_inline(the import string's twin) writes JSON values, not Lua source, so it has no bare key. ItspreTitlesstill assumes numeric keys and panics on any other key, asdataInlinethrows in JS. Emitter: quote any table key that is not a plain Lua identifier #750 left that alone and so does this.emit_class_trainersstill writes{cls} = { ... }bare, asemitClassTrainersdoes in JS. Those keys are class names from our own data, inCore/ClassTrainers.lua, not a pack.Parity in CI: not added, and why
No workflow changes here.
parity.sh minidoes not pass on cleannext, so it was not added. I ran it on my fork at 463c52c and did not change the script or the fixture to make it pass.Without reference data (what CI has):
js-ref.jscalls the compiler directly and carries on, giving 12 errors, 6 warnings and a full pack.Only in ref-mini: pack.diagnostics.jsonalso names the data folder differently: absolute in JS,data/foreverin Rust.With the committed data slice (
--data rust/tests/golden/world/root/data/forever): I compared live JS output with theguide_paritygoldens, which are Forge's output. Forminiandslice,Guides.lua,Pack.luaand the TOC differ, and only Forge writespack_Horde/pack_Alliance. That is expected: both compile as Polestar's own pack, and the JS compiler never learnt format 8 (rust/tests/golden/guide/README.md).guide_paritydoes run in CI, but against frozen output, so it catches Forge changing and not the two compilers drifting apart.parity.shcan only compare our own pack:js-ref.jsandforge guide compile --guidesboth compile as Polestar's pack, whateverpack.jsonthe folder holds. I tried the 12 fixture packs intests/fixtures/packsthat way and every one came out as our own pack withGuides.luadiffering, so that run says nothing about community packs. A live check that could pass would have to compile a community pack with--packon both sides, which means changingjs-ref.jsandparity.sh. I have not tried that, so I don't know if it passes.Checks
changes/(written by hand;forge changelog checkruns in CI)node --test tests/emit-keys.test.jswas not run: nothing intools/changed.🤖 Generated with Claude Code