Repository navigation
feat(web): add web search through your own SearXNG - #2
Merged
Merged
Conversation
The tests ran under famstack's test environment with plain pytest, so each extension put famstack's `lib/` on `sys.path` and built a stack instance of its own. famstack now has a lane for them, `script/test extension <folder>`: its pytest configuration, its unit lane's rules, the extension's modules as `stacklets.<id>`, and an instance with the extension installed and up. `script/cibuild` runs each extension's tests through that lane. Hue's tests pass there unchanged.
The web extension runs SearXNG, a metasearch engine, in one container, so the public search engines see the Mac and not a family member's account. - `./stack web search "<query>"` lists the results with their links. - `./stack web ask "<question>"` answers from the top results with the stack's AI model, and lists the sources, also when the model cannot be reached. - `--json` gives an agent the answer alone; `--count` and `--sources` limit the results. Both commands do their work in core's bot runner, which reaches SearXNG by its address on the stack network (`SEARCH_URL`). The search page is on port 42100. The tests drive both commands as `./stack` runs them, against a made-up SearXNG answer and a stand-in model; `tests/live/` checks a running SearXNG and skips without one. It was the web stacklet of famstack's 0.5 integration branch, which never shipped in a release.
`docs/testing.md` says what the extension lane is, what a test drives and checks, how a command runs in a test, how to stand in for a service and for the model, how to test a module and the containers, what the fixtures give, and the pitfalls with what to do about each. The README and AGENTS.md point at it, and the rule for tests says how they run now.
famstack's own stacklets use the 42xxx ports, so an extension in that range could take a port a family's stack already uses. famstack keeps 42100 to 42199 for extensions (ADR-007). `script/check-manifests.py` reads an extension's `port`, its `[ports]` and the host port of each binding in its `docker-compose.yml`, and refuses one outside that range, and two extensions on one port. Web uses 42100; hue publishes none.
famstack's extension lane runs the tests in parallel, one worker for each core. The testing guide says so, and that `-n 0` runs them in one process, for example to debug a test.
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
webis a new extension../stack web search <query>asks the family's own SearXNG../stack web ask <question>answers from the search results with the stack's AI model, with sources. Both do their work in famstack's bot runner. It moves here from famstack in chore(web): move the web stacklet to the famstack-extensions catalog famstack#368 (move the web stacklet to the famstack-extensions catalog).script/test extension.docs/testing.mdexplains how to write these tests, and lists the pitfalls.script/check-manifests.pyrefuses a port outside that range, and two extensions on one port.CI fails until famstack-dev/famstack#367 (let an extension's command do its work in the bot runner) and #368 merge into
feature/0.5.0-beta.1. CI tests against that branch, and it still shipsweband has no extension lane yet. Re-run CI after both merge.Merge: rebase, after the two famstack PRs. Each commit stands alone.