You are asking at a very good time. This depends on which version of PDI that you are using because there were a cascade of regressions and various expectations around variables, execution, namespaces and how things enter in from the shell and even with the repository.
The master list of issues and their status are here:
[PDI-14662] Collector Epic for Issues with Variable Resolutions - Pentaho Platform Tracking
So the next major release or next point release of a supported series should give you a more reliable environment to explore the ground rules.