fix(docs): correct Console API reference accuracy issues#1230
Merged
Conversation
The Stripe-style Console API reference was generated from Swagger with
AI assistance and contained several hallucinated or incorrect claims.
Fixes verified against console2 zod schemas and the chain-sdk source:
- Drop the fake `import { CertificateValidator } from "@akashnetwork/chain-sdk"`
from all 4 provider lease-ops JS snippets (status, logs, kubeevents, shell).
The package doesn't export that symbol, and even if it did,
`CertificateValidator.validate()` is async — it can't run inside Node's
synchronous `checkServerIdentity` callback. Replace with
`rejectUnauthorized: false` and a comment pointing to the preface.
- Rewrite the TLS/cert pinning prose to describe the real pinning
mechanism: CN must be the provider's bech32 wallet address, and the
chain's `MsgCreateCertificate` record for `(address, serial number)`
must match the leaf cert fingerprint. Link to the provider-proxy
`CertificateValidator` for a reference implementation.
- POST /v1/create-jwt-token: response status 200 OK -> 201 Created
(jwt-token.router.ts returns 201).
- GET /lease/{dseq}/{gseq}/{oseq}/status: rewrite `responseFields` and
`responseExample`. `forwarded_ports` and `ips` are top-level keyed by
service name (not nested under services); `restart_count` and
`total_replicas` don't exist; the response includes `name`, `available`,
`total`, `uris`, `observed_generation`, `replicas`, `updated_replicas`,
`available_replicas` per service.
- Add `hostname-migrate` and `ip-migrate` to the JWT scope enumeration in
both spots (chain-sdk's `AccessScope` type lists 9 values; docs listed 7).
The provider-side snippets in the lease-ops section claimed to bypass TLS
verification, but as written they would have failed at runtime:
- JS GET /lease/.../status used `await fetch(url, { agent })`. Node's
global `fetch` is built on undici and silently ignores `https.Agent`,
so the request would have failed with `SELF_SIGNED_CERT_IN_CHAIN`.
Switch to undici's `fetch` + `Agent` + `dispatcher`, which actually
controls TLS. (The WSS snippets use the `ws` package, which does
accept `agent`, so they're left as-is.)
- Bash snippets for status / logs / kubeevents lacked `-k` /
`--insecure`, so curl/websocat would reject the self-signed provider
cert. Add the flags inline with a one-line comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Stripe-style Console API reference (#1226) was generated from Swagger with AI assistance and shipped a handful of hallucinated or incorrect claims that broke copy-paste-ability of the snippets. All eight fixes verified against the canonical zod schemas in
console(apps/api + apps/provider-proxy) and the@akashnetwork/chain-sdksource.Provider lease-ops (status / logs / kubeevents / shell)
import { CertificateValidator } from "@akashnetwork/chain-sdk"from all 4 JS snippets. The package doesn't export that symbol, and even if it did,CertificateValidator.validate()is async — it can't run inside Node's synchronouscheckServerIdentitycallback (it would resolve to aPromise, which Node treats as truthy/non-error, silently bypassing validation). Replace withrejectUnauthorized: falseand a comment pointing to the preface.MsgCreateCertificaterecord for(address, serial number)must match the leaf cert fingerprint. The lookup is a chain query, so it has to happen async, after the TLS handshake. Link to the provider-proxyCertificateValidatorfor a reference implementation.GET /lease/{dseq}/{gseq}/{oseq}/status response shape
responseFieldsandresponseExample. The previous version putforwarded_portsandipsunder each service, but the real response (verified againstLeaseStatusResponseSchema+ thelease-status.seeder.tstest fixture) has them as top-level keys map of service name → array. The phantomrestart_countandtotal_replicasare removed; the actual fields (name,available,total,uris,observed_generation,replicas,updated_replicas,ready_replicas,available_replicas) are documented.JWT endpoint
POST /v1/create-jwt-tokenreturns201 Created, not200 OK(jwt-token.router.ts:47).hostname-migrateandip-migrate.@akashnetwork/chain-sdk'sAccessScopetype lists 9 values; the docs listed 7. Verified pass-through: Console'sProviderJwtTokenService.generateJwtTokenvalidates viajwtTokenManager.validatePayload, so any chain-sdk scope is accepted.Audit summary
Every Console API endpoint's HTTP method, URL, request body, response body, response status, and request params was cross-checked against
console2/apps/api/src/**/*.schema.tsand route handlers. The fixes above are the complete delta; all other endpoints' shapes match their zod schemas as-shipped.Out of scope
@akashnetwork/chain-sdk— verified accurate (JwtTokenManager.generateTokenexists and is used byconsole2/apps/deploy-web/src/hooks/useProviderJwt/useProviderJwt.ts).Test plan
npm run buildpasses (588 pages, 35.84s on local)git grep "CertificateValidator\|chain-sdk" src/lib/docs/console-api-endpoints.tsreturns only the intentional references (the link to provider-proxy CertificateValidator + the line-833JwtTokenManagermention)/docs/api-documentation/console-api/api-referenceno longer containstotal_replicas,restart_count, or the brokenCertificateValidatorimport inside any code blockMsgCreateCertificate(in prose),201 Created(in JWT response pill), andhostname-migrate/ip-migrate(in both JWT scope lists)/docs/api-documentation/console-api/api-referencein dev preview