Skip to content

Commit cf3da01

Browse files
authored
fix(perf): Improve the performance of the typegraph expansion (#1008)
<!-- Pull requests are squashed and merged using: - their title as the commit message - their description as the commit body Having a good title and description is important for the users to get readable changelog. --> <!-- 1. Explain WHAT the change is about --> The previous single-pass recursive algorithm for the typegraph expansion was buggy and had terrible performance. This PR attempts to simplify the expansion, making it easier to debug and have better performance. For more details, see the doc comments at the crate root (`src/typegraph/graph/src/lib.rs`). Other changes: - Change the github runners: - Downgrade to Ubuntu 22.04 - Use the native Github runners for ARM <!-- 2. Explain WHY the change cannot be made simpler --> <!-- 3. Explain HOW users should update their code --> #### Migration notes _N/A_ --- - [x] The change comes with new or modified tests - [x] Hard-to-understand functions have explanatory comments - [ ] ~End-user documentation is updated to reflect the change~ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - The tree view web tool now displays a dynamic footer status bar showing loading state and type count, and supports union/either node types in typegraph visualization. The default tree depth can be set via a URL parameter. - **Bug Fixes** - Corrected naming and ordering of selection types and partial types in generated Rust, TypeScript, and Python client code for composite and cyclic structures. - Fixed a job naming typo in the test workflow. - **Refactor** - Major internal overhaul of typegraph conversion logic, simplifying and restructuring the process for converting, linking, and registering types. - Streamlined and clarified logic for rendering TypeScript FDK templates and type registries. - Improved visibility and access to generated TypeScript client manifest types. - **Chores** - Updated GitHub Actions workflows to use explicit Ubuntu 22.04 runners for consistency. - Increased verbosity of the meta-cli serialize command for tree view tooling. - Updated dependencies in configuration files. - **Documentation** - Added comprehensive module-level documentation for the typegraph expansion process. - **Tests** - Added and reorganized migration test files and improved structure of test-generated client code for clarity and accuracy. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 67e3260 commit cf3da01

File tree

41 files changed

+1493
-1370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1493
-1370
lines changed

.github/workflows/autoupdate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
auto-update:
9-
runs-on: ubuntu-latest
9+
runs-on: ubuntu-22.04
1010
steps:
1111
- uses: actions/checkout@v4
1212
- uses: actions/setup-python@v5

.github/workflows/nightly.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- platform: linux/amd64
1919
runner: custom-ubuntu-large
2020
- platform: linux/arm64
21-
runner: custom-arm
21+
runner: ubuntu-22.04-arm
2222

2323
steps:
2424
- uses: actions/checkout@v4
@@ -66,7 +66,7 @@ jobs:
6666
merger:
6767
needs:
6868
- builder
69-
runs-on: ubuntu-latest
69+
runs-on: ubuntu-22.04
7070
strategy:
7171
fail-fast: false
7272
matrix:
@@ -95,7 +95,7 @@ jobs:
9595
cleaner:
9696
needs:
9797
- merger
98-
runs-on: ubuntu-latest
98+
runs-on: ubuntu-22.04
9999

100100
steps:
101101
- uses: docker/login-action@v3

.github/workflows/pr-title-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
check:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-22.04
1414
steps:
1515
- uses: amannn/action-semantic-pull-request@v5
1616
env:

.github/workflows/publish-website.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010

1111
jobs:
1212
changes:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-22.04
1414
steps:
1515
- uses: actions/checkout@v4
1616
- uses: dorny/paths-filter@v3
@@ -26,7 +26,7 @@ jobs:
2626
deploy:
2727
needs: changes
2828
if: ${{ needs.changes.outputs.website == 'true' }}
29-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-22.04
3030
steps:
3131
- uses: actions/checkout@v4
3232
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc

.github/workflows/release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ env:
2525

2626
jobs:
2727
check-bump:
28-
runs-on: ubuntu-latest
28+
runs-on: ubuntu-22.04
2929
if: github.ref_type == 'tag' || ( github.event_name == 'workflow_dispatch' && inputs.checkBump )
3030
steps:
3131
- uses: actions/checkout@v4
@@ -79,7 +79,7 @@ jobs:
7979
target: aarch64-apple-darwin
8080
suffix: ""
8181
cross: false
82-
- os: ubuntu-latest
82+
- os: ubuntu-22.04
8383
target: x86_64-unknown-linux-gnu
8484
suffix: ""
8585
cross: false
@@ -88,7 +88,7 @@ jobs:
8888
# target: x86_64-unknown-linux-musl
8989
# suffix: ""
9090
# cross: false
91-
- os: ubuntu-latest
91+
- os: ubuntu-22.04
9292
target: aarch64-unknown-linux-gnu
9393
suffix: ""
9494
cross: true
@@ -160,7 +160,7 @@ jobs:
160160
needs.check-bump.result == 'success'
161161
|| github.event_name == 'workflow_dispatch'
162162
)
163-
runs-on: ubuntu-latest
163+
runs-on: ubuntu-22.04
164164
permissions:
165165
contents: write
166166
id-token: write # The OIDC ID token is used for authentication with JSR.
@@ -229,7 +229,7 @@ jobs:
229229
matrix:
230230
include:
231231
- platform: linux/amd64
232-
runner: ubuntu-latest
232+
runner: ubuntu-22.04
233233
- platform: linux/arm64
234234
runner: custom-macos
235235
steps:
@@ -266,7 +266,7 @@ jobs:
266266
# needs hack required here as well because
267267
# `build-docker` uses it
268268
if: always() && needs.build-docker.result == 'success'
269-
runs-on: ubuntu-latest
269+
runs-on: ubuntu-22.04
270270
steps:
271271
- uses: actions/checkout@v4
272272
with:
@@ -295,7 +295,7 @@ jobs:
295295
- pub-typegraph
296296
- build-docker
297297
- pub-docker
298-
runs-on: ubuntu-latest
298+
runs-on: ubuntu-22.04
299299
permissions:
300300
contents: write
301301
pull-requests: write

.github/workflows/tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ env:
4545

4646
jobs:
4747
changes:
48-
runs-on: ubuntu-latest
48+
runs-on: ubuntu-22.04
4949
permissions:
5050
pull-requests: read
5151
steps:
@@ -77,7 +77,7 @@ jobs:
7777
full: ${{ steps.filter.outputs.full }}
7878

7979
pre-commit:
80-
runs-on: ubuntu-latest
80+
runs-on: ubuntu-22.04
8181
steps:
8282
- uses: actions/checkout@v4
8383
- uses: dsherret/rust-toolchain-file@v1
@@ -148,7 +148,7 @@ jobs:
148148
test-website:
149149
needs: changes
150150
if: ${{ needs.changes.outputs.website == 'true' && !(github.event_name == 'workflow_dispatch' && inputs.tmate_enabled) }}
151-
runs-on: ubuntu-latest
151+
runs-on: ubuntu-22.04
152152
steps:
153153
- uses: actions/checkout@v4
154154
# - name: Cache deno dir
@@ -170,7 +170,7 @@ jobs:
170170
ghjk x install-website
171171
ghjk x test-website
172172
173-
bulid-docker:
173+
build-docker:
174174
needs: changes
175175
if: ${{ needs.changes.outputs.typegate == 'true' && !(github.event_name == 'workflow_dispatch' && inputs.tmate_enabled) }}
176176
runs-on: ${{ matrix.runner }}
@@ -181,7 +181,7 @@ jobs:
181181
- platform: linux/amd64
182182
runner: custom-ubuntu-large
183183
- platform: linux/arm64
184-
runner: custom-arm
184+
runner: ubuntu-22.04-arm
185185
steps:
186186
- uses: actions/checkout@v4
187187
- uses: docker/setup-buildx-action@v3

Cargo.lock

Lines changed: 21 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ typegraph = { path = "src/typegraph/graph" }
5151
clap = "=4.5.13"
5252
clap_complete = "=4.5.12"
5353
clap-verbosity-flag = "2.2.2"
54-
colored = "2.1.0"
54+
colored = "3"
5555
dialoguer = "0.11.0"
5656
self_update = "0.41.0"
5757
tabled = "0.15.0"
@@ -151,7 +151,7 @@ env_logger = "=0.11.0"
151151
log = "0.4.22" # FIXME: replace with tracing
152152
tracing = "0.1"
153153
# tracing core helper
154-
tracing-subscriber = { version = "0.3.18", features = [
154+
tracing-subscriber = { version = "0.3.19", features = [
155155
"env-filter",
156156
"parking_lot",
157157
"tracing-log",

0 commit comments

Comments
 (0)