Skip to content

fix(ts): handle shadowed hasOwnProperty in programs - #500

Open
berce (bercedev) wants to merge 1 commit into
microsoft:mainfrom
bercedev:fix/program-own-property
Open

berce (bercedev) wants to merge 1 commit into
microsoft:mainfrom
bercedev:fix/program-own-property

Conversation

@bercedev

@bercedev berce (bercedev) commented Oct 31, 2026 •

Copy link
Copy Markdown

Fixes #488.

Parsed JSON can define its own hasOwnProperty value. The program validator then throws instead of returning an error result. Check properties through Object.prototype in code generation and evaluation, and cover malformed steps and valid object arguments with regression tests.

Focused program tests: 24/24 passed in an offline Podman container (unrelated compiler imports were stubbed). Full npm test could not run because the locked dependencies were not cached and package downloads were blocked.

Check own properties without invoking methods on parsed program values. Cover malformed steps and valid object arguments.
Copilot AI balanced review requested due to automatic review settings October 31, 2026 21:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified in the change to make property checks safe against hasOwnProperty shadowing.

No open issues 🎉

What changed in this PR

Fixes #488 by making TypeScript program property checks safe when parsed JSON defines its own hasOwnProperty value, preserving error-result handling for malformed steps.

Changes:

  • Uses Object.prototype.hasOwnProperty.call throughout code generation and evaluation.
  • Adds regression tests for malformed steps and valid object arguments containing hasOwnProperty.
File Description
typescript/​test/​program.test.ts Adds three regression tests covering validation, code generation, and evaluation.
typescript/​src/​ts/​program.ts Replaces direct property-check calls with shadowing-safe checks.

Review effort: Balanced

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.

Prototype Method Shadowing in Parsed JSON Programs Causes an Uncaught TypeError

2 participants