Skip to content

feat(tools/discourse): search forum topics by full text - #34

Draft
MakerFlyFly wants to merge 3 commits into
audit/discourse-topic-search-basefrom
feat/discourse-topic-search
Draft

MakerFlyFly wants to merge 3 commits into
audit/discourse-topic-search-basefrom
feat/discourse-topic-search

Conversation

@MakerFlyFly

@MakerFlyFly MakerFlyFly commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Upstream submission

Owner review of audited 868119319e05a0e213b613af76d4ca8e0c1eaa24 is complete. apache/magpie#2018 is Ready for review at bc5dd1bce83c298381515d019f2c0704e772dc68, a single commit on b6ccd434a54bdd4761fb487d7b55aaa8bd89dbc0.

The publication was consolidated from three commits to one. Its entire Git tree and canonical patch are identical to the previous publication 89d47d81d9edbe4f4adb28abb4eeaf71e639ee9a. The original audit candidate and its historical verification remain recorded below. The upstream PR tracks the new SHA's CI results and maintainer review.

Summary

  • Add magpie-discourse topic search <query> [--limit N] to discover relevant discussions and open their posts. The configured forum receives the original query, including native filters and ordering. For a leading dash, use topic search --limit 5 -- '-tags:foo'.
  • Preserve first-hit topic order and group the distinct posts returned on the fetched pages. Ordinary Discourse searches usually select one representative post per topic. A query such as in:all-posts can yield several. The length of matches cannot establish a total hit count or a contributor's activity. Use the topic permalink with topic view for the full discussion.
  • Report a proven extra topic with truncated and a continuing tenth page with server_limit_reached. A valid empty search returns an empty list. On an explicit null group, page 1 suggests adding a keyword or using a longer one. A later page reports its number. Failed reads exit 1 with empty stdout.

Type of change

  • Tool / bridge
  • Python package
  • Documentation

Test plan

Current candidate 86811931, fixed audit base c748ccd35bbdf4280a55c6ad95517a2f3b4188dd. The audit range includes the original search implementation and both review follow-ups.

  • The upstream base rejected the missing search action with exit 2. On 5a13977d, all three closeout diagnostic assertions failed as expected. On the current head both first-page cases (a b c, in:title) give the revised hint, and a null lookahead page reports page 2 with empty stdout.
  • On the current head all 410 package tests passed on Linux and Windows, including 40 search cases. Ruff, format and mypy passed on both systems. Tests cover representative hits and overlapping pages, exact limits and the independent tenth-page flags, valid empty results, explicit null, missing/malformed groups, a one-character query, a leading negative filter and a 429 on page 3 of a default-limit read.
  • Five integration suites passed on Linux: vendor-neutrality-score 42, skill-and-tool-validator 504, dev 413, spec-validator 114 and spec-inventory 32.
  • All 43 non-pytest hooks passed. The committed-diff pytest hook selected Discourse and passed 410 tests. The optional native Claude check skipped internally because the CLI was absent. Full-workspace pytest was outside the local check selection.
  • Magpie pre-first-PR A–E passed over all three commits and nine files, with 0 blocking and 0 advisory items. The full and incremental patches each reconstruct the audited tree from their respective bases.
  • Two anonymous HTTPS GETs verified the installed CLI. in:title exited 1 with the new keyword hint and empty stdout. notifications --limit 2 returned two topics with truncated=true and server_limit_reached=false. A null later page and rate limiting were exercised offline. Example result
  • Verified all 19 distinct README link targets, including heading anchors and the pinned rate-setting lines. The GitHub-rendered README presents both the rate settings and the separate budget references in complete sentences.

RFC-AI-0004 compliance

  • Sandbox — the shared client enforces the configured HTTPS origin and forum path, including on redirects.
  • Vendor neutrality — the Discourse adapter retains partial mail-archive coverage.
  • Write-access discipline — searches use GET and the automated tests use offline transport.
  • Privacy LLM — authors and excerpts are forum data. The caller establishes visibility and model-use approval.

Linked issues

Owner audit #33. Refs apache/magpie#307, following the merged topic read and category list.

Notes for reviewers

  • The category-list PR called for a separate command-wide budget design before search development. That design and its candidate implementation were published on October 31, before this search branch. The candidate remains under separate fork review. Merged sequencing decision · Budget audit #31 · Budget Draft PR #32
  • Search reads at most ten result pages. With the upstream page-size default of 50, that window contains at most 500 returned hits. Page size is configurable, and redirects can add physical GETs. If two pages yield 100 distinct topics and the second signals more, the default limit of 100 needs a third page for lookahead. Rankings may shift between reads, and deduplication cannot recover skipped hits.
  • Discourse can discard short unquoted terms and still return a result group when other terms, filters or sorting apply. The bridge forwards the query unchanged and diagnoses the actual response on the page being read. Native search tests
  • The closeout touches three files (+25/−9). The complete PR totals nine files (+534/−11). The patch applies cleanly and a static merge is clean against Apache main f5c410c4. The reported test runs used the fixed audit candidate.

AI disclosure

AI-generated PR description. OpenAI Codex CLI 0.166.0-alpha.5.1 (GPT-6) assisted with implementation, review follow-up, tests and verification. Owner review of the audited change is complete. Upstream maintainer review is pending.

Let callers discover relevant discussions with Discourse's native query
syntax and open the matching posts. Preserve ranked hits and distinguish
an observed extra topic from reaching the forum's search window.

Generated-by: OpenAI Codex CLI 0.166.0-alpha.5.1 (GPT-6)
@github-actions github-actions Bot added family:docs family:tools contract:mail-archive Public mailing-list and forum archive reads labels Nov 4, 2026
Report an actionable query error when Discourse returns a null search
group. Preserve malformed-response errors and successful empty searches.
Document representative posts, pagination costs and native filters so
callers can interpret matches and choose an appropriate query.

Generated-by: OpenAI Codex CLI 0.166.0-alpha.5.1 (GPT-6)
Suggest a keyword when the forum cannot evaluate the first search page.
If a later page has no result group, identify that page so callers can
distinguish the failed read from an unusable query. Document the forum's
term filtering and the scope of its ten-page search window.

Generated-by: OpenAI Codex CLI 0.166.0-alpha.5.1 (GPT-6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contract:mail-archive Public mailing-list and forum archive reads family:docs family:tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant