Skip to content

Selûne v0.5.0 — Moonglow

Latest

Choose a tag to compare

@CharlesHoskinson CharlesHoskinson released this 06 Dec 05:36

Selûne v0.5.0 — Moonglow

SelûneCraft v3, Jenevelle v3, formally verified libs/coordinator, and the permanent selunecraftqa gate.

This candidate moves the render loop, the audio graph, the save path, and the terrain worker of a browser voxel game into MoonBit. Which statements about it rest on a proof, which on a bounded model, which on a browser run, and which on nothing yet?

The candidate is commit 8204e0475e9f99cc4f9303b3a1cedebc27593786 with tree 12cdb4a3227d84a95c5b971b555f86beb5161a5f. Two later commits add evidence files only: 685f2c5c8a947b6b66dfbe1f388408e92b68dbe3 records the browser receipts, and c63b9ad352fc69652d5dc7165edb39beda465d13 refreshes the Quint controls receipt. Against the RC10b baseline 31157e7303233ca8ffa0d91b768cd415c2e187ed, the candidate changes 545 files: 343 added, 187 modified, and 15 deleted, with 405,198 insertions and 33,345 deletions. Tagged as v0.5.0 at commit 88eef0a823407691c1a20fa551b6a4dfcdf6ca2b (after adding docs/SELUNECRAFT-V3-RELEASE-NOTES.md at 1064553c and binding receipts/quint-controls-v032.json at 88eef0a8).

Web layer

The baseline held seven hand-written modules that carried 10,141 lines: atlas.js, audio.js, webgl.js, ui.js, main.js, opfs_regions.js, and gen_worker.js. None of them exists in games/selunecraft/web or in site/play. The game packages under games/selunecraft/src/web_v3 contain no extern "js" declaration.

Inline JavaScript remains inside the library. Across all of libs/jenevelle, the verifier counts 947 extern "js" declarations with 9,213 inline lines.

Requirement SWB3-006 (openspec/changes/selune-web-v3/specs/canvas-input-raf/spec.md:132 and openspec/changes/selune-web-v3/design.md:53) allows each flavor at most 16,384 bytes of glue after Brotli at quality 11 and window 22. In the Wasm-GC flavor, the bridge selune_wasm_gc_bridge_v3.mjs measures 6,268 bytes, and the loader selunecraft_loader_v3.mjs measures 521 bytes. Their sum of 6,789 bytes is 41.4 percent of the budget. The compiled worker selunecraft_worker_mbt.mjs uses 24,507 Brotli bytes under its separate 24,576-byte exception (openspec/changes/selune-web-v3/design.md:55). The JavaScript flavor loads no glue file.

Jenevelle v3 browser ports

Six runtime packages are new in libs/jenevelle: wasm_bridge/arena, canvas, webgl2, webaudio, opfs, and worker. The library diff is 76 files and 34,963 insertions.

The code generator emits the Wasm-GC bridge from an allowlist of 123 WebIDL operations. Those operations feed one SHA-256 digest, 53f9f56ef69046de266225634df7b70c90a01b874f35e39f51c3e94f87f28846, and the bridge function verifyExports compares it with the digest words that a Wasm module exports when it loads. The default JavaScript application never loads that bridge, so the digest check does not guard it.

In the WebGL2 port, function resolve_declared_uniforms at libs/jenevelle/webgl2/port.mbt:75 returns UnknownUniform for a name that the linked program does not declare. The visual receipt reads two flags from the linked terrain program in a live page, packedShaderUsesAtlas and packedShaderBoundAtlas, and both are true. The JavaScript backend registers webglcontextlost and webglcontextrestored listeners at webgl2_js.mbt:37-42. Recovery after a lost context is exercised against the mock port only; no browser receipt covers it.

The glTF 2.0 loader in webgl2 parses binary .glb files in MoonBit. The worker pool admits at most four in-flight requests per worker and fences each reply by worker generation and world epoch.

Two page shells

Shell index.html runs the JavaScript build. Its Content Security Policy sets script-src 'self' and has no wasm-unsafe-eval source. Shell index_wasm_gc.html adds only wasm-unsafe-eval to its Content Security Policy, updates the page title and profile metadata, and loads selunecraft_loader_v3.mjs at line 554. Each shell has one external module script and no inline script, import map, or inline event handler.

The second shell does not play the game through Wasm. Its 24-line generated loader (site/play/selunecraft_loader_v3.mjs:7-22) conditionally instantiates selunecraft_app_wasm_gc.wasm through the bridge, runs the ABI v3 handshake and a boot export, and then imports selunecraft_app_mbt.mjs without condition. The frame loop is therefore the JavaScript build in both shells. The verifier records wasmGcFrameLoopAttested: false.

All 675 files under site/play match their counterparts under games/selunecraft/web byte for byte. The source tree adds one verifier package, verify_mbt.

Storage: one worked case

Two tabs can write the same region file. Suppose the first tab enters its commit phase and its caller then times out. If the timeout released the lock, the second tab could write while the first close is pending.

The Quint model spec/jenevelle_v3/opfs.qnt states the rule as invariant inv_commit_owner: a region in its commit or readback phase is locked. The mutant mutants/opfs_inv_commit_owner.qnt lets the caller timeout release the lock. A simulation of the mutant breaks the invariant in three transitions: start, enter commit, caller timeout. The unmutated model holds all three of its invariants over 2,048 sampled traces of 40 steps at seed 17.

That bounded model check covers only the sampled traces and step bound. It can find a counterexample and cannot exclude one outside that envelope, and no committed receipt covers the Jenevelle Quint suite at this candidate.

Under a Web Lock, write_and_readback_mbt in libs/jenevelle/opfs/opfs_js.mbt disarms the pre-commit deadline before close() at line 648. It then reads the bytes back through a fresh handle at line 655, compares revision and payload under the lock, and releases the lock before reporting durability (libs/jenevelle/opfs/opfs_js.mbt:955-985).

Each stored chunk is a canonical 24,588-byte record. The game store fails closed: an existing world does not reopen when its authority metadata cannot be read (region_store.mbt:76-124). A deferred chunk save arms a 50 ms retry timer (app_v3.mbt:1428-1452). When an open v3 store resumes a v2 save that needs legacy migration, it runs through a staged migrator; if migration fails, the app reports it as deferred and continues into the world (app_v3.mbt:2104-2130). The JavaScript profile of the browser run records opfsResumeOk: true. No browser receipt covers a v2 migration or recovery from lost authority.

Game content

The bundle holds 59 .glb models that total 1,657,100 bytes and 44,956 triangles. The audit glb_59_audit.mjs passes all 59 on their applicable geometry, pivot (including bottom-centered grounding for 21 models), and mirror-parity checks (games/selunecraft/tests/glb_59_audit.mjs:618-635). Drawing is narrower: the renderer wires 28 models into a live draw path and loads the other 31 without drawing them.

The sound library holds 554 effect takes in 206 cue directories and 10 soundtrack tracks. Four cue directories are named amb.bed; the mixer keeps three persistent bed slots, for amb.bed.moonmeadow, amb.bed.cave_depths, and amb.shrine.hum. The soundtrack streams through media elements and crossfades over 4.0 seconds by default. A user gesture requests the audio unlock. Fault cases F1 to F6 test how that request fails and recovers. The playtest bot passed its in-page meter check; host audio capture was unsupported there, so no receipt shows sound leaving the machine.

Browser evidence

The master receipt games/selunecraft/spec/receipts/selunecraftqa-latest.json has self-hash ca46cb450362c863bdef3694d9061f2282d720d7418c1d8f4821b8f8bdea12a4. It comes from the clean candidate tree and records nine passing child receipts under children/. The seven browser suites each report the served bundle d06f54aaafc876947beca54bd8324de25d481bde4d79f65c4f17235c5fadca2a. Every frame loop in them is the JavaScript build.

  • The closure verifier measured 600 frames with zero JavaScript allocations.
  • The fault suite passed 9 of 9 cases, and the playtest bot ran 30 seconds with trusted Chromium pointer and key events driven over CDP (playtest_bot.mjs:22, cdp_driver.mjs:817,915). Those events enter through input_nav.mbt and ui_controls.mbt, which call the mc_cam_ and mc_nav_ kernels.
  • The visual suite passed gates SC3-VIS-001 to SC3-VIS-010. Gate 006 checks 12 named title controls (the Play control, four seed presets, and seven settings) at both viewport sizes (visual_world_suite.mjs:1708-1747), and gate 010 reads the camera after a mouse drag.
  • The Perf [F3] benchmark took 300 samples: 24.2 frames per second on average, 20 at the 1 percent low, 50 ms at the 95th percentile, and zero frame allocations.
  • The block and biome suite passed 31 of 31 blocks and 5 of 5 biomes. The mutant suite killed 10 evaluator mutants and 6 live controls.

The canonical visual captures (spawn-0deg.png, night-shrine.png, perf-f3.png, flora-closeup.png, and the block and biome sheets) are hash-bound in games/selunecraft/spec/receipts/children/visual-world.json and stored in the untracked artifact directory target/visual-qa/rc16-strict-clean/.

Proofs and specifications

The Lean 4.35.0 receipt spec/receipts/lean-build-receipt.json has SHA-256 b0100a3a7dcc9381dc0b9c1eb0e6322a70a57a726d56f76ea746fe112b8a6735. It audits 255 theorems with no sorry and only the core axioms. The receipt names commit 1ff490264b3c98aca79db4409ca4b8752953a338 and tree 378ad9f4baca77d4dd9857ce2dc91be4e67ee2c5, which are older than the candidate; no Lean source under spec/ differs between the two commits.

One audited theorem shows the scope. Function nextRevision returns the next revision when the durable revision is below a ceiling. Theorem nextRevisionAtCeiling proves that it returns nothing when the two are equal: at revision 8 with ceiling 8 there is no revision 9. The proof concerns a two-argument arithmetic function and does not show that the browser code calls it.

Both requirement sets hold 78 and 72 requirements, and they passed DrWatt 0.3.0 validation and strict EARS lint at commit 2b2570d; their files are unchanged since. All 103 rows of libs/jenevelle/obligations_v3.mars remain open.

Receipts still missing before a GA tag

None of the following has a committed receipt at the candidate:

  • Three-target MoonBit test counts and interface parity for libs/jenevelle, libs/coordinator, and games/selunecraft.
  • Dual-prelude moon prove counts for the Jenevelle and game kernels.
  • Runs of the four Jenevelle Quint models and their 12 mutants. The last full exercise ran at 2b2570d, and the committed Quint receipt covers three other models.
  • An interactive frame loop that runs in Wasm-GC (wasmGcFrameLoopAttested: false).
  • Refreshed muninn and huginn benchmark receipts. The latest Warden tick lists four WD-BENCH-001 findings against those two cross-host files.
  • Closure of the open MUST rows in the SelûneCraft v3 MARS ledger and unanimous GA-tag sign-off. One blinded council seat approved with notes; the second verified all RC16 QA, visual, test, and coordinator checks while withholding a formal GA tag pending the cross-host benchmark receipts, Wasm-GC scope decision, and open MARS rows.