Skip to content

fix(javascript): preserve canonical rest-array property keys - #4272

Closed
maxazure wants to merge 1 commit into
morluto:mainfrom
maxazure:fix/rest-array-property-identity-4242
Closed

maxazure wants to merge 1 commit into
morluto:mainfrom
maxazure:fix/rest-array-property-identity-4242

Conversation

@maxazure

Copy link
Copy Markdown
Contributor

Summary

Fixes #4242. Preserve named rest-array property identity during lexical substitution instead of treating "01" as positional index 1.

Problem and expected behavior

A returned closure sending items["01"] ?? "FALLBACK", with rest arguments "FIRST", "SECOND", incorrectly acquired the inferred IPC channel SECOND. Only canonical array indices may select positional values. The noncanonical expression now stays unknown; the "1" control still resolves to SECOND.

Change and scope

Reuse the existing semanticArrayIndex owner in symbolic array lookup. Keep existing unknown reasons and missing-argument behavior. Add one public-CLI four-case regression in the existing wrapped-call-path suite. No new parser, undefined propagation, or fallback inference.

Related ownership review found no other digit-only parser in symbolic lookup. Separate ambient-write/data-effect analyses already reject leading-zero aliases and are outside this change.

Contract and boundary impact

  • Semantic owner and earliest changed stage: domain symbolic property lookup, consuming the existing canonical-index owner.
  • Contribution scope fit and linked maintainer decision: ordinary static-analysis correctness fix; separate scope decision not applicable.
  • CLI and MCP/tool-catalog contract: unchanged schemas and commands; corrected inferred values.
  • Provider, bridge, target-format, or platform compatibility: no provider or bridge changes; inert CommonJS fixtures tested on Linux.
  • Evidence, artifact, provenance, or reconstruction contract: preserve written dynamic expressions, observed evidence, and static candidate/inferred qualifications.
  • Target selection, authority, upstream behavior, and cleanup: no new target authority or execution; existing test-owned temporary directories and process cleanup.
  • Generated metadata, package, or installation impact: none; dependency/lockfile unchanged.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Updated the existing CLI wrapped-call-path suite with noncanonical, canonical, literal-fallback, and dynamic-key controls.
  • Executed the issue's four-case public CLI reproduction on base 6183544e8b42b65feaf4f674f860b1fb3b0c95eb, then after the fix. The new regression failed before the fix because the noncanonical terminal was SECOND instead of absent.
  • After: noncanonical has no inferred literal channel or terminal and retains the observed dynamic expression. Canonical remains SECOND; literal fallback remains FALLBACK; dynamic key remains unresolved.
  • Remaining gaps: no full suite, published-package test, real Electron execution, or macOS/Windows verification.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Cloud Linux, pinned Node 24.18.0 / npm 11.16.0, locked npm ci:

  • npm run build:cached — passed before baseline replay; focused tests rebuilt after the fix.
  • npm run test:focused -- src/domain/javascript/javascriptSymbolicBindings.test.ts src/domain/javascript/electronWrappedCallPaths.test.ts src/domain/javascript/javascriptSemanticAnalysis.dataflow.test.ts tests/boundary/cli/electronWrappedCallPaths.test.ts — 170 passed across 4 files.
  • npm run check:fast — passed.
  • npm run check — passed, including architecture guards.
  • npm run verify:test-discovery — 1376 files discovered exactly once.
  • git diff --check and normal pre-commit formatting/lint hooks — passed; hooks left the tested diff unchanged.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; removes an incorrect inferred literal.
  • Real Hopper/Ghidra, browser, or OS coverage: Linux static CLI workflows only; no real providers exercised.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: analysis never executes fixture code or loads Electron; no new execution or network capability.

Author readiness

Human owner: @maxazure

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Reuse the canonical index owner instead of treating named keys such as 01 as positional slots. Keep unresolved values and static inference limits.

Fixes morluto#4242
morluto added a commit that referenced this pull request Oct 15, 2026
Reuse the semantic array-index parser so leading-zero keys stay unresolved instead of selecting positional arguments. Preserve canonical indices, literal fallback and dynamic-key uncertainty.

Refs #4242, #4272

Co-authored-by: Liu Jie <[email protected]>
@maxazure maxazure closed this Oct 16, 2026
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Noncanonical rest-array keys select the wrong inferred IPC channel

2 participants