Skip to content

[PRO-2899] feat(faq): sync website-faq knowledge base from docs, site, and Q&A - #323

Merged
SohamRatnaparkhi merged 4 commits into
mainfrom
feat/faq-sync
Oct 19, 2026
Merged

SohamRatnaparkhi merged 4 commits into
mainfrom
feat/faq-sync

Conversation

@open-inspect-hydra

@open-inspect-hydra open-inspect-hydra Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

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_base app source per page)

  • Docs: the v2 "Guides" tab pages listed in docs.json.
    • The body comes from the repo's MDX: fenced code is kept verbatim, and component attribute text is kept (Field name/type, Tab/Step/Accordion/Card titles).
    • url = https://docs.hydradb.com/<page path>.
  • Website: hydradb.com/, /ai, /contact, /alternatives, every /alternatives/* page (from sitemap.xml), and /privacy-policy.
    • Readable text comes from an HTML parser that prefers <main>, then <article>, then the page.
    • /blog/* and /terms-of-service are 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

  1. Build the full set. Any input that can't be read stops the run with a non-zero exit, before anything is ingested or deleted: a page, the sitemap, 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.
  2. Ingest with POST /context/ingest (upsert=true) into the database's default collection, the one /faq/ask searches. Any per-item error fails the run.
  3. Wait until every item is completed (GET /context/status). Any errored item, or 20 minutes without finishing, fails the run, so the old content stays.
  4. Delete sources no longer in the set (POST /context/list, DELETE /context). Only ids this sync owns (docs-, site-, qa-) are ever deleted.

When it runs (.github/workflows/sync-faq.yml)

  • On a push to main that touches the Guides pages, docs.json, faq/ or the sync itself
  • Weekly, Monday 06:00 UTC, for website changes
  • Manually, with workflow_dispatch

One run at a time (concurrency group), with a 30-minute timeout.

Config (already set on this repo)

  • Secret HYDRADB_FAQ_API_KEY: a Read & write key for the FAQ database. Without it, the run skips with a notice and exits 0.
  • Variable HYDRADB_FAQ_DATABASE = website-faqs. Required, with no default; it must match FAQ_DATABASE in hydradb-application.

Testing

  • scripts/test_sync_faq.py (unittest, run in CI by the new faq-sync-tests job) covers:

    • void elements, nested wrappers and <main> preference
    • component attribute text and imports inside code
    • Q&A ids and a missing Q&A file
    • waiting for indexing and failing on an errored item

    Seven of the nine fail on the previous version of the script.

  • Dry run: HYDRADB_FAQ_DATABASE=website-faqs python scripts/sync_faq.py --dry-run gives 42 items (24 docs, 18 site).

  • Full run against a local HydraDB stack:

    • 42 items ingested. Items that hit the local stack's invalid provider key ended errored, and the run stopped with exit 1 and deleted nothing.
    • Separately, list_existing_ids + delete_ids against the same stack removed a planted stale site- source and left an unrelated source alone.

Files

  • scripts/sync_faq.py: the sync (stdlib, plus PyYAML for faq/qa.yaml)
  • scripts/test_sync_faq.py: tests
  • faq/qa.yaml: the Q&A list, empty
  • .github/workflows/sync-faq.yml: the sync workflow
  • .github/workflows/ci.yml: adds the faq-sync-tests job

Closes PRO-2899. Pairs with hydradb-application #2368.

Open-Inspect session: https://open-inspect.hydradb.com/session/92fe275c740e14574aa75f4dc78331d0

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>
@mintlify

mintlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
cortex-ai 🟢 Ready View Preview Oct 19, 2026, 8:22 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@github-actions

Copy link
Copy Markdown

✅ Mintlify Hygiene

No issues found.

@openhack-agent

openhack-agent Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ OpenHack Summary

Security 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.

P1: Critical 0   P2: High 0   P3: Medium 0   P4: Low 0

Confidence Score: 5/5

No 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
  • .github/workflows/ci.yml (modified)
  • .github/workflows/sync-faq.yml (added)
  • faq/qa.yaml (added)
  • scripts/sync_faq.py (added)
  • scripts/test_sync_faq.py (added)

Last reviewed commit: 8c316d2 · View review on OpenHack


TIP: Mention @openhack-agent in a PR comment to request a review or ask a question. Use @openhack-agent fix all for every finding, or @openhack-agent fix unresolved threads for open review threads only.

@openhack-agent openhack-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

OpenHack reviewed this commit. See the OpenHack Summary for the confidence score and fix actions.

@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[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

  1. P1 Sync targets the wrong database ▶

Summary

Adds a scheduled FAQ sync for Guides, selected website pages, and reviewed Q&A.

  • The FAQ source set includes current guide pages, selected website pages, and reviewed answers.
  • The FAQ database refreshes on relevant changes, on a weekly schedule, or on demand.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Push, weekly schedule, or manual run] --> B{API key present?}
    B -- No --> C[Skip with notice]
    B -- Yes --> D[Check database setting]
    D --> E[Read Guides, website pages, and Q&A]
    E --> F[Upsert items]
    F --> G[Wait for indexing]
    G --> H[Delete stale owned sources]
    E -- Read failure --> I[Fail without writing]
    G -- Error or timeout --> J[Fail without cleanup]
Loading

Reviews (3) · Last reviewed commit: "fix(faq): address review findings on the..." · Reviewed by Greptile

Comment thread scripts/sync_faq.py Outdated
Comment thread scripts/sync_faq.py Outdated
Comment thread scripts/sync_faq.py
Comment thread scripts/sync_faq.py Outdated
Comment thread scripts/sync_faq.py Outdated
…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>
Comment thread scripts/sync_faq.py Outdated
Comment thread scripts/sync_faq.py Outdated
Comment thread scripts/sync_faq.py Outdated
vyomgoyal and others added 2 commits October 19, 2026 13:34
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>
@SohamRatnaparkhi
SohamRatnaparkhi merged commit 3ad9bf5 into main Oct 19, 2026
12 checks passed
@SohamRatnaparkhi
SohamRatnaparkhi deleted the feat/faq-sync branch October 19, 2026 10:34

This branch was successfully deployed

1 active deployment
staging — 8c316d27 Deployed Oct 19, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants