Repository navigation
feat(tools/discourse): add a read-only Discourse topic bridge - #14
Draft
MakerFlyFly wants to merge 5 commits into
Draft
MakerFlyFly wants to merge 5 commits into
MakerFlyFly wants to merge 5 commits into
Conversation
Projects discussing design and governance on Discourse need structured topic context alongside their existing mail and forge sources. Read a topic and its bounded post stream with a stdlib-only CLI. Return mail-archive-shaped thread data while declaring partial coverage, and fail explicitly on missing requested posts or malformed responses. Keep optional API credentials on the configured HTTPS origin and wire the package into the workspace, adapter inventory and specifications. Generated-by: Codex (GPT-6)
An HTTP error can arrive before its response body has been fully read. Keep the HTTP status in the CLI error channel when that body is cut off, instead of letting the error-reporting helper raise an unhandled exception. Generated-by: Codex (GPT-6)
Validate API header encoding before requesting and escape JSON for legacy stdout encodings. Reject empty base URL query and fragment markers. Bind GET requests and standard-library redirects to the configured forum origin and path, rejecting encoded traversal and other ambiguous paths. Report unsupported mega topics explicitly without returning partial data. Document unknown visibility, fail-closed reads and forum stream ordering. Keep the existing fields, partial archive coverage and read-only scope. Generated-by: Codex (GPT-6)
Decoded-only path checks can admit a different raw routing prefix. Require both raw and decoded forum boundaries, decode paths once and reject encoded separators or remaining percent escapes. Reject invalid base paths during configuration and require ASCII API usernames while retaining the API key's latin-1 encoding check. Exercise the real urllib redirect chain with fake HTTP transports and document the deliberate URL and authentication compatibility limits. Generated-by: Codex (GPT-6)
Require cooked bodies on every response post while preserving explicit empty strings. Expose the server's cooked_hidden marker as body_hidden without inferring original content or visibility. Stop after the first incomplete post batch, reject duplicate stream IDs and preserve participant order using set membership for deduplication. Reject raw non-ASCII or space-containing base paths during configuration and document post-count, response-size and total-duration boundaries. Keep the adapter-spec addition applicable to current upstream context. 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
magpie-discourse topic view <id|url> [--max-posts N], so projects can read forum discussions as structured thread/message data.contract:mail-archivewithCoverage: partial; the complete contract and additional commands remain follow-up work.Upstream submission
The first implementation is submitted as apache/magpie#1755, targeting upstream main.
This fork draft preserves the fixed audit baseline and review history.
The test results below describe that audit baseline; the upstream PR records validation on its newer baseline.
Type of change
tools/<system>/*.md)tools/*/withpyproject.toml)Test plan
body_hidden); ruff check, ruff format check and mypy pass. No package skips or live HTTP in tests.prek run --all-files --verbosepasses, including lychee and all four workspace hooks.body_hiddenflags andtruncated: true. No hidden-body positive case was observed live; those cases use mocked responses. No forum writes.hidden; stop at the first incomplete batch; reject duplicate stream IDs; and reject raw Unicode/space base paths before HTTP while preserving percent-encoded bases.RFC-AI-0004 compliance
Linked issues
Refs apache/magpie#307.
Refs MakerFlyFly/magpie#13 (fork audit).
Notes for reviewers
This draft targets the fork's fixed audit baseline at upstream commit
cb6bb8b8.It covers only topic viewing; no skill integration or complete/selectable mail-archive backend is claimed.
cookedbody, even outside the output cap. Explicit empty strings, whitespace and placeholders are preserved; missing/null/non-string bodies are response errors. An empty string only states what the API returned.body_hiddenrelays the server's optional booleancooked_hiddenmarker, defaulting to false. It is independent ofhidden; false proves neither original text nor public visibility. Staff may see a hidden post's content without a replacement marker.body_format: "html". JSON uses ASCII escapes; parsing restores the original Unicode.truncateddescribes only the configured post limit. A missing requested post fails immediately after its batch, before later batches; HTTP errors also fail the whole read. Concurrent deletion or batch rate limiting can therefore fail a read; no partial results or automatic retries are provided. Duplicate stream IDs are rejected.--max-postslimits post count, not response bytes or total command duration. Byte and whole-command budgets remain follow-up design work.post_stream.streamorder. Moved/imported posts can have older timestamps; chronological archive-contract ordering is not promised.%25) and nested escapes (%2541) are unsupported. Normal UTF-8 slugs and query parameters remain supported.At the latest publication check, GitHub reports no check runs or Actions runs for this head.
The results above are local validation; no cloud-CI success is claimed.
AI disclosure
AI-generated text for the fork audit record. The author has completed review of the implementation.
Claude Code assisted the initial local prototype.
Codex (GPT-6) assisted the revisions, regression tests and verification.