Repository navigation
[PRO-2899] feat(faq): sync website-faq knowledge base from docs, site, and Q&A - #323
Conversation
Add an automated sync that keeps the website-faq HydraDB database up to date (step 9 of PRO-2776, follow-up to hydradb-application #2368). Sources, one knowledge_base app source per page: - Docs: the v2 Guides tab pages in docs.json (24 pages). url = https://docs.hydradb.com/<path>; title from MDX frontmatter, body from the rendered page. - Website: hydradb.com/, /ai, /contact, /alternatives, every /alternatives/* page (discovered via sitemap.xml), and /privacy-policy. /blog/* and /terms-of-service are never ingested. - faq/qa.yaml: hand-written Q&A list (question, answer, optional url). Ships empty with format docs; no invented answers. Ingest via POST /context/ingest (multipart: database, type=knowledge, upsert=true, app_knowledge=JSON array). Each item carries its own url so the FAQ box can show source links. After ingest, /context/list + DELETE /context remove any source no longer in the set. The GitHub Actions workflow (.github/workflows/sync-faq.yml) is added in a follow-up commit; it runs the script on push to main when Guides pages, docs.json or faq/ change, weekly for website changes, and on workflow_dispatch. Config: HYDRADB_FAQ_API_KEY secret and HYDRADB_FAQ_DATABASE repo variable (default website-faq). Missing secret -> skip with a notice instead of failing. Linear: PRO-2899 (follow-up to PRO-2776) Signed-off-by: Vyom Goyal <vyom@hydradb.com> Co-authored-by: Vyom Goyal <vyom@hydradb.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
✅ Mintlify HygieneNo issues found. |
✅ OpenHack SummarySecurity review of [PRO-2899] feat(faq): sync website-faq knowledge base from docs, site, and Q&A. 5 changed files; 0 findings at or above the low reporting threshold. Confidence Score: 5/5No reportable security findings were detected in this scan. Security merge-readiness rubric: 1 = critical, 2 = high, 3 = medium, 4 = low, 5 = no reportable findings. This score reflects scan findings, not a guarantee of correctness or complete coverage. Files Needing Attention: None Important Files Changed
Last reviewed commit: 8c316d2 · View review on OpenHack
|
[Medium impact] The sync affects the bounded knowledge database used by the public website FAQ. The database-setting issue still needs to be fixed before merging. Findings
SummaryAdds a scheduled FAQ sync for Guides, selected website pages, and reviewed Q&A.
|
…ased qa ids 1. Docs bodies are read from the repo's MDX files, not docs.hydradb.com. The site hasn't redeployed yet when a push to main triggers the sync, so fetching the rendered page would ingest stale content. The url field still points to docs.hydradb.com for the source link shown in the FAQ. 2. If any page or the sitemap fails to fetch, the run exits non-zero without ingesting or deleting anything. make_item refuses to build an item with an empty body, so a failed page is never upserted with empty content and never treated as removed. 3. faq/qa.yaml item ids are derived from the question text (slugified, with a short sha1 hash suffix for uniqueness), not the entry position. Collisions within the same file are skipped with a warning. 4. Default database name changed from website-faq to website-faqs. Linear: PRO-2899 Signed-off-by: Vyom Goyal <vyom@hydradb.com> Co-authored-by: Vyom Goyal <vyom@hydradb.com>
Runs scripts/sync_faq.py on pushes to main that touch the Guides pages, docs.json or faq/, weekly for website changes, and on demand. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Vyom Goyal <vyom@hydradb.com>
- Write to the database's default collection, the one POST /faq/ask reads; a collection literally named "default" is a different one. - HYDRADB_FAQ_DATABASE is required: no guessed default database name. - Every input read raises (sitemap fallback, faq/qa.yaml, PyYAML, a bad or duplicate entry), so cleanup only runs on a complete set, and it deletes only ids this sync owns (docs-, site-, qa-). - Fail on per-item ingest errors, then wait for every item to index and fail on any errored item before anything is deleted. - MDX: keep the text in component attributes (Field name/type, titles) and keep fenced code verbatim. - HTML: void elements no longer swallow the rest of the page, and <main> / <article> are tracked by the parser instead of a regex slice. - Tests for each, run in CI. The sync workflow gets a concurrency group and a 30-minute timeout. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Vyom Goyal <vyom@hydradb.com>
Summary
Keeps the website FAQ's HydraDB database up to date, so the FAQ box on hydradb.com (
POST /faq/ask, hydradb-application #2368) answers from current docs and site pages. Tracked as PRO-2899, a follow-up to PRO-2776.What it syncs (one
knowledge_baseapp source per page)docs.json.Fieldname/type,Tab/Step/Accordion/Cardtitles).url = https://docs.hydradb.com/<page path>.hydradb.com/,/ai,/contact,/alternatives, every/alternatives/*page (fromsitemap.xml), and/privacy-policy.<main>, then<article>, then the page./blog/*and/terms-of-serviceare never ingested.faq/qa.yaml: a hand-written Q&A list. It ships empty. Ids come from the question text, not its position.How it runs
docs.json,faq/qa.yaml, PyYAML, a bad or duplicate Q&A entry, or an empty body. A failed read is never treated as a removed page.POST /context/ingest(upsert=true) into the database's default collection, the one/faq/asksearches. Any per-item error fails the run.completed(GET /context/status). Anyerroreditem, or 20 minutes without finishing, fails the run, so the old content stays.POST /context/list,DELETE /context). Only ids this sync owns (docs-,site-,qa-) are ever deleted.When it runs (
.github/workflows/sync-faq.yml)mainthat touches the Guides pages,docs.json,faq/or the sync itselfworkflow_dispatchOne run at a time (concurrency group), with a 30-minute timeout.
Config (already set on this repo)
HYDRADB_FAQ_API_KEY: a Read & write key for the FAQ database. Without it, the run skips with a notice and exits 0.HYDRADB_FAQ_DATABASE=website-faqs. Required, with no default; it must matchFAQ_DATABASEin hydradb-application.Testing
scripts/test_sync_faq.py(unittest, run in CI by the newfaq-sync-testsjob) covers:<main>preferenceerroreditemSeven of the nine fail on the previous version of the script.
Dry run:
HYDRADB_FAQ_DATABASE=website-faqs python scripts/sync_faq.py --dry-rungives 42 items (24 docs, 18 site).Full run against a local HydraDB stack:
errored, and the run stopped with exit 1 and deleted nothing.list_existing_ids+delete_idsagainst the same stack removed a planted stalesite-source and left an unrelated source alone.Files
scripts/sync_faq.py: the sync (stdlib, plus PyYAML forfaq/qa.yaml)scripts/test_sync_faq.py: testsfaq/qa.yaml: the Q&A list, empty.github/workflows/sync-faq.yml: the sync workflow.github/workflows/ci.yml: adds thefaq-sync-testsjobCloses PRO-2899. Pairs with hydradb-application #2368.
Open-Inspect session: https://open-inspect.hydradb.com/session/92fe275c740e14574aa75f4dc78331d0