server-side proxy calls#705
Conversation
✅ Deploy Preview for jumpstarter-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdds cached proxy-target resolution to Proxy, centralizes resolution in Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Proxy
participant Resolver as _resolve_proxy_target
participant Target
Caller->>Proxy: call report()/enumerate()/attribute
Proxy->>Resolver: resolve(root?, name)
Note over Resolver: compute target from ref\ncache to _proxy_target
Resolver-->>Proxy: resolved Target (cached)
Proxy->>Target: delegate method / attribute access
Target-->>Proxy: result / value
Proxy-->>Caller: result / value
sequenceDiagram
participant Test as Test/Parent.initialize()
participant Parent
participant ChildProxy as children["serial"] (Proxy)
participant Resolver as _resolve_proxy_target
participant Serial as MockSerial
Test->>Parent: initialize()
Parent->>ChildProxy: connect()
ChildProxy->>Resolver: resolve(self or root, "serial")
Resolver-->>ChildProxy: MockSerial (cached)
ChildProxy->>Serial: connect()
Serial-->>ChildProxy: "connected"
ChildProxy-->>Parent: return "connected"
Parent-->>Test: return
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧬 Code graph analysis (2)packages/jumpstarter/jumpstarter/driver/base.py (1)
packages/jumpstarter-driver-composite/jumpstarter_driver_composite/driver_test.py (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
🔇 Additional comments (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
15ed6cf to
f653f2c
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/jumpstarter-driver-composite/jumpstarter_driver_composite/driver.py(2 hunks)packages/jumpstarter-driver-composite/jumpstarter_driver_composite/driver_test.py(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/jumpstarter-driver-composite/jumpstarter_driver_composite/driver_test.py (3)
packages/jumpstarter-driver-composite/jumpstarter_driver_composite/driver.py (5)
Composite(17-18)Proxy(22-51)client(12-13)client(27-28)enumerate(45-46)packages/jumpstarter/jumpstarter/common/utils.py (1)
serve(31-39)packages/jumpstarter/jumpstarter/driver/base.py (3)
Driver(56-277)client(101-104)enumerate(219-230)
packages/jumpstarter-driver-composite/jumpstarter_driver_composite/driver.py (2)
packages/jumpstarter/jumpstarter/driver/base.py (4)
Driver(56-277)client(101-104)report(198-217)enumerate(219-230)packages/jumpstarter-driver-composite/jumpstarter_driver_composite/driver_test.py (2)
client(15-16)client(32-33)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: pytest-matrix (ubuntu-24.04, 3.13)
- GitHub Check: pytest-matrix (macos-15, 3.12)
- GitHub Check: pytest-matrix (ubuntu-24.04, 3.11)
- GitHub Check: pytest-matrix (macos-15, 3.13)
- GitHub Check: pytest-matrix (macos-15, 3.11)
- GitHub Check: pytest-matrix (ubuntu-24.04, 3.12)
- GitHub Check: e2e
When using a ref: that is internally used by another driver on the server side, forward the calls to the target driver. Needs to resolve the target device first, and for that we need the actual root device as a reference point to start the search from. Raise on improper use - trying to access report() or other driver call before the target is resolved. Also change report() to not require "root", as the function always returns a report of itself - or the proxy target in case of Proxy driver
f653f2c to
ba567ee
Compare
| if not path: | ||
| raise ConfigurationError(f"Proxy driver {name} has empty path") | ||
| return reduce(lambda instance, name: instance.children[name], path, root) | ||
| self._proxy_target = reduce(lambda instance, name: instance.children[name], path, root) |
There was a problem hiding this comment.
I use functional programming so little that I had to unshelve my textbooc to remember reduce ! (so sad! X-D)
|
Successfully created backport PR for |
When using a ref: that is internally used by another driver on the server side, forward the calls to the target driver.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Tests