Repository navigation
feat(contracts): inventory offline OpenAPI operation declarations - #9104
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The reviewed changes appear safe to merge; all three earlier findings are fixed. SummaryAdds offline OpenAPI JSON operation inventories through CLI and MCP, with source identities, unresolved references, diagnostics and retained views.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Local OpenAPI JSON] --> B[Verified file snapshot]
B --> C[Decode and inventory inline operations]
C --> D[Complete Evidence]
C --> E[Typed failure with source identity]
D --> F[MCP retained views]
D --> G[CLI complete output or saved bundle]
Reviews (3) · Last reviewed commit: "fix(api-contract): preserve safe diagnos..." · Reviewed by Greptile |
Summary
Refs #8912. Add the OpenAPI JSON operation-inventory slice; the broader issue remains open for YAML, reference resolution, AsyncAPI, schema graphs, diffs and traffic correlation.
inspect_api_contractreads a local OpenAPI 3.0/3.1/3.2 JSON document offline and returns declared method/path slots with source-scoped IDs, separate exact method/path keys, original JSON Pointers and artifact SHA-256. MCP defaults to a retained summary; optionalviewreturns selected operations, unresolved Path Items or diagnostics immediately. CLI addsinspect-api-contract, with standard complete delivery and summary/selected publication to an absent Evidence bundle.Behavior and ownership
One application implementation serves both adapters. The existing stable-artifact owner verifies exactly the bytes being parsed and retains failed cleanup ownership. Parsing checks heap headroom before native JSON expansion, validates bounded nesting cooperatively, then enumerates inline paths without resolving references or contacting servers. The shared retained projector handles exact batch filters, fields and pagination; identity, source pointer, state and unknown reason remain on minimal operation rows. Delivery selection does not change complete Evidence identity.
Malformed siblings remain useful facts plus diagnostics. Path Item references remain unresolved and adjacent inline slots remain unknown. Page exhaustion never upgrades source coverage. Declarations do not establish implemented, reachable or authorized behavior, and this is not full OpenAPI validation. Structured URI userinfo credentials are excluded through the existing recorded-URL parser; ambiguous spans remain unknown, while ordinary reference query/fragment text and names are preserved. Complete inventory Evidence stays accessible; original source JSON is identified by digest rather than embedded.
Read-only local composition: no deep provider, target execution, network, dependency or configuration change. CLI publication uses the existing destination/cleanup owner. File and conservative expanded-facts allowances are each 32 MiB resource policies; JSON also uses available-heap admission and the shared nesting ceiling of 1,000.
Executed validation
Current head
c712da7c6, based on main8580f1430; Linux x64, Node 24.22.1 / npm 11.16.0:caller_input_pathannotation is explicitly preserved in parity assertions.details.partial_observationcontract; their initial two oracle errors were corrected without changing production projection. 3 whole-CLI help/alias tests also passed. Full source typecheck, focused syntax/typed lint, module/architecture guards, Knip, test discovery, docs including 9 README tests, full-repository formatting andgit diff --checkpassed. Six warnings remain in existing large hubs/constructor signatures; no rules were waived. Local hooks were disabled for the explicitly checked commit/push; full local lint/check:pr was not run, and final-head CI passed: all 8 portable shards and 24,217 source tests passed (16 skipped); all 3 CodeQL analyses also passed. Merged normally, without bypass or review requests. Initial CI found a fixture link outside the published docs site and a missing shared byte-allowance description; the parameter now inherits help from the shared schema and all 10 catalog tests passed. For the docs failure, the link now names the pinned repository commit, and the completenpm run docs:buildpassed before the documentation-only follow-up was pushed. Automated Codex code review was unavailable because the repository quota was exhausted; no review was requested.All three actionable Greptile findings were reproduced and fixed at their owners: shared UTF-8 JSON syntax diagnostics omit source excerpts while preserving the internal cause; one post-read service boundary retains verified path/hash/bytes on failures; cooperative traversal returns a completed failed Result before queued cancellation. Regression checks cover malformed JSON through both public adapters, shared native/streaming readers, validation/cancellation snapshots, and unsupported-version/capacity failures followed by abort. No human review was requested.
The committed Apache-2.0 Petstore fixture is original published JSON: 17,106 bytes, 19 operations, OpenAPI 3.0.4. An additional uncommitted pinned GitHub REST description is 14,151,332 bytes with 1,261 operations (OpenAPI 3.0.3). The built CLI/MCP verifier checked every operation against independent raw-JSON lookup, complete page reconstruction, source byte identity, retained queries without the original file, and publication parity. Real 3.1/3.2 publisher compatibility, full OpenAPI conformance and actual Windows behavior are unverified.
Efficiency observations
On the GitHub document, first selected import with an already prepared SDK took 243 ms; repeated full-file reimports took 198–268 ms. A ten-row answer was 17,527 serialized tool-result JSON bytes, versus 1,146,529 bytes for complete delivery. Warm retained-page calls took 13–29 ms without the source file. First generic-view SDK preparation separately cost about 3.78 s, supporting the optional inline selector. This tool's input/output schemas are 2,672 / 19,237 bytes; the generic view output schema is 648,738 bytes.
The entire verification task (hashing/copies, independent oracle, SDK preparation, repeated imports, every page and four fresh CLI controls) took 15.614 s, 16.391 / 2.093 s task user/system CPU delta, and 1.48 GiB sampled process-family RSS. Two-CPU affinity and a 4-GiB family guard were used; no run hit the guard or OOMed. RSS is summed every 200 ms, counts shared pages in each process and can miss short peaks. OS caches were warm; first-call labels describe SDK/process state. Model tokens and reasoning time were not measured. Fetching every page costs more than complete delivery; no equivalent old importer exists and no universal speedup/token saving is claimed.
Author readiness
Human owner: @gensokyo-dev
The author is exempt from the declaration under CONTRIBUTING.md. The coding agent implemented, inspected and validated this diff under the owner's explicit task authorization; no human-review attestation is made.