Skip to content

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

Merged
potiuk merged 2 commits into
apache:mainfrom
MakerFlyFly:feat/discourse-topic-search-upstream
Nov 9, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
MakerFlyFly:feat/discourse-topic-search-upstream

Conversation

@MakerFlyFly

@MakerFlyFly MakerFlyFly commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add magpie-discourse topic search <query> [--limit N] so callers can discover relevant forum discussions and open them with topic view. The forum receives the original query, including native filters and ordering.
  • Return distinct topics in first-hit order with excerpts and direct post links. Discourse usually selects a representative post for each topic. matches contains the distinct posts returned on the pages read, so its length cannot establish a total hit or contribution count.
  • Report a proven extra topic with truncated and Discourse's ten-page window with the independent server_limit_reached flag. Valid empty searches succeed. An explicit null group on page 1 gives a keyword hint, while a null later page identifies the failed page. Read failures produce no partial JSON.

Type of change

  • Tool / bridge
  • Python package
  • Documentation

Test plan

Current head bc5dd1bce83c298381515d019f2c0704e772dc68 is one commit on b6ccd434a54bdd4761fb487d7b55aaa8bd89dbc0. Its complete Git tree and canonical patch are identical to the prior publication 89d47d81d9edbe4f4adb28abb4eeaf71e639ee9a.

  • On the new SHA, all 43 non-pytest hooks pass, including the workspace static checks. Committed-diff pytest selects Discourse and passes all 410 tests, including 40 search cases. The optional native Claude check skips internally because its CLI is absent.
  • Magpie pre-first-PR A–E passes over the complete one-commit diff, with 0 blocking and 0 advisory items. The parent is the publication base and the new commit reconstructs the same nine-file, +534/−11 change.
  • Same-tree verification previously run on 89d47d81 includes 410 package tests on each of Linux/Python 3.12 and Windows/Python 3.14, ruff, format, mypy and five integration suites (vendor-neutrality-score, skill-and-tool-validator, dev, spec-validator and spec-inventory). These results retain their original SHA.
  • Apache RAT 0.18 passed locally on the same tree using the workflow's pinned SHA-512 and scan arguments, with no unapproved licences.
  • Historical anonymous validation on audited 86811931 exercised a filter-only query and a normal two-topic search in two GETs. Publication README rendering and links were checked on the identical 89d47d81 file content. Owner audit

RFC-AI-0004 compliance

  • Sandbox — use the existing configured HTTPS origin and forum-path checks, including on redirects.
  • Vendor neutrality — retain partial coverage of the mail-archive contract and keep Discourse behavior in its adapter.
  • Write-access discipline — search uses GET, and automated HTTP tests use simulated transport.
  • Privacy LLM — return forum data to the caller, which establishes visibility and approval before model use.

Linked issues

Refs #307, following merged #1755 and #1841. Owner audit is recorded in fork PR #34 and fork issue #33.

Notes for reviewers

AI disclosure

AI-generated PR description. OpenAI Codex CLI 0.166.0-alpha.5.1 (GPT-6) assisted with implementation, tests, review follow-up and publication.
The author has manually reviewed the complete change through audited 868119319e05a0e213b613af76d4ca8e0c1eaa24 and takes responsibility for this contribution. The published change is equivalent to the reviewed changes, with the existing publication tree preserved through the squash.

@github-actions github-actions Bot added family:tools tools/* family:docs Docs, MISSION.md, READMEs contract:mail-archive Tool capability: mailing-list / forum archive reads family:dev Repo dev: .asf.yaml, spec-loop specs, Node manifests, .claude/settings.json labels Nov 6, 2026
Let callers find relevant forum discussions using native queries and
follow the matching posts. Preserve forum ranking, deduplicate topics
and distinguish output truncation from the server's search window.

Generated-by: OpenAI Codex CLI 0.166.0-alpha.5.1 (GPT-6)
@MakerFlyFly
MakerFlyFly force-pushed the feat/discourse-topic-search-upstream branch from 89d47d8 to bc5dd1b Compare November 6, 2026 12:35

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The search command is carefully validated and well tested; the open question is process rather than code — this lands search ahead of the resource-budget design that #1841 recorded as its precondition, so that waiver should be made explicit — plus a fork link to replace and a rate-limit edge in the default lookahead.

GitHub has not yet computed whether this branch merges cleanly with its base.

Resource-budget design before search development (tools/discourse/README.md:248)

  • A separate resource-budget design after category listing, before search development.
-- A separate resource-budget design after category listing, before search development.
+Discourse caps each search at ten result pages. Command-wide read limits remain a separate follow-up.  # ←

The README merged in #1841 recorded an agreed order: the resource-budget design lands before search. This PR ships search first and replaces that bullet with the argument that Discourse's ten-page server cap is enough. That may well be true, since search is bounded to at most ten pages, but it reverses a recorded precondition without saying so, and the budget design itself still lives only on the contributor fork. Say explicitly in the PR description that the budget-before-search precondition is being waived, and why the ten-page cap is sufficient, so the decision is on record upstream. Otherwise, land the budget design upstream first.

Smaller observations

  • See inline comments on tools/discourse/README.md:250, tools/discourse/src/magpie_discourse/search.py:91, tools/discourse/README.md:205.

This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The findings
below are observations, not blockers; an Apache Magpie
maintainer — a real person — will take the next look at the
PR. If you think a finding is mis-applied, please reply on
the PR and a maintainer will weigh in.

More on how Apache Magpie handles maintainer review:
Contributing guide.

Comment thread tools/discourse/README.md Resolved
Comment thread tools/discourse/README.md Resolved
Comment thread tools/discourse/README.md Resolved
- README: the command-wide read-limit follow-up is tracked in apache#307
  rather than linked to an issue on a personal fork.
- README and adapters spec: split the new lines that held two
  sentences.

Generated-by: Claude Opus 5

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving: Discourse's ten-page server cap bounds every search, so I'm waiving the budget-design-before-search order recorded in #1841 for this command — the command-wide read budget stays a follow-up under #307. To save another round, I pushed a fixup in 0836b5f:

  • tools/discourse/README.md: the read-limit follow-up now points at #307 instead of an issue on the contributor fork.
  • tools/discourse/README.md and tools/spec-loop/specs/adapters.md: the new lines that held two sentences are split one sentence per line.

On the rate-limit point from my earlier review: the README already documents the two-per-second limit and that a 429 ends the command without a retry, so that stands as designed. Thanks for the careful validation and tests!


This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Magpie handles maintainer review:
Contributing guide.

@potiuk
potiuk merged commit 76cc99b into apache:main Nov 9, 2026
10 checks passed
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:dev Repo dev: .asf.yaml, spec-loop specs, Node manifests, .claude/settings.json family:docs Docs, MISSION.md, READMEs family:tools tools/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants