Skip to content

bug: oversized numeric placeholder indices raise instead of using the missing-value fallback #91

Open

Description

@Bbenchaya

Problem

Following #76, _lookup_path checks segment.isdecimal() before converting a list index with int(segment). This rejects superscript digits correctly, but an all-decimal segment longer than Python's configured integer-string conversion limit still raises ValueError. The exception bypasses both the missing-path marker and default(...).

Confirmed on main 7570cfe with the default 4,300-digit limit. Priority: low (P3). This is an extreme malformed-input edge case and is not a reason to reopen #61 or revert #76.

Reproduction

import sys
from stuntdouble import resolve_output

limit = sys.get_int_max_str_digits()
assert limit > 0  # Default is 4300; this reproducer requires the limit enabled.
index = "9" * (limit + 1)
template = "{{input.items." + index + " | default('missing')}}"
resolve_output(template, input_data={"items": []})
# Actual: ValueError: Exceeds the limit (...) for integer string conversion
# Expected: "missing"

Acceptance

  • Treat an index that cannot be converted as an unresolved path segment, preserving the existing marker/default behavior.
  • Cover both input and config references, with and without a default, and list/tuple traversal.
  • Preserve normal indices and supported Unicode decimal digits.
  • Do not disable or globally change Python's integer-conversion limit. Regression tests should remain valid when the environment configures a different limit.

Relevant files: src/stuntdouble/resolving.py, tests/test_resolving.py.

Filed with Codex assistance during a maintainer issue audit.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions