Skip to content

fix(compiler): reject duplicate limits and named entries - #45

Merged
haseebahmed248 merged 2 commits into
haseebahmed248:mainfrom
omergungor11:fix/reject-duplicate-entries
Sep 6, 2026
Merged

haseebahmed248 merged 2 commits into
haseebahmed248:mainfrom
omergungor11:fix/reject-duplicate-entries

Conversation

@omergungor11

@omergungor11 omergungor11 commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Repeated limit entries, named tool arguments and model context keys currently overwrite earlier values. For example, a second tool_calls <= 1 silently replaces an earlier zero-call limit. Reject the second occurrence at its name token before parsing or assigning the replacement value.

Related issue

Closes #38

Changes

  • Track names locally within each limits block, tool call and model context block.
  • Report GS1101 with the repeated key and its exact source range.
  • Add six independent diagnostic corpus fixtures: all four limits, a tool argument and a model context key. Each runs through the compiler API and CLI.
  • Verify that unique entries preserve values and source order, and names can recur in separate workflows and steps.
  • Document duplicate-entry behavior.

Validation

  • npm run check
  • npm run check:generated
  • npm test — 116 tests passed
  • Additional validation is described below.

Additional validation: npm run test:release (4 passed), npm run test:package. Tested on Node 22.22.3. The six new corpus fixtures produced 12 failing tests before the fix and all passed after it. No host effects or model providers were executed for these regressions.

Risk and compatibility

  • Security or permission effects: duplicate limits can no longer silently replace earlier declared budgets. No change to runtime capability enforcement.
  • Compatibility or breaking changes: previously accepted duplicate entries now fail compilation, even if the repeated values match. Unique entries, IR shape and generated contracts remain unchanged.

Checklist

  • This change is focused on one issue.
  • Behavioral changes include tests.
  • User-facing behavior and unsupported constructs are documented.
  • Generated files are current.
  • No credentials, private data, or unredacted model output are included.
  • Commits include the required DCO Signed-off-by line.

Updated against upstream main after #44 merged, preserving both comparison and duplicate-entry diagnostics and corpus fixtures. All validation above was rerun on the combined tree. Implementation and test preparation were assisted by OpenAI Codex; the validation commands above were run against this patch.

Signed-off-by: omergungor11 <omergungor99@gmail.com>
haseebahmed248
haseebahmed248 previously approved these changes Sep 6, 2026

@haseebahmed248 haseebahmed248 left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this covers #38 cleanly. The checks and all 77 tests pass; I also verified that identical duplicates are rejected and malformed replacement values cannot hide the duplicate error. CI is green.

One merge detail: this and #44 both add to docs/DIAGNOSTICS.md and fixtures/diagnostics/manifest.json. After #44 merges, please update this branch, keeping both sets of additions, and rerun the checks.

Signed-off-by: omergungor11 <omergungor99@gmail.com>
@haseebahmed248
haseebahmed248 merged commit bbad1e8 into haseebahmed248:main Sep 6, 2026
6 checks passed
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.

Reject duplicate limits, named tool arguments, and model context keys

2 participants