Repository navigation
Conversation
Preview:
|
|
Review: 6 findings. All six are posted in the inline review. |
e8a17d4 to
6cf61a2
Compare
|
Review: 7 findings. All seven are posted in the inline review. I verified them against the pinned Forge build, the TypeScript compiler, or the client’s injected transport. No requests were sent to providers. |
|
Review: 6 findings. All six are posted in the inline review. I verified them with local fixtures, the pinned Forge build, TypeScript, or a stubbed HTTP transport. No provider requests were sent. |
a92457a to
bf57686
Compare
|
Review: 7 findings. All seven are posted in the inline review. I verified them with local OpenAPI fixtures, the pinned Forge build, TypeScript, and a stubbed HTTP transport. |
1fda710 to
ac6e3ab
Compare
ac6e3ab to
b0f7ef3
Compare
|
Review: 6 findings. All six are posted in the inline review. I verified them with local OpenAPI fixtures, the pinned Forge build, TypeScript, and a stubbed HTTP transport. |
|
Review: 6 findings. All six are posted in the inline review. I verified them using local fixtures, TypeScript, stubbed HTTP transports, and Forge’s upstream ABI history. |
1364439 to
c0af9b8
Compare
|
Review: 2 findings. Both are posted in the inline review. I verified them with local Node checks, following the Gatekeeper Kit guide: “Use Node tests for pure logic.” |
Eval resultsVerdict: 🟡 Inconclusive. No task can be compared: eval definition changed.
Failed checks
|
🔬 Eval runs reviewPerformance
🟡 VERDICT: INCONCLUSIVEAll eight cohorts are marked “eval definition changed,” and neither side exercised this PR’s typed OpenAPI client or schema generator, so the observed differences don’t establish a PR effect. TriageFailure modes
Tool errors
What to do
|
3d6bb6d to
f995fd4
Compare
|
Review: 2 findings. Both are posted in the inline review. I verified them with local fixtures and Forge 0.4.0, following the Gatekeeper Kit guide: “Use Node tests for pure logic.” |
f995fd4 to
e093d45
Compare
|
Review: 3 findings. All three are posted in the inline review. I verified them with local Node fixtures and Forge 0.4.0, following the Gatekeeper Kit guide: “Use Node tests for pure logic.” |
e093d45 to
1214b17
Compare
|
Review: 2 findings. Both are posted in the inline review. I verified them with local fixtures and Forge 0.4.0, following the Gatekeeper Kit guide: “Use Node tests for pure logic.” |
1214b17 to
8706544
Compare
|
Review: 2 findings. Both findings are posted in the inline review. All 47 focused tests passed. I verified the findings separately with Forge 0.4.0, TypeScript, and a stubbed HTTP transport, following the Gatekeeper Kit guide: “Use Node tests for pure logic.” |
8706544 to
b727726
Compare
|
Review: 2 findings. Both are posted in the inline review. All 48 focused tests and the Gatekeeper Kit type check passed. I verified the findings separately with in-memory Forge 0.4.0 fixtures, following the package guide: “Use Node tests for pure logic.” |
`createOpenAPIClient`, in `./http`, calls a provider through a type-only
schema of its OpenAPI paths, in place of a hand-written fetch for each
endpoint.
- Only an operation's types reach the client. It fills a path's `{name}`
placeholders from a required `path` object, sends and parses JSON, and
resolves an empty reply to undefined. It validates nothing at runtime.
- A path that does not start with `/`, or has a `.` or `..` segment or
whitespace, is refused before a request is built: the URL parser could
turn it into another route or origin. The types refuse a union of
paths.
- It never follows a redirect, and a reply that is not 2xx throws
HttpError.
- `scopeTo(client, prefixes)` narrows a client to path prefixes with
their parameters fixed, for a connection bound to one organization or
project. A parameter is fixed under its own prefix only, and nothing
checks the method.
Co-authored-by: Nathan Disidore <nathan@cloudflare.com>
…on with Forge The `gatekeeper-openapi-schema` bin writes the type-only schemas `./http` calls through. It reads a JSON or YAML description, Forge reads the document in the generator's process, and forge/emit.ts renders what Forge read. - One `index.d.ts` holds the models and an `Api` schema of every operation. With --group-by tag there is one file and schema per tag. - --list prints one JSON line per operation, before Forge reads the document, and --operations keeps the lines a file lists. Only a line's `operationId` chooses, and a line whose method or path is no longer the document's fails the run. - A URL needs --sha256, so that a run generates from the same document as the last one. --overlay applies an OpenAPI Overlay, with `forge openapi overlay`, whose every action gives a `description`; one that changes nothing fails the run. --omit-header and --writable correct what a description gets wrong for a client. - Each operation's comment names the scopes it declares, from `security` or from the extensions --scopes-extension names. Where the description carries Forge's extensions, it also says that the operation asks for confirmation, is hidden or is short of general availability, and a field's comment that it is a secret. None is acted on. --list prints the first three, and a hidden operation's line must still say so. - An operation the client cannot send, with a non-JSON body or reply, an object-valued query parameter or a parameter Forge does not read, is listed at the top of its file as left out, and fails the run if it was asked for. So does an operation missing from the output. - An operation marked `x-forge-skip` is neither listed nor generated, as Forge does not read it, unless an alias names it. - `@cloudflare/forge` is pinned to 0.4.0 and passes the release-age rule, as Cloudflare's other packages on that list do. Co-authored-by: Sri Krishna <7254698+srikrsna@users.noreply.github.com>
A path's `{name}` placeholders were typed `string | number` from the
path alone, so a parameter the description limits to listed values was
not checked, and one it marks secret got no comment.
- An operation may declare `pathParams`. A placeholder it names takes
that type, and any other still takes a string or a number, so a schema
without `pathParams` reads as before. Nothing changes at runtime.
- `scopeTo` takes, for a prefix's parameter, only a value that every
operation under the prefix takes for it.
- The generator writes `pathParams` for every operation, each parameter
required and with its comment, which a call shows where the value is
passed. One limited to listed strings takes only those. Any other
takes a string or a number, whatever type the description gives it,
since the path carries either as text.
- Checking 250 calls over GitHub's whole schema costs 0.6% more
instantiations. That schema is 23% longer.
b727726 to
e6aa9cc
Compare
|
LGTM! |
Lets a gatekeeper call its provider through types generated from the provider's OpenAPI description, instead of a hand-written
fetchper endpoint. Adds a typed client (createOpenAPIClientin./http) and a generator,gatekeeper-openapi-schema. The generator runs Forge in its own process to read the description and renders what Forge read (forge/emit.ts); it no longer goes through a Forge plugin. The client is Sri Krishna's commit. The generator started from his plugin and is co-authored.{ data, status, headers }, the shape GitHub's and GitLab's hand-written clients already return. Some providers page only through a header (Sentry'sLink), which a body-only result hid.dataisundefinedfor an empty reply. A failure is unchanged:HttpErrorwith the status, no headers./, or has a.or..segment, is refused before a request is built. Either could leave the base URL.%20, not the+of a form. Some servers read+in a query as a plus.scopeTo(client, prefixes)narrows a client to path prefixes with their parameters fixed, for a connection bound to one organization or project. Paths only: a provider that selects the tenant in a query or body still needs the gatekeeper to pass it.id.pathParamsholds each one with its comment. One the description limits to listed strings takes only those: 30 of GitHub's 2,540 path parameters and 257 of Cloudflare's 6,356. Any other takes a string or a number, and a schema withoutpathParamsreads as before.scopeTotakes only a value that every operation under the prefix accepts. Cloudflare has 138 operations under/{account_or_zone}/{account_or_zone_id}, where onlyaccountsorzonesis valid.deploy_hook_idis one.--sha256, an overlay action without adescription, an overlay that leaves the description saying what it said, a hidden operation whose line does not say so, two groups that would write the same file or two that differ only in case, an--operationsfile that lists none. A document that is not OpenAPI 3.0, 3.1 or 3.2 is refused on load, before--listoffers operations no run could generate.x-forge-skipis treated as Forge treats it: not listed and not generated. A list ofx-forge-aliasesstands in for its operation: it is read only if one of them names a method, byoperationIdorx-forge-method-name, and is not skipped. Forge makes no method of an alias with neither.@cloudflare/forgeis pinned to 0.4.0, the first release withforge openapi overlay, and exempt from the release-age rule, like Cloudflare's other packages on that list.--overlay <file>, repeatable, applied byforge openapi overlaybefore anything else reads the document. It replaces the JSON Patch file this PR had. An overlay is a standard format, and an action picks its target by name where a patch counted array positions.on,off,yesornoin YAML as a boolean and the generator reads it as a string, so a YAML description now reads the same with an overlay as without. What Forge warns of on a run that succeeds is passed on.extendsis resolved first, from where the overlay is. One with a scheme is passed as written. An action that refers to a reusable action (Overlay 1.2) may take itsdescriptionfrom it..d.tsthat starts with Forge's preamble. The preamble alone is also on what Forge's own SDK generators write, and they write.ts.forge openapi overlay: an option to fail on an action whose target matches nothing forge#194. Forge passes over an action whose target matches nothing, as the Overlay specification has it, and has no flag to fail on one. The generator refuses only an overlay that changes nothing at all, so one dead correction among several is silent. The ask: a flag that fails on an action with no match. Forge already counts matches per action. Until then the check is the diff of the generated schema after pinning a new description.x-forge-require-confirmation), is hidden from listings (x-forge-hidden) or is short of general availability (x-forge-availability), and a field's comment says that it is a secret (x-forge-sensitive).--listprints the first three on the operation's line. Like scopes, they are written and not acted on: an action's verdict is its gatekeeper's. Cloudflare's description asks for confirmation on 239 of the 3,155 operations it lists.--operationsline must still say"hidden":true, as--listprints it, so that one is chosen knowingly.--group-by tag. A provider's tags arrange its documentation, not a gatekeeper's authority.--listprints one JSON line per operation, read before Forge runs, so it works on a document Forge cannot generate from whole.--operationsreads a file of those lines.operationIdchooses. A kept line whose method or path no longer matches the description fails the run, so an operation that moved under the same id is noticed.--scopes-extensionis repeatable, for a description that keeps a kind of scope in each of several extensions, and the comment then names each beside its scopes. Cloudflare's keeps OAuth scopes inx-forge-oauth-scopesand API token permissions inx-api-token-group, so a gatekeeper holding both credentials reads what each can call.maincalls this yet. A PagerDuty port exists on a branch outside this stack.pnpm lintpasses.Known limits, found in review and left for later. Each of these fails at compile time or as a provider's rejection:
{}is typedunknown, so the call compiles without one.additionalPropertiesgive a type that refuses valid payloads.in: cookieparameter is dropped. Forge ignores cookies.operationIdunder one tag collide in--group-by tag.queryandadditionalOperationsslots are not listed or filtered.$refinto part of a non-schema component, which OpenAPI 3.1 allows, are dropped when it is copied in.--writableonly clears areadOnlywritten directly on the property. One reached throughallOfor a$refstays read-only, and the flag does nothing.$refthat points at another$refis followed one hop.--omit-headermisses it, and an object-valued query parameter behind one fails the run.{}, which accepts any non-null value.$refkey is read as a reference and fails the run. An overlay can drop the example.$refto an array, or to a union that has one, leaves its operation out, and asking for it fails the run. An overlay can inline the schema. 23 of Cloudflare's 3,931 operations; none in GitHub's, Sentry's, PagerDuty's or Stripe's.$refhas mutable arrays where an inline one hasreadonlyones, so passing areadonlyarray needs a spread.allOfof more than one member also takes any string or number. None of the 9,935 is. A single-memberallOf, the usual way to describe a reference, keeps them.These six may not fail at all: what a call sends or gets can differ from what its types say.
explode: falsequery array and an array path parameter are passed as a joined string, and the comma is sent encoded.writeOnlyproperty is required in the response type too.serversof its own is emitted like any other, and a call to it goes to the client's base URL. None is reachable today in GitHub's, Cloudflare's, Sentry's or PagerDuty's description: GitHub's one is refused for its body, Cloudflare's nine are markedx-forge-skip. The client never acts onservers, so a credential only goes to the base the gatekeeper configured.+jsonmedia type is still requested withAccept: application/json.int64is typednumberand read byJSON.parse, so a value past 2^53 is rounded.Acceptgets data its type does not describe. 2 of GitHub's 1,281 operations.Also found in review and left:
Headersrefuses is echoed in the error it throws. workerd's error names no value.https://, is not refused: the first segment of the path becomes the host.Requestthrows with the URL in its message; workerd's does not throw.scopeTocopies a call's arguments with a spread, soquery,headersorbodydefined as prototype getters are lost.--sha256is of the decoded text, so a description served with a byte-order mark does not hash as its bytes do.--out ., run from inside an output directory, replaces that directory and leaves the shell in the removed one. The files are in the new one. No script the scaffold writes passes it.$selfis resolved from the working directory, because Forge reads the description on standard input. An overlay whoseextendsnames that description matches only when the generator runs from the description's directory. The overlay applies the same withoutextends.