apple / apple/pkl

Stack overflow error when attempting to trace deeply nested object

Open
#1,200 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
11.5k
Forks
402
Avg merge
1d 15h
Merged PRs (30d)
20

Description

I'm working on creating a minimal reproduction of this, but when trying to trace an object that is deeply nested or uses many imports, `trace` will throw a stack overflow error. The basic context is that I am attempting to write some tests that run sanity checks on configuration written in pkl. The configuration amends a template that is defined in a remote module and is declared as a dependency is the `PklProject` file. The template itself imports a number of other modules that define type constraints and some output converters.

The test imports the configuration and defines some `fact` tests to check the sanity of the configuration. I am using import statements so that I can set some environment values that are otherwise provided at evaluation time. I wanted to `trace` the amended value to make sure that the values were being set correctly and ran into this error. The interesting thing is that the value can be operated on fine. Running comparisons for the `facts` works fine even for deeply nested values, but attempting to `trace` or render the same value produces a stack overflow error.

The error is too long to paste directly so I'm attaching it as a file:
[trace_stack_overflow.txt](https://github.com/user-attachments/files/22259043/trace_stack_overflow.txt)

Contributor guide

Open the contributing guide

Research direction

Start with the attached trace_stack_overflow.txt and the configuration's PklProject dependency setup, then reduce the deeply nested or heavily imported object to a minimal reproduction. Compare tracing or rendering the amended value with the fact comparisons that succeed; done means reproducing the failure and identifying a traceable or renderable result without stack overflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.