cloudwego / cloudwego/eino-ext

devops: graph limit accepts a 101st root graph

Open Beginner friendly
#960 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
811
Forks
368
Avg merge
16h 22m
Merged PRs (30d)
13

Description

## Description

`AddGraphInfo` checks `s.totalGraphNum > maxGraphNum` before incrementing the counter. With `maxGraphNum` set to 100, calls 1 through 101 therefore succeed, and the error is returned only for call 102.

## Reproduction

On current `main` (`6752ff8da9b1ea85c8e91b27b0a64fef099f22f9`):

1. Create a fresh container service.
2. Call `AddGraphInfo` 100 times with non-nil empty graph info; all calls succeed.
3. Call it a 101st time.

The 101st call succeeds and `totalGraphNum` becomes 101, despite the error text advertising `max=100`.

## Expected behavior

The 101st root graph should be rejected, leaving the counter and container unchanged at 100 root graphs.

## Suggested fix

Use `>=` for the pre-increment limit check and add a boundary regression test covering calls 100 and 101.

Contributor guide

Open the contributing guide

Research direction

Start by locating AddGraphInfo and its pre-increment maxGraphNum check on current main at commit 6752ff8da9b1ea85c8e91b27b0a64fef099f22f. Run or add a boundary regression test covering calls 100 and 101; done means the 100th call succeeds, the 101st is rejected, and the counter and container remain unchanged at 100.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.