[PR #666] [MERGED] fix(javascript): preserve primitive addition coercion #2149

Closed
opened 2026-10-16 21:14:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/666
Author: @rudycelekli
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @morluto

Base: main ← Head: fix/rea-primitive-addition-20261006


📝 Commits (1)

  • 8174c88 fix(javascript): preserve primitive addition coercion

📊 Changes

2 files changed (+20 additions, -3 deletions)

View changed files

📝 src/domain/javascriptSemanticAnalysis.dataflow.test.ts (+17 -0)
📝 src/domain/javascriptSemanticValues.ts (+3 -3)

📄 Description

What changed

Static JavaScript value recovery now concatenates primitive + operands only when either operand is a string. Booleans and null follow numeric coercion, so downstream semantic graph literals match JavaScript instead of inventing strings.

Reproduction and evidence

On a real owned main.mjs, the built public analyzeJavaScriptApplication workflow previously reported true + 1 as "true1" and null + 2 as "null2". A separate native Node process evaluates both as 2. The repaired workflow returns those native values; string concatenation and ordinary numeric addition controls remain unchanged. The proof uses the complete application inventory and serialized semantic graph, not only an expression helper.

Verification

  • Before: 3 added coercion regressions failed; 19 existing/control tests passed.
  • After: npm run test:focused -- src/domain/javascriptSemanticAnalysis.dataflow.test.ts src/application/JavaScriptSemanticGraphBuilder.test.ts — 29 tests passed.
  • npm run check, npm run check:fast, npm run build:cached — passed.
  • Built public application workflow/native Node comparison — all four values agree.
  • git diff --check — passed.

No tool/schema or provider protocol changes. Hopper/Ghidra real-provider verification was not run because this patch changes execution-free JavaScript constant analysis. Nonfinite numbers and undefined are outside this patch's scope. AI assistance was used for investigation, implementation and verification.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/666 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/rea-primitive-addition-20261006` --- ### 📝 Commits (1) - [`8174c88`](https://github.com/morluto/rea/commit/8174c88638aee4ae74b3aff8efa52f2b8cfc740d) fix(javascript): preserve primitive addition coercion ### 📊 Changes **2 files changed** (+20 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascriptSemanticAnalysis.dataflow.test.ts` (+17 -0) 📝 `src/domain/javascriptSemanticValues.ts` (+3 -3) </details> ### 📄 Description ## What changed Static JavaScript value recovery now concatenates primitive `+` operands only when either operand is a string. Booleans and null follow numeric coercion, so downstream semantic graph literals match JavaScript instead of inventing strings. ## Reproduction and evidence On a real owned `main.mjs`, the built public `analyzeJavaScriptApplication` workflow previously reported `true + 1` as `"true1"` and `null + 2` as `"null2"`. A separate native Node process evaluates both as `2`. The repaired workflow returns those native values; string concatenation and ordinary numeric addition controls remain unchanged. The proof uses the complete application inventory and serialized semantic graph, not only an expression helper. ## Verification - Before: 3 added coercion regressions failed; 19 existing/control tests passed. - After: `npm run test:focused -- src/domain/javascriptSemanticAnalysis.dataflow.test.ts src/application/JavaScriptSemanticGraphBuilder.test.ts` — 29 tests passed. - `npm run check`, `npm run check:fast`, `npm run build:cached` — passed. - Built public application workflow/native Node comparison — all four values agree. - `git diff --check` — passed. No tool/schema or provider protocol changes. Hopper/Ghidra real-provider verification was not run because this patch changes execution-free JavaScript constant analysis. Nonfinite numbers and undefined are outside this patch's scope. AI assistance was used for investigation, implementation and verification. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:14:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2149
No description provided.