Skip to content

fix: resolve direct path expressions on Any-typed variable as Any#98

Merged
barinali merged 2 commits intomainfrom
issue-87-fix
Mar 19, 2026
Merged

fix: resolve direct path expressions on Any-typed variable as Any#98
barinali merged 2 commits intomainfrom
issue-87-fix

Conversation

@barinali
Copy link
Copy Markdown
Contributor

@barinali barinali commented Mar 13, 2026

Related to #87

Proposed Changes

This pull request aims to mark unresolved FEEL path expression variables as any preserving their FEEL expression as info.

image

Checklist

Ensure you provide everything we need to review your contribution:

  • Contribution meets our definition of done
  • Pull request establishes context
    • Link to related issue(s), i.e. Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}
    • Brief textual description of the changes
    • Screenshots or short videos showing UI/UX changes
    • Steps to try out, i.e. using the @bpmn-io/sr tool

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts Zeebe FEEL variable resolution so that unresolved path expressions (e.g. =agent.context) do not get typed as Null when their root variable is effectively unknown (Any), preserving the original FEEL expression in info for UI display.

Changes:

  • Extend resolveReferences to convert certain null evaluation results into Any (atomicValue undefined) when the referenced root variable is Any-typed.
  • Preserve the original FEEL expression as info for these “unknown” results (aligning with #87 expectations).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +115 to +116
return entry instanceof EntriesContext &&
getType(entry.value) === 'Any';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot Provide a test case that proves the suggestion

@nikku nikku changed the base branch from issue-87 to main March 16, 2026 22:00
@nikku nikku requested review from a team and Buckwich March 16, 2026 22:00
Copy link
Copy Markdown
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

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

Makes sense.

We could add an additional test to verify nested behavior =agent.foo.bar with agent.foo being defined vs. agent being defined vs. agent not being defined - I am not sure how the current roots detection will handle such scenarios.

Research question: If agent = { bar: 10 } exists, what is the value of agentFooBar = agent.foo.bar?

We can also leave that for another day. Overall, good stuff. Good to start from solid test coverage ⭐

Related to #87

Path FEEL expressions like `=agent.context` on an `Any`-typed variable
incorrectly resolve as `null` with `Null` type instead of `Any`.
Copy link
Copy Markdown

Copilot AI commented Mar 18, 2026

@barmac I've opened a new pull request, #99, to work on those changes. Once the pull request is ready, I'll request review from you.

@barinali
Copy link
Copy Markdown
Contributor Author

Makes sense.

We could add an additional test to verify nested behavior =agent.foo.bar with agent.foo being defined vs. agent being defined vs. agent not being defined - I am not sure how the current roots detection will handle such scenarios.

Research question: If agent = { bar: 10 } exists, what is the value of agentFooBar = agent.foo.bar?

We can also leave that for another day. Overall, good stuff. Good to start from solid test coverage ⭐

expression provided actual expected
=agent.foo.bar agent={ bar: 10 } null <Null> =agent.foo.bar <Any>
=agent.foo.bar agent={ foo: {} } null <Null> =agent.foo.bar <Any>
=agent.context agent=agent =agent.context =agent.context <Any>

The current root detection implementation is only providing top-level variables, not property accesses. So, when agent.foo.bar is in question, we only have agent as unresolvedRoot and cannot distinguish absence of unresolved intermediate properties (absence of agent.foo for agent.foo.bar).

I think this pull request introduces a pragmatical iteration for variables like the third sample in the table above without introducing an irrecoverable complexity. So I plan to go ahead with this pull request (as it's a partial improvement) and create an issue to follow up on the other scenarios especially after #74 lands.

@barinali barinali changed the title fix: resolve path expression on Any-typed variable as Any, not Null fix: resolve direct path expressions on Any-typed variable as Any Mar 18, 2026
@barinali
Copy link
Copy Markdown
Contributor Author

@nikku created #100 🎉 as a follow-up item.

@barinali barinali merged commit 2fe2093 into main Mar 19, 2026
5 checks passed
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Mar 19, 2026
@barinali barinali deleted the issue-87-fix branch March 19, 2026 08:44
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.

5 participants