gajus / gajus/roarr

Feature Request: Improved logic for truncation of context

Open
#86 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.1k
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Would like to be able to configure these options or maybe have a different way to gauge the size of the context.

I see there's a commit to bump width to 30 (CI failed, maybe a release was intended?). Even then, 30 keys could be a totally reasonable context size.

## Ideas

- Make width and breadth configurable.
- Make this opt-in/out, perhaps depending on logger instance or log level or something.
- Use a more accurate measure of object size e.g. `JSON.stringify(data).length > maxCharCount`. I suppose that would require two stringifications. Could keep track of the size as you stringify, and only start truncating once you hit the limit. Not sure if there is any prior art here.

## Alternatives

The implementation of the serializer in roarr is conveniently very minimal and it's trivial to set your own.

I think it makes sense to have very conservative defaults and maybe even leave the max breadth at 10.

So all that said, I'm happy for this to be immediately closed, unless you think it's worth more discussion.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the current context-truncation logic and the serializer entry point referenced in the issue. Compare the proposed width/breadth configuration, opt-in behavior, and serialized-size measurement, then establish one agreed approach with conservative defaults and tests that verify truncation boundaries.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.