Skip to content

Conversation

@amousset
Copy link
Contributor

@amousset amousset commented Feb 9, 2026

  • Allow ranges with a unique value. It looks to me like an expected behavior compared to other implementations of ranges (python, etc.). This should not be a compatibility problem as it would currently crash the agent.
  • Make invalid step a soft fail. I don't see a reason to stop the agent in case the value is invalid (but I may be missing something).

Rationale: This avoids some special case handling when computing ranges where the bounds are equal (or lower than the step), with a consistent interface.

if (step_size < 1)
{
FatalError(ctx, "EXPANDRANGE Step size cannot be less than 1 or greater than the interval");
Log(LOG_LEVEL_ERR, "%s: Step size cannot be less than 1", fp->name);

Check notice

Code scanning / CodeQL

Pointer argument is dereferenced without checking for NULL Note

Parameter fp in FnCallExpandRange() is dereferenced without an explicit null-check
- Allow ranges with a unique value (as the range is already inclusive)
- Make invalid step value a soft fail

Changelog: Allow expandrange to output a single value
@amousset amousset force-pushed the allow-single-element-range branch from db2ba4d to de9375b Compare February 9, 2026 20:02
@larsewi larsewi self-assigned this Feb 10, 2026
@larsewi larsewi self-requested a review February 10, 2026 10:36
Copy link
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

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

Thanks @amousset! This makes sense to me 🚀

if (step_size < 1)
{
FatalError(ctx, "EXPANDRANGE Step size cannot be less than 1 or greater than the interval");
assert(fp->name != NULL);
Copy link
Contributor

Choose a reason for hiding this comment

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

I see you tried to fix the CodeQL issue. Can you change it to

assert(fp != NULL);

and put it in the top of the function?

@larsewi
Copy link
Contributor

larsewi commented Feb 10, 2026

@cf-bottom Jenkins please :)

@cf-bottom
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants