ReviewOS

zig-utils/zig-js

Class: preserve inferred names before static initialization effects

#814
Closed chris opened this 9 days ago ·
9 days ago

Parent: #465. Related: #803, #806. Found while reproducing the remaining computed-property naming failures after #813.

At main 209201a, this returns false in both an ordinary IIFE and generator entry; Node returns true:

(function () {
  var key = Symbol('C');
  var object = { [key]: class { static seen = this.name; } };
  return object[key].name === '[C]' && object[key].seen === '[C]';
})()

NamedEvaluation must supply the class's inferred name before static field/block effects observe it. Naming the returned constructor after class evaluation cannot establish that ordering. Preserve classes with their own static name method/field and explicit class self-bindings rather than overwriting them.

Acceptance:

  • Pass the evaluated property key/name through exact class NamedEvaluation before static initialization in tree-walker, VM and native entry paths, with Symbol absent/empty/described names and once-only key coercion.
  • Cover static fields/blocks, explicit class names, own static name definitions, heritage/computed-name ordering, TDZ, escape and abrupt completions.
  • Verify actual moving-GC ownership, allocation-failure restoration, no-GIL/TSan and nonzero paired conformance; report before/after gains independently from object-method metadata fixes.

Do not patch the name after observable static effects, rewrite user source, disable GC, or count fallback as bytecode completion. Existing native activation/stack/queue/job/Promise/Worker lifecycle is outside this semantic change.

Exact baseline runner and 34 Node/current-main entry probes are retained at /Users/chris/.cache/zig-js-vm-naming.7Wj8Ri. The class-static-name probe is one logical case / two entry forms; its own-static-name control already passes. Broader forced-tier coverage remains to be added before claiming completion.

9 days ago

The complete positive Object-literal paired census additionally identifies the existing upstream witness test/language/expressions/object/fn-name-class.js: forced tree-walker passes, required VM fails the expected Symbol-derived name [test262]. It is the one remaining failure after #815's eight function/method naming gains (1,006/1,007 paired passes; negative/fixture files excluded). This witness is retained under this class-specific issue, not silently dropped from #815's report.

The earlier static-initializer probe still distinguishes the deeper ordering requirement: naming a returned class after its static fields run is insufficient, even if it makes the upstream name-only assertion pass. No class patch has landed yet.

9 days ago

First candidate evidence: 31 local semantic probes improve 11/31 to 31/31; native forced-tree/required-bytecode pairs improve 10/31 to 31/31. The full positive Object-expression census improves 1006/1007 to 1007/1007, one measured required-tier gain (fn-name-class.js), zero measured regressions. The separate native subtree report changes 1 divergence/1169 agreements to 0/1170; agreement includes negatives and is not a passing-test count. Seven focused Debug tests passed, including three verified moving fixtures in each forced tier, allocation-failure restoration, and four no-GIL lanes x32 in each tier. Async suspension coverage, sanitizer and broader default scopes are still being verified. No production change has been pushed for #814 yet.

References do not uniformly implement the current rule: Node 24.18.0 passes 30/31 local probes, system JSC 18/31. Node overwrites the static name method for the computed anonymous-class case; system JSC preserves it but lacks early inference for several computed-name static effects. Tests follow ClassDefinitionEvaluation/NamedEvaluation ordering; neither reference is treated as universally authoritative. Evidence and exact first-candidate hashes: /Users/chris/.cache/zig-js-class-name.mw5loL.

9 days ago

Landed as 5308715: https://github.com/zig-utils/zig-js/commit/53087159203ba269b33ccd89199b5ba4cd1d848f . The final revision retains 31/31 local forced-tier pairs, 1007/1007 positive Object pairs (+1 required-tier test), and 12342/12342 default tests across 12 subtrees (0 default flips/regressions). Final unsuppressed ReleaseSafe+TSan passes class naming 8/8, literal metadata 13/13 and Symbol 24/24; default 400 and verifier 300 Debug fuzz programs pass with seed 1, zero failures. Public API and relocation audits pass.

The native full Debug suite is now running all 2140 linked tests on four shards, using the exact landed source. This remains an open terminal validation item alongside combined-main CI; it is not being labeled passed prematurely. Logs, binaries, hashes, before/after scopes and patches: /Users/chris/.cache/zig-js-class-name.mw5loL. No stack/queue/job lifecycle changes. The separately reproduced class-key coercion ordering defect is #819.

9 days ago

Terminal local integration result for the exact pushed 5308715 revision: native test-parallel completed all 2140 linked tests, 2139 passed, one platform skip, zero failed/leaked, 653.8 seconds across four shards. Logs and plan.tsv are in /Users/chris/.cache/zig-js-class-name.mw5loL/full-debug-shards; full-debug.log and final-debug-binary.sha256 identify the run. This includes the earlier descriptor, Symbol and function-metadata fixes plus the intervening error-message changes. Current CI 33207180719 is still running; no all-green CI claim yet.

9 days ago

Closing with terminal combined-main integration evidence: CI 33211154123 at e24c4fa completed successfully: 53 successful checks, one skipped nightly-only check, zero failed/cancelled checks. The implementation fix(class): infer names before static initialization (#814) is in that revision. This completes the pending integration condition alongside the scoped local/conformance evidence recorded above. Separately discovered Error-intrinsic, Array-realm, prototype-type and restriction-path defects remain open in #823, #824, #825 and #826; this closure does not claim those are fixed.

Sign in to comment on this issue.