[PR #2469] [CLOSED] serve: reject array-root JSON instead of extracting a nested object #4055

Closed
opened 2026-11-07 15:32:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2469
Author: @bettercallcaleb
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: fix/structured-array-root-validation-20261014


📝 Commits (1)

  • 7883492 serve: reject array roots in structured JSON object responses

📊 Changes

2 files changed (+73 additions, -0 deletions)

View changed files

📝 serve/structured.py (+11 -0)
📝 serve/test_structured.py (+62 -0)

📄 Description

Title

Issue: Resolves #2467

Summary

With object-root structured output, [{"answer":1},{"answer":2}] currently succeeds as {"answer":1}, silently dropping the array and remaining elements.

What changed

  • serve/structured.py: Preserve a detected array root for existing object/schema validation instead of extracting a nested object. Keep prose and Markdown-fenced object extraction working.
  • serve/test_structured.py: Add HTTP, streaming, schema, nested-array and bracketed-prose regression cases.

Extra Notes

  • Validation on Ubuntu 24.04: 365 regression tests passed with one pre-existing sampler-thread test excluded; that failure was reproduced on unmodified upstream main. An additional 12 tests passed without optional jsonschema.
  • Differential checks: 25,000 valid object outputs unchanged; 25,000 array outputs rejected. /v1/responses tested in both streaming and non-streaming modes.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2469 **Author:** [@bettercallcaleb](https://github.com/bettercallcaleb) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/structured-array-root-validation-20261014` --- ### 📝 Commits (1) - [`7883492`](https://github.com/Niko1221/Strata/commit/7883492c3db47279f4a5e9502d62285585eaad71) serve: reject array roots in structured JSON object responses ### 📊 Changes **2 files changed** (+73 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `serve/structured.py` (+11 -0) 📝 `serve/test_structured.py` (+62 -0) </details> ### 📄 Description ## Title Issue: Resolves #2467 ## Summary With object-root structured output, `[{"answer":1},{"answer":2}]` currently succeeds as `{"answer":1}`, silently dropping the array and remaining elements. ## What changed - `serve/structured.py`: Preserve a detected array root for existing object/schema validation instead of extracting a nested object. Keep prose and Markdown-fenced object extraction working. - `serve/test_structured.py`: Add HTTP, streaming, schema, nested-array and bracketed-prose regression cases. ## Extra Notes - Validation on Ubuntu 24.04: 365 regression tests passed with one pre-existing sampler-thread test excluded; that failure was reproduced on unmodified upstream `main`. An additional 12 tests passed without optional `jsonschema`. - Differential checks: 25,000 valid object outputs unchanged; 25,000 array outputs rejected. `/v1/responses` tested in both streaming and non-streaming modes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:32:52 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4055
No description provided.