Repository navigation
feat(tools/discourse): bound read requests and response bodies - #32
Draft
MakerFlyFly wants to merge 3 commits into
Draft
MakerFlyFly wants to merge 3 commits into
MakerFlyFly wants to merge 3 commits into
Conversation
Topic and category reads can accumulate requests and response bodies even when their output counts are capped. Share a command-level allowance of 64 HTTP attempts and 32 MiB of consumed response bodies across discovery, pagination, post batches and redirects. Fail incomplete reads without successful JSON and preserve count-based truncation. Read success and error bodies in bounded chunks, close unused redirect bodies without draining them, and preserve urllib routing and credential boundaries. Keep the existing I/O timeout without claiming a total deadline. Refs: apache#307 Generated-by: Codex (GPT-6)
Once the topic stream is known, reject a minimum batch count that cannot fit the remaining request budget before fetching any missing posts. Keep runtime accounting for redirects and report list-specific count hints only for request-budget failures. Retain HTTP status codes when an error body exhausts the byte allowance, and refuse a new request after the byte allowance is spent. Require an explicit budget in the transport helper and document config lifetime, conditional capacities and the existing timeout boundary. Refs: apache#307 Generated-by: Codex (GPT-6)
4 tasks
Keep topic-library errors focused on max_posts and the request allowance. Add command-line count guidance only in the view/list CLI handlers for request-budget failures, without attaching hints to unrelated errors. Clarify since guidance, shared budget accounting and the stream-prefix condition in the capacity example. Preserve all budget limits and read semantics. Refs: apache#307 Generated-by: Codex (GPT-6)
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.
Summary
Type of change
Test plan
Candidate:
ae938cbec969c37e7bf6489f7672e0193b18ab2f, based ondbaa84f3e6c294be30c68cb2abba36c623d45d47.prek run --all-files --skip workspace-pytest: 42 Passed. Committed-diff pytest against the fixed base selects only Discourse and passes 427 cases.f8eb46e: one HTTPS GET to topic 183261, 104,226 consumed body bytes, one returned post andtruncated: true, with no writes; that result is not relabelled as a smoke test of the current head.RFC-AI-0004 compliance
Linked issues
Owner audit: MakerFlyFly/magpie#31.
Refs apache/magpie#307, following merged #1755 and #1841.
Notes for reviewers
audit/discourse-read-budget-base: three commits, eight files, +775/-27. The audit history is preserved.truncateddescribes only the output-count limit.dataclasses.replacewithout a new budget, share its mutable allowance; independent operations require a fresh config.AI disclosure
AI-generated PR description. Codex (GPT-6) assisted implementation, review-response analysis, tests, validation and preparation. Owner review of the updated candidate is pending; this remains a Draft for human audit.