Skip to content

OSS-119 ci(docs): test docs code samples against the latest SDKs, with a printed known-failure list - #409

Open
adityamishra-hydradb wants to merge 4 commits into
mainfrom
adityamishra/oss-119-docs-code-check
Open

adityamishra-hydradb wants to merge 4 commits into
mainfrom
adityamishra/oss-119-docs-code-check

Conversation

@adityamishra-hydradb

@adityamishra-hydradb adityamishra-hydradb commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

For humans

The docs repo already tests its code samples (scripts/test_docs_examples.py, scripts/test_cookbooks.py, CI job validate). The check was not trustworthy:

  1. It tested hydradb-sdk 2.1.7 and @hydradb/sdk 2.1.8. Users install 2.1.8 and 2.1.9. So it passed samples that break for users.
  2. It was red on main for 6 runs (until PR 400 merged on 12-04), so a new failure was not visible.
  3. Nothing told anyone when a new SDK came out.

This PR:

  • Tests the latest SDKs. hydradb-sdk 2.1.8, @hydradb/sdk 2.1.9.
  • Keeps the pins current. Dependabot opens a bump PR for each SDK every day. A new daily workflow, SDK drift, fails while a pin is older than the latest release, and runs the samples against the latest SDKs.
  • Keeps the open decision visible. On the latest SDKs, 10 blocks fail today because of open work: app_knowledge (D9 is decided: keep it, per OSS-101; app PR 4472 restored it, but the published SDKs, PyPI 2.1.8 and npm 2.1.9, do not have it yet, so these entries stay until the SDKs are regenerated) and request= (PR 407, OSS-118). They are listed in scripts/known_example_failures.py. CI prints each one with its link. Every other failure fails CI. An entry that stops failing also fails CI, so the list cannot go stale.
  • Fixes the plain doc bug. essentials/v2/query.mdx: the TypeScript sample did not compile with @hydradb/sdk 2.1.9 (chunks are now a union of split and unified chunks). It now prints both kinds.
  • Reports every failure. The TypeScript, field-table and cookbook checks now report each block (each tsc diagnostic, each field, each cookbook). Before, the first failure hid the rest.

TypeScript blocks were already type-checked (113 blocks). This PR keeps that, runs it on 2.1.9, and reports it per diagnostic.

For agents

  • Merge order: this PR first. PR 407 and PR 408 both need hydradb-sdk 2.1.8, and 2.1.8 drops app_knowledge, which pages outside both PRs still use (D9). This PR's allow-list is what lets 2.1.8 run. Their validate is red until this PR lands. Test merges of this head (3c01a6d) with each branch: PR 408 passes unchanged (OK, 42 tests); PR 407 then only has to delete the 2 REQUEST_KWARG entries (CI names them).
  • Overlap with PR 407: the hydradb-sdk==2.1.8 pin and the canned-response hunks in scripts/test_docs_examples.py / scripts/test_cookbooks.py are byte-identical to PR 407 (test merge has no conflicts).
  • PR 400 is merged. main was merged in (7ba11f0, conflict in scripts/test_docs_examples.py resolved by keeping both: this PR's known-failure plumbing and PR 400's app_knowledge exemption and multipart schema pick). 3c01a6d deletes the 10 entries PR 400 fixed (and the unused SPEC_SYNC); the stale check named them. This PR does not decide D9 (decided since: keep app_knowledge, see OSS-101).
  • Allow-list match: check + page + a substring of the error. TypeScript matches each diagnostic; curl skips only the known field mismatch and still runs the payload, ingest-item, required-field and endpoint checks. Report goes to stdout as ::warning file=...,line=...::KNOWN FAILURE ... (GitHub shows the first 10 as annotations; the log has all).
  • scripts/ is in .gitignore; the 2 new files are force-added like the others.
  • Linear: OSS-119.

Proof

A = base main @ efa6f55 · B = this PR @ 3c01a6d

Re-run on 2026-12-04 (14:25 to 15:05 UTC) on the final head. Local Python 3.12 (uv venvs), Node 22.23.4 for Mintlify. Raw outputs: ~/hydradb/dogfood/docs-sdk/proof/409/final/ (A-efa6f55-pins.txt, A-efa6f55-latest.txt, B-3c01a6d.txt, B-3c01a6d-after-revert.txt, edge-*.txt, smoke-pins-*.txt, mintlify-*.txt).

1. A/B on the real repro

Command: python -m unittest discover -s scripts -p 'test_*.py' (the CI validate step). "Latest SDKs" = hydradb-sdk 2.1.8 (PyPI latest) and @hydradb/sdk 2.1.9 (npm latest), what users install today.

A (base @efa6f55) B (PR @3c01a6d)
SDKs the repo tests hydradb-sdk 2.1.7, @hydradb/sdk 2.1.8 hydradb-sdk 2.1.8, @hydradb/sdk 2.1.9 (= latest)
Result with its own pins OK (42 tests) OK (42 tests)
Result on the latest SDKs (what users get) FAILED (failures=2, errors=17) OK (42 tests)
Failures on the latest SDKs that A's pins hide 11 Python blocks, 6 cookbooks, 4 TS diagnostics in 3 blocks 0 unexpected
Known failures, printed as ::warning with link none Python 4, TS 2, cookbooks 4, curl 0, fields 0
Blocks checked - Python 117, TS 114, curl 99, fields 59, cookbooks 6
CI validate / examples-on-latest-sdks / pins-are-latest validate success on main (run 47346317128); the SDK-drift jobs do not exist all green on 3c01a6d

The doc fix in this PR, rendered by mintlify dev (TypeScript tab of the "Use the results" accordion on essentials/v2/query). A on @hydradb/sdk 2.1.9: query__line_32.ts(13,21): error TS2339: Property 'sourceTitle' does not exist on type 'SearchV2Chunk | SearchQueryChunk'. B: compiles.

A — base main @efa6f55 (left) vs B — PR 409 @3c01a6d (right): query.mdx TypeScript sample

What fails on A with the latest SDKs, and what B does:

Block Why it fails B (PR @3c01a6d)
essentials/v2/query.mdx:32 (TS) sourceTitle/chunkContent not on the 2.1.9 chunk union fixed in this PR
AGENTS.mdx:266, connectors.mdx:24, :136, :175, :384, get-metadata-schema.mdx:12, metadata.mdx:441; cookbooks cursor, support-agent test fake returns bodies that 2.1.8 cannot parse (harness, not docs) fixed (same hunks as PR 407)
connectors.mdx:421, :580, update-connector-resource.mdx:12 (Python) update_resource_acl(request=...) removed in 2.1.8 known failure → PR 407
context.mdx:229 (Python); AGENTS.mdx:657, context.mdx:256 (TS); cookbooks chief-of-staff, competitive-intelligence, glean, personal-assistant app_knowledge / appKnowledge removed from the SDKs known failure → D9

2. Regression

Check (command) A (base @efa6f55) B (PR @3c01a6d)
pnpm mintlify validate (Node 22) success: build validation passed success: build validation passed
pnpm mintlify broken-links success: no broken links found success: no broken links found
python .github/verify_v2_public_contract.py pass (53 pages, 44 bindings) pass (53 pages, 44 bindings)
test_v2_schema_types.py, test_docs_consistency.py, verify_agents_endpoints.py, generate_llms_index.py --check pass pass
CI faq-sync-tests, hygiene, dco-check, Mintlify link-rot / vale pass pass

3. Smoke

python scripts/check_sdk_pins.py (B's script, run in each tree). A: DRIFT hydradb-sdk ... tested 2.1.7, latest 2.1.8 and DRIFT @hydradb/sdk ... tested 2.1.8, latest 2.1.9, exit 1. B: OK hydradb-sdk ... 2.1.8 / OK @hydradb/sdk ... 2.1.9, exit 0.

4. Stress

N/A: no performance, limit or concurrency change. The suite runs in about 4 s.

5. Edge cases (on B @3c01a6d in a scratch worktree, each change reverted after; suite OK again after revert)

Deliberate break B (PR @3c01a6d) result
E1 Python sample: max_results=5 → max_result=5 in essentials/v2/query.mdx FAILED: query.mdx:20 TypeError: HydraDB.query() got an unexpected keyword argument 'max_result'
E2 TS sample: maxResults → maxResult in essentials/v2/query.mdx FAILED: TS2561 ... 'maxResult' does not exist in type 'SearchQueryRequest'
E3 extra TS error inside a known appKnowledge block (AGENTS.mdx:657) FAILED on the new TS2322; the known appKnowledge diagnostic is still printed as allowed
E4 curl JSON body field max_results → max_result (query.mdx:48) FAILED: JSON body has fields the spec does not declare: ['.max_result']
E5 stale allow-list entry (essentials/v2/query.mdx, app_knowledge) FAILED: these [python] known failures now pass: ['essentials/v2/query.mdx (app_knowledge)']

Reviews

Mira 5/5 on 3c01a6d (comment updated 14:13 UTC, after the last commit at 14:07). Devin Review check passed on 3c01a6d, no new threads. No unresolved threads.

🤖 Generated with Claude Code

…ted known-failure list (OSS-119)

- Pin the SDKs the examples run against to the latest releases:
  hydradb-sdk 2.1.8 (was 2.1.7) and @hydradb/sdk 2.1.9 (was 2.1.8).
  2.1.8 parses every response into a model with required fields, so
  the canned test responses get those fields. The pin line and those
  hunks are the same as in mintlify-docs PR 407 (OSS-118), so the two
  pull requests merge cleanly in either order.
- Dependabot opens a bump PR for either SDK every day. The new
  sdk-drift workflow fails every day while a pin is behind, and runs
  the examples against the latest SDKs.
- scripts/known_example_failures.py lists the blocks that fail for a
  reason an open PR decides (app_knowledge, decision D9 in PR 400; the
  spec sync in PR 400; request= in PR 407). CI prints each one as a
  warning, and an entry that no longer fails fails the run.
- The TypeScript check reports per block, the field-table check per
  field, and the cookbook check per file, so one failure no longer hides
  the others.
- essentials/v2/query.mdx: the TypeScript sample read sourceTitle and
  chunkContent on a chunk union that @hydradb/sdk 2.1.9 added; narrow it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityamishra-hydradb <[email protected]>
@mintlify

mintlify Bot commented Dec 4, 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 Dec 4, 2026, 2:07 PM

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

@adityamishra-hydradb

Copy link
Copy Markdown
Contributor Author

@hydra-mira-review review

@adityamishra-hydradb

Copy link
Copy Markdown
Contributor Author

/devin review

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

✅ Mintlify Hygiene

No issues found.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Starting Devin Review.

Devin Review

@hydra-mira-review

hydra-mira-review Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Mira score 5/5 · 🟢 Good to merge

  • No findings in the code.
  • Finish the requirement: List the described known failures across Python, TypeScript, curl, co…
  • Not read, excluded by the filter rules: pnpm-lock.yaml.

Documentation samples now run against newer SDK releases, with known failures printed separately and unexpected failures still failing CI. Daily dependency updates and drift checks track releases, while the query example handles both chunk formats.

Before this ships · 1 in place
  • ✅ A lockfile compatible with the updated TypeScript dependency (config), needed in Documentation repository: pnpm-lock.yaml. pnpm-lock.yaml records the ^2.1.9 requirement and resolves @hydradb/sdk to 2.1.9.
How this PR works · 7 changes, 5 medium risk, 2 low risk

Documentation checks used older SDKs and mixed expected failures with new regressions. This PR updates the SDK versions, adds explicit failure allowances, and checks daily for newer releases. It also updates test responses and fixes the query example for both chunk shapes.

1. Test examples against newer SDK versions · 🟠 medium risk · scripts/requirements-test.txt +1

Examples now use newer SDK contracts. Python moves from 2.1.7 to 2.1.8, while the TypeScript dependency range moves from ^2.1.8 to ^2.1.9.

Risk: An incorrect dependency update blocks documentation validation or tests examples against a different SDK than expected.

Check:

  • Confirm pnpm-lock.yaml resolves @hydradb/sdk to 2.1.9 and matches the manifest.

In requirements-test.txt:1, package.json:12.

2. Print known failures and reject unused allowances · 🟠 medium risk · scripts/known_example_failures.py

Expected failures can pass validation while remaining visible. Previously, no shared list distinguished these failures from new regressions.

Risk: An overly broad allowance hides a new documentation regression, while an incorrect allowance keeps validation red.

Check:

  • Confirm an unmatched error still fails and an unused entry requires deletion.
  • Review page-level error substrings for unintended matches.

In known_example_failures.py:1-69.

  1. Continue example checks after recognized failures · 🟠 medium risk · tests in test_docs_examples.py:383-398, test_docs_examples.py:413-470, test_cookbooks.py:279-320.

  2. Check diagnostics and fields separately · 🟠 medium risk · tests in test_docs_examples.py:501-554, test_docs_examples.py:582-606, test_docs_examples.py:649-702.

5. Print both query chunk shapes · 🟢 low risk · essentials/v2/query.mdx

Readers can print results from split and unified databases. The example now checks for content before accessing fields specific to either chunk shape.

Risk: Readers copying an incorrect branch get a compilation error or print missing chunk values.

Check:

  • Check the example with one split chunk and one unified chunk.

In query.mdx:40-45.

6. Detect SDK drift daily and request dependency updates · 🟠 medium risk · scripts/check_sdk_pins.py +2

Maintainers get daily checks for SDK drift and automated update requests. Previously, SDK releases did not trigger either check.

Risk: Incorrect version detection or installation makes scheduled checks misleading or repeatedly red for maintainers.

Check:

  • Confirm an outdated pin fails comparison while the independent latest-SDK job still runs.
  • Confirm Dependabot updates the TypeScript lockfile alongside the manifest.

In check_sdk_pins.py:1-54, sdk-drift.yml:1-67, dependabot.yml:15-41.

  1. Supporting changes · 🟢 low risk · tests in test_docs_examples.py:233-247, test_cookbooks.py:134-155.
Requirement check · 5 met, 1 partly met · from the PR description
  • ✅ Test with Python SDK 2.1.8 and TypeScript SDK 2.1.9 (met). scripts/requirements-test.txt selects 2.1.8; package.json requires ^2.1.9, and pnpm-lock.yaml resolves 2.1.9.
  • ✅ Request SDK updates daily and detect drift while testing against the latest releases (met). dependabot.yml adds daily SDK updates; sdk-drift.yml separately runs version comparison and latest-SDK example checks.
  • 🟡 List the described known failures across Python, TypeScript, curl, cookbooks, and field tables (partial). KNOWN contains Python, TypeScript, and cookbook allowances, but no curl or field-table allowances and no specification-sync reason.
  • ✅ Print linked known failures, reject unexpected failures, and fail on unused allowances (met). KnownFailures.allowed matches check, page, and error substring; report prints linked warnings and rejects entries without matches.
  • ✅ Fix the TypeScript query example for split and unified chunks (met). essentials/v2/query.mdx branches on content before reading the fields for either chunk shape.
  • ✅ Report TypeScript diagnostics, field-table failures, and cookbook failures separately (met). TypeScript diagnostics are evaluated individually; field-table checks use per-field subtests, and cookbook checks use per-cookbook subtests.
Diagram of the changed files
graph LR
  workflow[".github/workflows/sdk-drift.yml"] --> pins["scripts/check_sdk_pins.py"]
  workflow --> examples["scripts/test_docs_examples.py"]
  workflow --> cookbooks["scripts/test_cookbooks.py"]
  examples --> known["scripts/known_example_failures.py"]
  cookbooks --> known
  query["essentials/v2/query.mdx"] --> examples
Loading
⚠️ Other open PRs change the same code · 2

Merge them in order, or check that they agree.

  • #407 (merge-conflict risk). Both PRs change SDK test requirements and both example runners, creating overlap in the SDK validation setup. Shared: scripts/requirements-test.txt, scripts/test_cookbooks.py, scripts/test_docs_examples.py
  • #370 (merge-conflict risk). Rewriting query examples and adapting both example runners overlaps the query samples and validation code changed for current SDKs. Shared: essentials/v2/query.mdx, scripts/test_cookbooks.py, scripts/test_docs_examples.py

Comment @hydra-mira-review help for commands.

devin-ai-integration[bot]

This comment was marked as resolved.

hydra-mira-review[bot]

This comment was marked as resolved.

…t unified query chunks

- TypeScript: each tsc diagnostic is matched on its own, so a known
  appKnowledge error does not hide another error in the same block.
- curl: only the known field mismatch is skipped; the payload, query
  parameters, required fields and endpoint checks still run.
- Print the known-failure warnings before any assertion can stop the test.
- essentials/v2/query.mdx: print contextId and content for unified chunks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityamishra-hydradb <[email protected]>
@adityamishra-hydradb

Copy link
Copy Markdown
Contributor Author

@hydra-mira-review review

@adityamishra-hydradb

Copy link
Copy Markdown
Contributor Author

/devin review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Starting Devin Review.

Devin Review

adityamishra-hydradb and others added 2 commits December 4, 2026 19:37
Keep both sides in scripts/test_docs_examples.py: the known-failure
list from this branch and the app_knowledge exemption and multipart
schema pick from main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityamishra-hydradb <[email protected]>
PR 400 removed app_knowledge from most pages and synced the spec
(acl_inherit). Those 10 entries no longer match a failing block, so the
stale check failed. The 9 entries that still match stay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityamishra-hydradb <[email protected]>
@adityamishra-hydradb

Copy link
Copy Markdown
Contributor Author

@hydra-mira-review review

@adityamishra-hydradb

Copy link
Copy Markdown
Contributor Author

/devin review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Starting Devin Review.

Devin Review

This branch was successfully deployed

1 active deployment
staging — 3c01a6db Deployed Dec 4, 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.

1 participant