Skip to content

Fix/overflow policy validation - #260

Open
RoopakBRK wants to merge 4 commits into
superlinked:mainfrom
RoopakBRK:fix/overflow-policy-validation
Open

RoopakBRK wants to merge 4 commits into
superlinked:mainfrom
RoopakBRK:fix/overflow-policy-validation

Conversation

@RoopakBRK

@RoopakBRK RoopakBRK commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fixes

File path Changed -> packages/sie_server/src/sie_server/api/options.py

I fixed an issue with overflow_policy validation.
If an invalid type such as a list or dictionary was passed as overflow_policy, the server could raise a TypeError while checking the value against the allowed policies. This resulted in a 500 error even though the problem was with the request itself.

The validation now checks that overflow_policy is a string before checking whether it is one of the supported values.

For example, passing:

{
  "overflow_policy": ["truncate_text"]
}

will now be handled as an invalid request and return the existing 400 INVALID_INPUT response instead of causing a 500 error.

Valid overflow_policy values continue to behave exactly as before. No inference behaviour was changed.

Testing

mise run test
mise run lint
mise run typecheck
git diff --check

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation for overflow policy settings by rejecting non-text values and preserving validation for supported options.
    • Invalid overflow policy input now returns a clear HTTP 400 error instead of being processed as a valid configuration.
    • Existing supported overflow policy values continue to work as expected.

@RoopakBRK
RoopakBRK requested a review from a team as a code owner September 8, 2026 06:14
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: aaab8e21-a0d7-4216-9abb-1668b55efd5c

📥 Commits

Reviewing files that changed from the base of the PR and between 4917b08 and 43d39d9.

📒 Files selected for processing (1)
  • packages/sie_server/tests/api/test_option.py

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change updates overflow_policy validation to reject non-string values before checking recognized policies. Tests verify that invalid list input produces an HTTP 400 INVALID_INPUT error.

Changes

Overflow policy validation

Layer / File(s) Summary
Validate overflow policy values
packages/sie_server/src/sie_server/api/options.py, packages/sie_server/tests/api/test_option.py
overflow_policy validation now requires a string and a recognized overflow policy. Tests cover invalid list input and the resulting INVALID_INPUT response.

Suggested reviewers: krisztian-gajdar

Priority: ⬇️ Low — Defer the overflow policy validation fix because it is a narrow API input-handling change that prevents malformed values from causing 500 errors.

Merge Risk: ⚪ Minimal · up to 43d39

The update rejects non-string overflow policies with the existing invalid-input response while preserving valid policy behavior. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: fixing overflow policy validation. It is concise and directly related to the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 8, 2026

overflow_policy = merged.get("overflow_policy")
if overflow_policy is not None and overflow_policy not in VALID_OVERFLOW_POLICIES:
if overflow_policy is not None and (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you add a test? Nothing in the suite currently touches this validation branch at all. No test references invalid_overflow_policy. so right now nothing proves the fix works and nothing stops it coming back. A single case asserting {"overflow_policy": ["truncate_text"]} returns 400 would cover it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

okay will be done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a test covering the invalid overflow_policy type case. It verifies that passing a list returns the expected 400 INVALID_INPUT response.

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.

2 participants