Skip to content

docs: publish the OpenAPI document - #37

Open
tuliomir wants to merge 1 commit into
fix-ready-before-pool-seededfrom
openapi-document
Open

docs: publish the OpenAPI document#37
tuliomir wants to merge 1 commit into
fix-ready-before-pool-seededfrom
openapi-document

Conversation

@tuliomir

@tuliomir tuliomir commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Stacked PR. This sits on top of #25 and targets its branch, so review only this PR's own commit — GitHub re-targets it to main when #25 merges. (GitHub's Stacked Pull Requests are in public preview.)

The README advertised a canonical OpenAPI document that did not exist. Adds docs/openapi.yaml describing all seven operations, the shared error schema with every code mapped to its status and retryable value, the X-Test-Name and x-request-id headers, the /status diagnostic body, and the readiness reasons.

It is based on #25 rather than main because the contract it documents is the one that ships with that fix: the spec carries the funding_initializing reason and states that /fund refuses exactly the phases /ready refuses. Documenting the pre-fix behaviour would have made this stale on the day it merged.

How it works

  • docs/openapi.yaml (new) — derived from the handlers, not the README. OpenAPI 3.1, validated against the official meta-schema.
  • .github/workflows/ci.yml — a validation job, SHA-pinned like the existing one.
  • package.json — the validator is a devDependency resolved from the lockfile rather than fetched at run time, so a registry blip cannot fail an unrelated PR and Dependabot can watch it.
  • .github/dependabot.yml — npm joins the covered ecosystems, with the same weekly cadence, 7-day cooldown and patch filtering as the actions block.
  • __tests__/src/openapi-version.test.ts (new) — pins info.version to package.json. Client generators stamp that value into generated metadata, so a stale one misleads, and the schema validator would accept any semver string.
  • CONTRIBUTING.md — referenced docs/OPENAPI.yaml in the wrong case and docs/AGENT-CONTRACT.md, which has never existed in this repository. The first now resolves; the second is dropped, its retry/error/readiness role folded into the document this PR adds.

Behavioral change

None at runtime. One documentation correction: the README's readiness table listed wallet_unfunded before funds_query_error under "evaluated in this order". The funds query runs inside currentReadiness before computeReadiness is reached, so a failed query never reaches the funded/unfunded decision — funds_query_error comes first. The table is corrected to match the code.

Known limitation

Schema validation proves the document is well-formed, not that it describes this service. Nothing yet detects the spec disagreeing with the handlers — tracked in #33, which also names the concrete case already queued (#31 changes the /multisigWallet response).

Acceptance criteria

  • bun run validate:openapi passes locally and in CI, and fails on a malformed document or a dangling $ref.
  • All seven endpoints, every error code with its status and retryable value, and the /status body are described.
  • The README links to the document instead of promising it.
  • info.version matching package.json is enforced by a test.

Closes #29

Stack created with GitHub Stacks CLIGive Feedback 💬

The README advertised a canonical API document that did not exist.
Adds `docs/openapi.yaml` describing all seven operations, the shared
error schema with every code mapped to its status and `retryable`
value, the `X-Test-Name` and `x-request-id` headers, the `/status`
diagnostic body, and the readiness reasons.

Based on the readiness fix rather than main, because the contract it
documents is the one that ships with that fix: the spec carries the
`funding_initializing` reason and states that `/fund` refuses exactly
the phases `/ready` refuses. Documenting the pre-fix behaviour would
have made this stale on the day it merged.

Derived from the handlers rather than the README, which turned out to
have the readiness evaluation order wrong: the funds query runs inside
`currentReadiness` before `computeReadiness` is reached, so
`funds_query_error` precedes `wallet_unfunded`. The README table is
corrected to match.

CI validates the document against the OpenAPI meta-schema. The
validator is a devDependency resolved from the lockfile rather than
fetched at run time, so a registry blip cannot fail an unrelated PR and
Dependabot can watch it — which also means npm joins the ecosystems it
covers, with the same cooldown and patch-filtering posture as actions.

A unit test pins `info.version` to package.json. Client generators
stamp that value into generated metadata, so a stale one misleads; the
schema validator would accept any semver string.

`CONTRIBUTING.md` referenced `docs/OPENAPI.yaml` in the wrong case and
`docs/AGENT-CONTRACT.md`, which has never existed in this repository.
The first now resolves; the second is dropped, its retry/error/readiness
role folded into the document this commit adds.

Schema validation cannot detect the spec disagreeing with the handlers
— tracked in #33.

Closes #29

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 244c8906-053d-4778-bae1-f72d673bfb96

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tuliomir tuliomir added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 4, 2026
@tuliomir tuliomir self-assigned this Aug 4, 2026
@tuliomir
tuliomir requested a review from pedroferreira1 August 5, 2026 16:02
@tuliomir tuliomir moved this from Todo to In Progress (Done) in Hathor Network Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

Status: In Progress (Done)

Development

Successfully merging this pull request may close these issues.

Publish the OpenAPI document the README promises

1 participant