Skip to content

[SDK-433] JSON parse error when config contains unexpected type#858

Open
lposen wants to merge 1 commit intoemb-ootb/masterfrom
loren/embedded/SDK-433-json-parser-crashes-with-incorrect-configs
Open

[SDK-433] JSON parse error when config contains unexpected type#858
lposen wants to merge 1 commit intoemb-ootb/masterfrom
loren/embedded/SDK-433-json-parser-crashes-with-incorrect-configs

Conversation

@lposen
Copy link
Copy Markdown
Contributor

@lposen lposen commented Apr 22, 2026

🔹 JIRA Ticket(s) if any

✏️ Description

Fix error when config contains unexpected type

Testing

  • Run app with embedded
  • Go to embedded tab
  • Click "Get Messages"
  • Click "Set View Config"
  • Add JSON with incorrect type: EG: {"borderWidth":"45"}
  • The app should not crash

@github-actions
Copy link
Copy Markdown

Lines Statements Branches Functions
Coverage: 68%
68.83% (519/754) 56.11% (202/360) 64.82% (164/253)

@qltysh
Copy link
Copy Markdown

qltysh Bot commented Apr 22, 2026

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on emb-ootb/master by 1.36%.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
src/embedded/hooks/useEmbeddedView/useEmbeddedView.ts100.0%
New Coverage rating: A
src/embedded/utils/normalizeEmbeddedViewConfig.ts94.3%13, 17
Total94.7%
🤖 Increase coverage with AI coding...
In the `loren/embedded/SDK-433-json-parser-crashes-with-incorrect-configs` branch, add test coverage for this new code:

- `src/embedded/utils/normalizeEmbeddedViewConfig.ts` -- Lines 13 and 17

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@qltysh
Copy link
Copy Markdown

qltysh Bot commented Apr 22, 2026

3 new issues

Tool Category Rule Count
qlty Structure Function with high complexity (count = 10): coerceNumericField 2
qlty Structure Function with many returns (count = 7): coerceNumericField 1

console.warn(
`[IterableEmbeddedView] Ignoring ${String(key)}: expected number or numeric string, got ${typeof value}`
);
return undefined;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Found 2 issues:

1. Function with many returns (count = 7): coerceNumericField [qlty:return-statements]


2. Function with high complexity (count = 10): coerceNumericField [qlty:function-complexity]

next[key] = coerced;
}
}
return next;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function with high complexity (count = 12): normalizeEmbeddedViewConfig [qlty:function-complexity]

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.

1 participant