Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
defaultsmodule to avoid drift and make configuration consistent across modules.Content-Lengthis missing or unreliable by enforcing a streaming-aware body size limit.Description
hyperquant/defaults.pyand replace hard-coded default values with named constants acrossapi.models,cli,context_codec,resident_tier, andvector_codecto centralize configuration defaults using symbols likeVECTOR_BITS_DEFAULTandCONTEXT_PAGE_SIZE_DEFAULT._BodySizeLimitMiddlewareinhyperquant/api/app.pyand register it on the FastAPI app to enforcemax_http_body_bytesduring streaming requests, includingContent-Lengthchecks and draining the request stream when rejecting with413.HTTP 400with a uniforminternal_server_errorhelper that returnsHTTP 500and keep metrics instrumentation for internal errors.context-decompress-filesubcommand and wire defaults into the argument definitions.tests/array_builders.py, addtests/test_cli.py, expandtests/test_api.pywith tests for 500 responses and streaming oversize rejection, and updatetests/test_context_codec.pyandtests/test_resident_tier.pyto use shared builders and to cover planner error propagation.Testing
pytestincluding new teststests/test_api.py::test_api_returns_500_for_internal_worker_errorandtests/test_api.py::test_api_rejects_oversized_body_without_reliable_content_length, and all executed tests passed.tests/test_cli.py::test_context_decompress_file_help_has_only_decode_inputswhich passed.tests/test_context_codec.py::test_context_roundtrip_and_ratioandtests/test_resident_tier.pyscenarios covering error propagation and qualification, which passed.Codex Task