Skip to content

fix(javascript): preserve array index positions - #668

Closed
rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/rea-array-projection-20261006
Closed

rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/rea-array-projection-20261006

Conversation

@rudycelekli

Copy link
Copy Markdown

What changed

Preserve JavaScript array positions in static value recovery. Array holes keep an explicit unknown slot; a spread with unknown length ends the fixed-index prefix. Canonical numeric member keys (including "1") now project array items without accepting "01" as an array index.

Real consumer reproduction

The complete built public analyzeJavaScriptApplication workflow analyzes an owned main.mjs. Before, const [first,,third] = ["zero",,"two"] omitted the value for third, and ["zero","one"][1] omitted the member value. A native Node process reports "two"/"one"; the repaired serialized semantic graph agrees on all three retained bindings. Separate regressions ensure an unknown spread does not shift a trailing literal into an earlier index, and noncanonical property spellings remain unknown.

Verification

  • Added regression group fails before; after focused dataflow/graph tests: 26 passed.
  • npm run check, npm run check:fast, npm run build:cached passed.
  • Built public application workflow/native Node comparison: three values agree.
  • git diff --check passed.

No schema or tool changes. Unknown holes and spread length remain unknown; this does not claim exact array length or evaluate source code during analysis. Hopper/Ghidra were not exercised: this changes provider-independent static JavaScript semantics. AI assistance was used for investigation, implementation and verification.

@morluto morluto left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve: array holes push explicit unknown to preserve indices, fixed prefix breaks on spread so trailing elements do not shift, and index projection uses canonical String(index)===key check (rejects 01/-1/1.5). Dataflow tests cover holes/canonical/spread. Checks green.

@morluto

morluto commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Superseded by #705, which cherry-picks this change (plus 13 sibling fixes) onto current main with conflict resolution and regenerated catalogs. Closing to keep one reviewable merge unit.

@morluto morluto closed this Oct 6, 2026
@morluto

morluto commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Thanks, @rudycelekli, for your work on “fix(javascript): preserve array index positions.” I appreciate your contribution to REA.

@morluto morluto added bug Something isn't working area: domain Domain logic, errors, and pure functions labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants