Repository navigation
feat(tools/discourse): search forum topics by full text - #2018
Conversation
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)
89d47d8 to
bc5dd1b
Compare
potiuk
left a comment
There was a problem hiding this comment.
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.
- 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
left a comment
There was a problem hiding this comment.
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.mdandtools/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.
Summary
magpie-discourse topic search <query> [--limit N]so callers can discover relevant forum discussions and open them withtopic view. The forum receives the original query, including native filters and ordering.matchescontains the distinct posts returned on the pages read, so its length cannot establish a total hit or contribution count.truncatedand Discourse's ten-page window with the independentserver_limit_reachedflag. 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
Test plan
Current head
bc5dd1bce83c298381515d019f2c0704e772dc68is one commit onb6ccd434a54bdd4761fb487d7b55aaa8bd89dbc0. Its complete Git tree and canonical patch are identical to the prior publication89d47d81d9edbe4f4adb28abb4eeaf71e639ee9a.89d47d81includes 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.86811931exercised a filter-only query and a normal two-topic search in two GETs. Publication README rendering and links were checked on the identical89d47d81file content. Owner auditRFC-AI-0004 compliance
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
868119319e05a0e213b613af76d4ca8e0c1eaa24and takes responsibility for this contribution. The published change is equivalent to the reviewed changes, with the existing publication tree preserved through the squash.