perf: optimize indexer ref walking and improve CLI output formatting#144
Merged
TristanSpeakEasy merged 2 commits intomainfrom Feb 9, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves OpenAPI indexing performance by deduplicating repeated $ref walks, and enhances CLI/text output formatting (aligned columns + elapsed timing + aligned validation error numbering).
Changes:
- Add
visitedRefstracking to skip re-walking already-indexed$reftargets (plus updated circular-ref expectations). - Replace tab-delimited lint output with width-aligned columns.
- Add elapsed-time reporting for
validateandlint, and align validation error numbering.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| openapi/index.go | Adds visitedRefs short-circuit to avoid repeated schema subtree walks. |
| openapi/index_profile_test.go | Adds a perf regression-style test for many refs to the same schema. |
| openapi/index_test.go | Updates circular-ref expectations due to ref-walk deduping. |
| openapi/linter/linter_test.go | Updates circular-ref test expectations due to ref-walk deduping. |
| linter/format/text.go | Reworks text formatting to compute column widths and align output. |
| linter/format/format_test.go | Adds a test case intended to cover alignment behavior. |
| cmd/openapi/commands/openapi/timing.go | Introduces reportElapsed helper for consistent timing output. |
| cmd/openapi/commands/openapi/timing_test.go | Adds unit tests for reportElapsed formatting. |
| cmd/openapi/commands/openapi/validate.go | Adds timing + aligned validation error list formatting. |
| cmd/openapi/commands/openapi/validate_test.go | Adds tests for formatValidationErrors alignment. |
| cmd/openapi/commands/openapi/lint.go | Adds timing output to lint command execution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
57ea0f1 to
8e4c558
Compare
Contributor
📊 Test Coverage ReportCurrent Coverage: Coverage Change: ✅ No change Coverage by Package
📋 Detailed Coverage by Function (click to expand)
Generated by GitHub Actions |
8e4c558 to
cdf2951
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
visitedRefstracking to skip re-walking ref targets that have already been fully indexed. Previously, each of N references to the same schema triggered a full walk of that schema's subtree, causing O(N x tree_size) work. This reduces indexing time for ref-heavy specs (e.g. Glean) from ~2s to ~30ms for 200 paths.validateandlintcommands (printed to stderr).Test plan
TestBuildIndex_ManyRefsToSameSchemaperformance regression test asserting < 1s for 200-path specTestReportElapsed_Successfor timing outputTestFormatValidationErrors_Successfor error list alignmentmise cipasses (lint, test, build)