Skip to content

fix(semantics): preserve empty string property keys - #764

Merged
N0zoM1z0 merged 1 commit into
morluto:mainfrom
rudycelekli:fix/empty-property-semantic-keys-20261006
Oct 7, 2026
Merged

N0zoM1z0 merged 1 commit into
morluto:mainfrom
rudycelekli:fix/empty-property-semantic-keys-20261006

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 6, 2026 •

Copy link
Copy Markdown

Summary

Analyze legal empty-string dictionary keys without treating them as dynamic or rejecting the graph display label. A root-route dictionary such as const routes = {'': 'HOME'} previously caused analyze-javascript-application to return unreadable_output with /label (too_small). Member reads and destructuring also lost the exact HOME value.

Use a nullable exact key for semantic value, object, projection and frontier recovery, preserving '' distinctly from an unknown key. Keep the legacy name helper's behavior for its existing consumers. Display the empty property slot as "" while retaining the raw key and source identity. Dynamic identifier keys remain unknown; schemas are unchanged.

Verification

  • Native JavaScript returns HOME for member read and destructuring; built public CLI previously failed both and now succeeds with an exact HOME literal for root.
  • Nonempty-key control remains unchanged.
  • Upstream regression attempt: 6 fail, 9 pass. Final relevant semantic/graph/application/CLI suites: 244 pass across 14 files.
  • npm run build:cached, npm run check, npm run check:fast pass (125 lint warnings, zero errors).
  • Test temporary directories use the repository's awaited lifecycle helper.
  • No real Hopper/Ghidra/IDA verification performed: this changes inert JavaScript analysis only.

Codex assisted on behalf of @rudycelekli. The signed DCO source received independent review before publication. Hosted CI is tracked separately.

Follow-up scope

This fix covers the tested property-read, destructuring, slot-identity, and display-label paths. Remaining configuration, method-name, provenance, and effect consumers of the legacy property-name helper are tracked in #783; their migration and API-name controls are separate follow-up work.

@morluto

morluto commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Reviewed: nullable semanticStaticPropertyKey to distinguish '' from unknown/dynamic is the right direction, and the migrated paths (memberKey, evaluateObject, calls/objects/analysis projections, graph '""' label with raw name preserved) are each correct with good domain+graph+CLI coverage. COMMENT (non-blocking follow-up, not a blocker): same ''-as-dynamic conflation remains at src/domain/javascriptSemanticDataEffects.ts:146 (process.env[''] -> partial), src/domain/javascriptSemanticProjection.ts:239 (exact '' method mislabeled computed-dynamic), plus ~15 other semanticStaticPropertyName consumers using || null / length checks. Suggest a follow-up issue to audit/migrate them so the claim holds for all paths.

@morluto

morluto commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Review — COMMENT (approve fix direction; follow-up needed)

Summary

Introduces nullable semanticStaticPropertyKey() (string | null) so a legal '' key is preserved distinctly from an unknown/dynamic key. Fixes analyze-javascript-application returning unreadable_output for root-route dicts like {'': 'HOME'}; the graph slot label becomes '""' while raw name: "" is kept.

Verification

  • Each migrated call site is correct:
    • javascriptSemanticValues.ts: memberKey (name ?? undefined), evaluateObject (name === null);
    • javascriptSemanticCalls.ts, javascriptSemanticObjects.ts, javascriptSemanticAnalysis.ts correctly thread nullability into destructuring projections.
  • Graph label change is display-only; raw properties.name stays "" (pinned by acceptance test).
  • Good coverage for the claimed scope: domain test, graph-builder test, CLI acceptance for both read forms.
  • CI: all 20 checks SUCCESS. No schema/catalog change needed.

Follow-ups (same bug class survives on unmigrated paths)

  1. src/domain/javascriptSemanticDataEffects.ts:146:
    const key = semanticStaticPropertyName(node.property, node.computed) || null;
    process.env[''] still resolves to key: null / resolution: "partial" instead of the exact empty key. Please migrate to semanticStaticPropertyKey or state why env/argv keys are out of scope.
  2. src/domain/javascriptSemanticProjection.ts:239: semanticStaticPropertyName(node.key, node.computed) || \[computed@…]`mislabels an exact{'': fn}` method as computed-dynamic.
  3. ~15 remaining semanticStaticPropertyName consumers use === "", || null, or .length === 0 (e.g. javascriptSemanticResources.ts:96,147, javascriptSemanticDataEffects.ts:402, async/promise effects, static-analysis helpers). Suggest a follow-up issue to audit and migrate them all, since the PR claim ("without treating them as dynamic") currently holds only for the migrated paths.

@rudycelekli

Copy link
Copy Markdown
Author

Thanks for the review. Codex is assisting on behalf of @rudycelekli. Signed head b453a6cc68cc072acf93486c477783d42b790c06 rebases the existing fix onto current main and resolves the two appended-test conflicts while retaining the merged Promise and rest-argument controls. The production additions/removals are unchanged. The 259 focused tests, native/public CLI read/destructuring controls, build, and required checks pass; new hosted CI is pending.

The follow-up audit is filed as #783, with reproduced environment-key and method-name cases, a dynamic-key control, and per-consumer acceptance criteria. This PR's claim remains scoped to its tested read/destructuring/property-slot paths.

@N0zoM1z0 N0zoM1z0 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed headb453a6cc68. Nullable exact property keys preserve the legal empty string across value projection, destructuring and dynamic-key frontiers; the legacy method-name helper retains its existing behavior. Graph labels use a nonempty display value while raw keys and slot identity stay exact. Production build and all19 focused semantic/graph source tests and both relevant public-CLI acceptance cases passed on a frozen checkout; all19 hosted checks are green. Existing unconverted API-name consumers remain explicitly tracked in#783. No blocking findings in this patch.

@morluto

morluto commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Thanks, @rudycelekli, for your work on “fix(semantics): preserve empty string property keys.” I appreciate your contribution to REA.

darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 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.

3 participants