fix: static schema gen#2948
Merged
markphelps merged 5 commits intomainfrom Apr 20, 2026
Merged
Conversation
Signed-off-by: Mark Phelps <mphelps@cloudflare.com>
Reorder the cog-base-image Dockerfile layers so user python_packages (torch, diffusers, etc.) are installed before the cog SDK/coglet. This means changing the SDK wheel (via COG_SDK_WHEEL, --cog-ref, or version bumps) no longer invalidates the Docker cache for expensive user dependencies. Previously, an SDK change would force a full rebuild of multi-GB packages like torch. The non-cog-base-image path already had this ordering. Now both paths are consistent.
Signed-off-by: Mark Phelps <mphelps@cloudflare.com>
Signed-off-by: Mark Phelps <mphelps@cloudflare.com>
Signed-off-by: Mark Phelps <mphelps@cloudflare.com>
Contributor
There was a problem hiding this comment.
LGTM - all changes are well-reasoned improvements:
-
Dockerfile ordering: Installing user packages before SDK improves layer caching when using
--cog-reforCOG_SDK_WHEEL. -
Enum schema naming: Using lowercase parameter names matches runtime behavior.
-
Default value handling:
default=Noneon non-optional fields now correctly treated as required (matching runtime). -
Module-level descriptions: Parser now resolves descriptions from module variables.
-
Sequential builds: Prevents OOM on memory-constrained Docker VMs during schema comparison.
Contributor
|
LGTM |
michaeldwan
approved these changes
Apr 20, 2026
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.
This pull request introduces several improvements and bug fixes to the Dockerfile generation, OpenAPI schema generation, and Python static analysis for the project. The most significant changes include reordering Dockerfile steps for better caching, refining OpenAPI schema handling for default values and enum naming, and enhancing the static parser to resolve descriptions from module-level variables. Additionally, the test harness now builds Docker images sequentially to avoid resource exhaustion.
Dockerfile Generation Improvements
StandardGeneratorto install user Python packages before the SDK, improving Docker cache efficiency and reducing rebuild times when the SDK changes. Test expectations were updated to match this new order. [1] [2] [3] [4] [5] [6] [7]OpenAPI Schema Generation Fixes
default=Noneare only considered to have a default if they are optional, matching runtime behavior. Added tests to ensure required fields withdefault=Noneare not treated as having a default, while optional fields emit"default": null. [1] [2]Python Static Analysis Enhancements
Test Harness Resource Management