Skip to content

Destructure any sources read through string-literal keys - #1741

Open
jlucaso1 wants to merge 2 commits into
vercel-labs:mainfrom
jlucaso1:fix/1677-string-rhs-destructuring
Open

jlucaso1 wants to merge 2 commits into
vercel-labs:mainfrom
jlucaso1:fix/1677-string-rhs-destructuring

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

const { value } = events["a.b"] was refused with SC1031 when events was any, although assigning the RHS to a temporary already worked. Accept string-literal element reads in destrSpellingOf, using V8's dot spelling and decoded key text. Existing checked-dynamic destructuring evaluates the source once and performs the binding reads.

Source spellings containing NUL use an existing JSON-builder operation with an explicit byte count. Other expressions retain their existing error helper. The corpus covers escaped keys, renames, defaults, rest, nesting, ordered getters, lazy defaults, single RHS evaluation, assignment through the shared helper, and nullish error spelling. A diagnostic fixture pins the remaining refusals for calculated RHS keys, optional element reads and template literals.

Fixes #1677. #1503 supplies the identifier/numeric RHS path; #1552 concerns computed keys in the binding pattern.

Validation at 7aff706f6, compared with eca0cab8a:

  • Fork CI completed successfully: 52 jobs passed, including all 20 plain and 20 sanitized Linux shards; eight jobs were skipped by the existing CI policy.
  • The minimal reproduction fails with SC1031 on the base and compiles with the patch. Focused ASan differential and LLVM release/dev suites pass, as do the new and adjacent diagnostics, affected preflight/order batches, workspace build, lint, formatting and baseline completeness.
  • A reduced native consumer reads a map emitted by the installed @oxidezap/baileyrs 0.3.11 makeEventBuffer API using fictitious data. It prints notify 1 sample-1, byte-identical to Node, with empty stderr. The base refuses it with SC1031. This evidence covers the event-map boundary, not whole-library native compatibility or a WhatsApp session.
  • The complete zero-cost gate passes: all 2,746 baseline programs have byte-identical IR, LLVM and executable artifacts, with no allowlist. Benchmark compile-time geomean is -0.20% (95% CI -0.44% to +0.07%); self-hosting is -1.04%, within the 2% tolerance.
  • The gate uses unchanged compiled base/candidate code with byte-identical compiler declarations and shims resolved to one shared physical input directory. This avoids absolute shim paths changing IR metadata between checkout locations. The official comparator is unchanged; no output normalization or harness exception is applied. Original failing reports and a base/base control are preserved locally.

A bounded local full-suite attempt also exposed the existing library-mode K10 K5/K7 LeakSanitizer failure: the untouched base and candidate both report the same 59-byte leak and identical stdout. The Vercel Sandbox preflight could not access the configured project. These local environment limits remain recorded; the complete fork CI and zero-cost gate pass.

Upstream CI integration: the coverage.test.ts explain-dynamic snapshot currently fails with the same helper order/source-position difference on untouched upstream main and this PR. The Vercel deployment check requests external authorization. These are not reported as passing checks.

The same untouched-main CI run also reports contract-int32-arrays.ts, contract-int32-escapes.ts, and 6583-emitter-untyped-surface.ts failures, which are present in this PR CI as well. The issue patch remains unchanged.

Upstream CI has now completed on 7aff706f6: 29 jobs passed, 22 test jobs failed as documented above, the aggregate test gate failed, and eight jobs were skipped. The final pending IR-parity and sanitized jobs passed. Agent/security reviews and Socket checks passed; Vercel deployment authorization remains external. No tests or snapshots were changed to suppress these failures.

@vercel

vercel Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

@jlucaso1 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String-literal element access on the right of an any destructuring declaration is refused

1 participant