Skip to content

test: check the code samples in the docs against the SDKs and policies - #126

Merged
pavancharak merged 1 commit into
mainfrom
test/docs-code-samples
Oct 2, 2026
Merged

pavancharak merged 1 commit into
mainfrom
test/docs-code-samples

Conversation

@pavancharak

Copy link
Copy Markdown
Owner

What

The docs' code samples were not run or type checked by anything, and the page by page audit (#119 to #125) found samples that could never have worked. Two tests now check what such samples get wrong, without requiring every fragment to be a complete program.

  • tests/architecture/docs-code-samples.test.ts (runs with npm test):
    1. TypeScript samples that import @parmana/sdk (40+) are type checked against the built SDK in memory. Only diagnostics meaning the sample disagrees with the SDK fail: missing export, method or property, unknown option, wrong arguments. A name the fragment assumes is in scope does not. No DOM lib, so event or fetch in a sample is not the browser's.
    2. Every policy a request sample names (name and version, in TypeScript, JSON or PolicyReference(...)) exists and declares approvalSignals, so it loads.
    3. Every signal such a request sample sends is declared by that policy (plus approvalArtifact).
  • python/tests/test_docs_code_samples.py (runs in the Python SDK workflow): Python samples that import parmana are checked with mypy; attr-defined, call-arg, arg-type and union-attr fail.
  • The Python SDK workflow now also runs on docs/site/** changes.

Checked both ways

  • A deliberately broken sample is reported for each kind of mistake: a missing export, a misspelled option (apiKy, apikey), a missing method (executeTransaction, executeee), customer-refund 1.0.0, and an undeclared signal (customerVerified).
  • On the real docs they found three more problems, fixed here: vendor-payment 2.0.0 (refused) on the Python SDK page; a captured output in the TypeScript quickstart from 2026-09-14 under 2.0.0, captured again from example 06 on 2026-10-02; and health.status in the Python production guide, where health() returns a dict.

🤖 Generated with Claude Code

No test ran the docs' code samples, and the page by page audit found
samples that could never have worked. Two tests now check what such
samples get wrong, without requiring every fragment to be a whole
program:

- tests/architecture/docs-code-samples.test.ts: TypeScript samples that
  import @parmana/sdk are type checked against the built SDK (only
  missing exports, methods, properties and wrong arguments fail); every
  policy a request sample names exists and declares a human approval;
  every signal it sends is declared by that policy.
- python/tests/test_docs_code_samples.py: Python samples that import
  parmana are checked with mypy for the same kinds of mismatch.

Both were checked against a deliberately broken sample (each kind of
mistake is reported) and pass on the docs after fixing what they found:
vendor-payment 2.0.0 in the Python SDK page and a stale captured output
in the TypeScript quickstart (captured again, 2026-10-02), and
health()["status"] in the Python production guide (health() returns a
dict). The Python workflow now also runs on docs changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
parmana-api-real Ready Ready Preview Oct 2, 2026 11:26am UTC
parmana-sandbox Ready Ready Preview Oct 2, 2026 11:26am UTC

@mintlify

mintlify Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

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

Project Status Preview Updated
parmanasystems 🟢 Ready View Preview Oct 2, 2026, 11:25 AM

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

This branch was successfully deployed

3 active deployments
Preview – parmana-sandbox — 0d99ffa5 Deployed Oct 2, 2026 by vercel[bot]
Preview – parmana-api-real — 0d99ffa5 Deployed Oct 2, 2026 by vercel[bot]
staging - docs/site — 0d99ffa5 Deployed Oct 2, 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