Skip to content

perf: generate only used Azure models - #646

Merged
alongubkin merged 2 commits into
mainfrom
alon/alien-862-prune-azure-models
Sep 17, 2026
Merged

alongubkin merged 2 commits into
mainfrom
alon/alien-862-prune-azure-models

Conversation

@alongubkin

Copy link
Copy Markdown
Member

Summary

  • generate only Azure schemas transitively reachable from models used by Alien
  • preserve the complete published model API behind the default full-models feature
  • add real-spec reachability tests and a filtered-output size regression guard

Impact

  • schemas: 1,850 -> 1,260 (-31.9%)
  • generated Rust: 196,983 -> 147,886 lines (-24.9%)
  • generated structs: 1,690 -> 1,126 (-33.4%)
  • generated impls: 6,754 -> 5,069 (-25.0%)
  • observed Azure rustc unit: 46.8s -> 26.9s
  • observed generator build script: 6.2s -> 2.9s

The filtered timing run reused dependency artifacts from the baseline target, so source-size changes are the controlled evidence and timings are directional.

Validation

  • cargo test -p alien-azure-clients --test schema_filter --no-default-features
  • cargo test -p alien-azure-clients --lib --no-default-features (57 passed)
  • cargo test -p alien-azure-clients --no-default-features --no-run
  • cargo check -p alien-infra --features all-platforms,test-utils
  • cargo check -p alien-azure-clients (default complete-model compatibility mode)
  • git diff --check

Linear: ALIEN-862

@greptile-apps

greptile-apps Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no new actionable issue introduced since the previous review and no outstanding prior finding.

Summary

This PR reduces Azure client generation work by retaining only schemas transitively reachable from Alien’s required models while preserving the complete published model API through the default full-models feature.

  • Adds deterministic schema-reference traversal for OpenAPI components and Swagger definitions.
  • Defines per-spec model roots and validates them against the checked-in Azure specifications.
  • Disables default Azure client features for internal workspace dependencies so Alien builds receive the filtered model set.
  • Adds filtered-output size and schema-count regression guards.
  • The only change since the previous review reformats one JSON array and introduces no behavioral change.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Build[Build alien-azure-clients] --> Feature{full-models enabled?}
  Feature -->|Yes, default public API| Full[Generate every Azure schema]
  Feature -->|No, internal Alien dependency| Roots[Load model_roots.json]
  Roots --> Traverse[Traverse transitive schema references]
  Traverse --> Filter[Remove unreachable schemas]
  Filter --> Guard[Check generated-line regression limit]
  Full --> Output[Generate Rust Azure models]
  Guard --> Output
Loading

Reviews (2) · Last reviewed commit: "chore: format Azure model roots"

Comment thread crates/alien-azure-clients/Cargo.toml
@alongubkin

Copy link
Copy Markdown
Member Author

@greptileai Please re-review this PR. The only prior finding was explicitly withdrawn after confirming that full-models remains the default to preserve the published crate API, while Alien dependency builds intentionally disable default features and use the filtered model set. Both modes are validated.

@alongubkin
alongubkin merged commit a309e25 into main Sep 17, 2026
22 checks passed
@alongubkin
alongubkin deleted the alon/alien-862-prune-azure-models branch September 17, 2026 18:46
alongubkin added a commit that referenced this pull request Sep 18, 2026
## Summary

- make the deterministic reachable Azure model set the ordinary build
- keep the complete generated catalog available through explicit
`full-models`
- prevent default-feature unification from silently erasing the
model-pruning win

## Measured impact

A controlled cold four-job Platform manager check, which exercises Alien
cloud clients and controllers:

- `full-models` default: Cargo elapsed **10m27s**
- reachable-model default: Cargo elapsed **3m55s**
- reduction: **6m32s / 62.5%**

Both runs used fresh isolated targets. OS wall time was distorted by
machine suspension, so the reported comparison uses Cargo elapsed time.

The underlying generated Azure model input remains **147,886 lines**,
down from **196,983 lines** before PR #646. This PR makes that smaller
graph automatic rather than opt-in.

## Validation

- ordinary Alien CLI and Platform manager feature graphs do not activate
`full-models`
- 57/57 offline `alien-azure-clients` tests pass in the new default mode
- `cargo check -p alien-azure-clients --features full-models --locked`
passes
- `cargo package -p alien-azure-clients --list --allow-dirty` passes
- Platform `alien-managerx` production check passes and all 132 manager
tests pass against the reachable-model graph
- credential-gated Azure integration tests compile; local execution
stops at the existing missing `.env.test` precondition

Linear: ALIEN-894
alongubkin added a commit that referenced this pull request Sep 18, 2026
## Summary

- split the 147,886-line generated Azure model unit into five
line-balanced crates that rustc can compile in parallel
- preserve `alien_azure_clients::models::<service>` paths through
re-exports and forward filtered/full model modes
- centralize shard ownership in one manifest used by build scripts,
tests, and OpenAPI regeneration
- publish the generator and model shards before `alien-azure-clients` in
the explicit release order

This PR is intentionally stacked on #646, which supplies reachable-model
filtering.

## Measurements

Controlled empty-target `cargo check -p alien-azure-clients
--no-default-features --timings`:

- before: 41.72s; monolithic Azure unit 26.5s
- after: 22.75s; five parallel model units 4.0-4.7s, parent 6.5s
- improvement: 45.5%

A real retained OpenAPI schema edit rebuilt one shard plus the parent in
2.65s.

A local-only empty-target branch containing every proven compile-time PR
completed `cargo check -p alien-cli --timings` in 1m38s / 99.00s real,
down from the original 7m13s baseline (77.1%, 4.37x faster). The five
Azure shards ran concurrently in 6.4-7.5s.

## Validation

- shard manifest uniquely and exactly covers all 25 checked-in Azure
specifications
- `cargo test -p alien-azure-clients --no-default-features --test
schema_filter` (3 passed)
- `cargo test -p alien-azure-clients --no-default-features --lib` (57
passed)
- `cargo test -p alien-azure-clients --lib` (57 passed)
- `cargo check -p alien-infra --features all-platforms,test-utils`
- package file lists generated for the generator, five model crates, and
parent client
- `git diff --check`

All isolated targets were deleted after evidence capture; the largest
reached 13GB.

Linear: ALIEN-868
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant