Skip to content

Fix numeric precision, sequence operations, and rendering safety - #34

Merged
ardan-bkennedy merged 9 commits into
mainfrom
bill/issues
Oct 26, 2026
Merged

ardan-bkennedy merged 9 commits into
mainfrom
bill/issues

Conversation

@ardan-bkennedy

Copy link
Copy Markdown
Contributor

Summary

Fix nine confirmed bugs affecting numeric correctness, sequence operations, and safe template rendering. Each fix includes regression coverage reproducing the original failure, with expected behavior checked against Python Jinja2 where applicable.

Numeric correctness

  • Preserve integer precision in equality, membership, ordering, and sorting, including mixed integer/float comparisons.
  • Preserve integer precision and object key order in fromjson; reject unsupported numeric values and trailing JSON content.
  • Reject malformed and out-of-range numeric literals instead of silently accepting incorrect values, while correctly parsing MinInt64 and its filters.
  • Keep sum in integer arithmetic until floating-point promotion is needed.

Sequence operations

  • Support string and list repetition in either operand order, negative and zero counts, and independent outer-list copies.
  • Reject repetitions exceeding 64 MiB of string bytes or list backing storage before allocation.
  • Stop range before its counter overflows in either direction.
  • Prevent select, reject, selectattr, and rejectattr from panicking when no explicit test is supplied.

Rendering safety

  • Render circular dictionaries and lists with Python-style recursion markers.
  • Handle container self-equality without recursively comparing contents.
  • Return a controlled error for circular JSON, including indented output, without mistaking shared references for cycles.

Validation

  • Added regression tests and controls for all nine issues.
  • Full test suite and race detector pass.
  • go vet, Staticcheck, and build pass.

Integer arithmetic remains bounded by the engine’s existing int64 support; these changes do not introduce arbitrary-precision arithmetic or general integer-overflow handling.

Closes #15, #16, #17, #18, #19, #20, #21, #22, #23.

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.

Circular values can crash or hang rendering

1 participant