Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates Flash’s project scanning and resource discovery from AST-based parsing to runtime importing + object inspection, enabling detection of dynamically constructed endpoints/resources while also fixing missing idleTimeout propagation.
Changes:
- Replace
RemoteDecoratorScanner/ResourceDiscoverypatterns withRuntimeScanner-driven import+inspect scanning across build/run flows. - Update
Endpointto support nameless QB decorator mode (derive name from decorated target) while requiringname/idonly forimage=client mode and enforcingnamefor LB route registration. - Propagate
idleTimeoutthrough manifest generation and runtime provisioning; update/trim tests accordingly.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_p2_remaining_gaps_2.py | Updates scanner references from RemoteDecoratorScanner to RuntimeScanner for empty-project behavior. |
| tests/unit/test_p2_remaining_gaps.py | Updates nested-class/conditional scanning tests to use RuntimeScanner. |
| tests/unit/test_p2_gaps.py | Updates docstring extraction test to use RuntimeScanner. |
| tests/unit/test_endpoint.py | Adjusts validation expectations and adds coverage for nameless QB decorator mode. |
| tests/unit/test_discovery_endpoint.py | Removes ResourceDiscovery endpoint pattern tests (scanner/discovery migration). |
| tests/unit/test_discovery.py | Removes ResourceDiscovery unit tests (scanner/discovery migration). |
| tests/unit/cli/test_run.py | Updates mocks for _scan_project_workers new return shape. |
| tests/unit/cli/commands/test_run_endpoint.py | Updates _scan_project_workers call sites for new return shape. |
| tests/unit/cli/commands/test_run.py | Updates _scan_project_workers call sites for new return shape. |
| tests/unit/cli/commands/test_build.py | Updates test fixtures to construct valid Live* resources under runtime import scanning (adds name=). |
| tests/unit/cli/commands/build_utils/test_scanner_load_balancer.py | Removes AST-scanner FastAPI detection tests (scanner migration). |
| tests/unit/cli/commands/build_utils/test_scanner_endpoint.py | Removes AST-scanner Endpoint pattern tests (scanner migration). |
| tests/unit/cli/commands/build_utils/test_scanner.py | Removes AST-scanner test suite (scanner migration). |
| tests/unit/cli/commands/build_utils/test_path_utilities.py | Updates scanner import to RuntimeScanner for LB/QB flags and init exclusion tests. |
| tests/integration/test_lb_remote_execution.py | Updates integration assertions for RuntimeScanner and name normalization (-fb suffix). |
| tests/integration/test_build_pipeline.py | Updates scanner import and expected resource naming (-fb suffix); minor docstring normalization. |
| src/runpod_flash/runtime/resource_provisioner.py | Passes idleTimeout from manifest into deployment kwargs. |
| src/runpod_flash/execute_class.py | Adds _wrapped_class to RemoteClassWrapper for scanner/introspection to recover original class metadata. |
| src/runpod_flash/endpoint.py | Allows nameless QB decorator mode (derive name in __call__), tightens LB route validation, clarifies image-mode requirement. |
| src/runpod_flash/core/discovery.py | Removes AST-based ResourceDiscovery implementation. |
| src/runpod_flash/cli/commands/run.py | Switches runtime worker scan/discovery to import+inspect; surfaces scanner import errors; updates worker scanning API. |
| src/runpod_flash/cli/commands/build_utils/scanner.py | Introduces RuntimeScanner import+inspect discovery with AST-only cross-call analysis pass. |
| src/runpod_flash/cli/commands/build_utils/manifest.py | Ensures idleTimeout is included in manifest resource config extraction. |
| src/runpod_flash/cli/commands/build.py | Uses RuntimeScanner in build; prints import failures and exits when none are discovered. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
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.
Replace AST-based resource discovery with runtime import scanning
the old scanner (
RemoteDecoratorScanner,ResourceDiscovery) used Python's AST module to statically parse source files and find@remotedecorated functions and resource configurations. This worked for simple cases but broke on any dynamic Python pattern (computed decorators, conditional definitions, programmatic resource construction, class inheritance, etc.)this approach imports each user module via
importliband inspects live objects. The@remotedecorator andEndpointclass stamp a__remote_config__dict on decorated functions, so the scanner just walks module members looking for that attribute. this means anything that runs at import time is discovered correctly, regardless of how it was constructed.How it works
RuntimeScannerinscanner.py:.pyfiles in the project (respecting.flashignore)importlib.util__remote_config__attributesRemoteFunctionMetadatafrom the live objects (resource config, function signature, dependencies, paths)@remotefunction calls another)Import failures are collected and surfaced clearly in both
flash runandflash deploy. Syntax errors, missing dependencies, and validation errors (e.g. forgettingname=on a load-balanced endpoint) show the filename and error message. The build stops immediately on fatal errors instead of silently continuing with zero discovered functions.Fixes AE-2321
Other fixes bundled in
idleTimeoutmissing from deploy pipeline:_extract_config_properties()inmanifest.pyandcreate_resource_from_manifest()inresource_provisioner.pywere not passingidleTimeoutthrough, so all endpoints got the default 60s regardless of what the user specified._wrapped_classonRemoteClassWrapper: Added a class-level attribute so the scanner can recover the original class name and method definitions from wrapped classes.