Skip to content

feat(tools/discourse): add a read-only Discourse topic bridge - #1755

Open
MakerFlyFly wants to merge 1 commit into
apache:mainfrom
MakerFlyFly:feat/discourse-topic-view-upstream
Open

MakerFlyFly wants to merge 1 commit into
apache:mainfrom
MakerFlyFly:feat/discourse-topic-view-upstream

Conversation

@MakerFlyFly

Copy link
Copy Markdown
Contributor

Summary

  • Add the first implementation for #307: a stdlib-only, read-only magpie-discourse topic view <id|url> [--max-posts N] command for structured forum context.
  • Read the requested post stream in batches of at most 20, preserve HTML bodies and reply relationships, and fail explicitly on missing posts or malformed responses.
  • Include workspace, inventory and specification integration. Declare contract:mail-archive with Coverage: partial; this is not yet a complete/selectable archive backend.

Proposed delivery plan

We intend to deliver the broader issue as separate, independently useful PRs.
Each includes its implementation, tests and required documentation/integration.
The sequence and details remain open to maintainer feedback.

Step Capability
PR1 - this PR Read a topic and its posts
PR2 List recent topics in a category
PR3 Search forum topics
PR4 Read user profiles and recent activity
PR5 Reply after explicit user confirmation
PR6 Create a topic after explicit user confirmation
PR7 Complete the remaining mail-archive contract operations

Only PR1 is implemented here.
Skill integration, mega-topic pagination and response-byte/total-duration budgets remain follow-up design work.

Type of change

  • Tool / bridge
  • Python package
  • Documentation

Test plan

  • 213 mocked package tests; ruff check, ruff format check and mypy pass.
  • Repository integration: vendor-neutrality-score 42, skill-and-tool-validator 493, dev 277, spec-validator 87 and spec-inventory 31 pass; 930 total, no skips.
  • Full prek run --all-files --verbose, including offline lychee and all four workspace hooks: 40 hooks passed; 51 workspace members, 9,374 passed, 361 conditional skips, 4 deselected and 26 passing subtests.
  • Magpie final-commit checklist: A-E pass, 0 blocking and 0 advisory items.
  • Local zizmor 1.30.1 offline scan: no unsuppressed findings. API-dependent online audits were unavailable without a GitHub token and are not claimed as run.
  • Historical anonymous CLI smoke test, 2026-10-20: topic 183261, 3 GETs, 45 unique HTML posts, boolean body markers and truncated: true. No forum writes. The bridge files are unchanged from that verified version.
  • Conditional workspace skips and the absent optional Claude CLI are recorded separately; skipped checks are not counted as passes.
  • Upstream PR CI has not run before this PR is opened; local results do not establish cloud-CI success.

RFC-AI-0004 compliance

  • Sandbox: network reach declared; adopters allow their configured forum host.
  • Vendor neutrality: vendor-specific behavior stays in the partial adapter.
  • Write-access discipline: GET only, including redirects.
  • Privacy LLM: no model calls; callers establish visibility and apply existing privacy approval before sending content to a model.

Linked issues

Refs #307.
This first slice does not close the broader request.

Notes for reviewers

  • Every response post requires a string cooked body, including posts beyond the output cap. Explicit empty strings, whitespace and placeholders are preserved; missing/null/invalid bodies fail the whole read.
  • body_hidden relays the optional boolean cooked_hidden marker, defaulting to false. It is independent of hidden; false proves neither original text nor public visibility.
  • Missing requested posts fail immediately after their batch, without later requests, retries or partial success. Duplicate stream IDs are rejected. Self-consistent empty results remain valid.
  • Messages follow forum stream order, which can differ from chronological archive order. truncated means only the post-count limit; it is not a byte or total-time budget. Mega topics without an ordinary ID stream are explicitly unsupported.
  • Credentials stay within the configured HTTPS origin and forum path. API usernames must be ASCII; keys must encode as latin-1. Paths use one strict UTF-8 decode; encoded separators, remaining percent escapes and ambiguous paths are refused. Configured base paths must percent-encode Unicode and spaces.
  • The output does not classify visibility or prove content is public. No skills, sandbox configuration, existing version numbers or CHANGELOG are changed.

AI disclosure

AI-generated PR description.
Claude Code assisted the initial prototype; Codex (GPT-6) assisted revisions, tests, validation and PR preparation.
The author has reviewed the implementation and owns this contribution.

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. Preserve
rendered bodies and server body-replacement markers, and fail explicitly
on missing requested posts or malformed responses.

Keep optional API credentials within the configured HTTPS forum origin
and path. Wire the package into the workspace, adapter inventory and
specifications while declaring partial mail-archive coverage.

This is the first implementation slice. Additional read commands,
confirmed writes and the remaining archive verbs are follow-up work.

Generated-by: Codex (GPT-6)
@github-actions github-actions Bot added family:tools tools/* family:docs Docs, MISSION.md, READMEs family:ci .github workflows, prek, validators contract:mail-archive Tool capability: mailing-list / forum archive reads labels Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contract:mail-archive Tool capability: mailing-list / forum archive reads family:ci .github workflows, prek, validators family:docs Docs, MISSION.md, READMEs family:tools tools/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant