feat: implement automatic bidirectional environment variable synchronization#4876
Open
tinovyatkin wants to merge 3 commits intoaws:mainfrom
Open
feat: implement automatic bidirectional environment variable synchronization#4876tinovyatkin wants to merge 3 commits intoaws:mainfrom
tinovyatkin wants to merge 3 commits intoaws:mainfrom
Conversation
…ization This implementation provides automatic, immediate, bidirectional synchronization of environment variables between Python JSII runtime and Node.js kernel processes. ## Core Components ### Node.js/TypeScript Implementation - **EnvironmentMonitor**: Proxy-based monitoring of process.env changes - **Enhanced Kernel API**: Added env.notifyChange method for external sync - **Comprehensive test coverage**: 79 passing tests across 3 test suites ### Python Implementation - **PythonEnvironmentMonitor**: Wrapper for os.environ with change detection - **Enhanced ProcessProvider**: Bidirectional sync logic between runtimes - **Thread-safe operations**: Proper locking for concurrent access ### Test Infrastructure - **TypeScript tests**: Full coverage of EnvironmentMonitor, Kernel integration, API types - **Python tests**: Comprehensive testing of Python-side functionality - **Integration utilities**: Test helpers in jsii-calc for end-to-end validation ## Key Features - Zero configuration required - works automatically - Immediate synchronization via synchronous IPC - Proper handling of undefined/null values as deletions - Thread-safe concurrent access - Maintains backward compatibility - Comprehensive error handling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Enhanced Python type definitions to use Literal types for better type safety: - EnvironmentChangeRequest.api now uses Literal["env.notifyChange"] - EnvironmentChangeRequest.type now uses Literal["set", "delete"] - EnvironmentChangeEvent.type now uses Literal["set", "delete"] This provides compile-time type checking and prevents invalid string values, improving code safety and IDE support. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
This PR is missing a description of what problem it is solving, and why and how it solves it. |
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.
Summary
This PR implements automatic bidirectional environment variable synchronization between Python JSII runtime and Node.js kernel processes, as specified in the design document.
Key Features
Implementation Components
Node.js/TypeScript Side
process.envchangesenv.notifyChangemethod for external synchronizationPython Side
os.environwith automatic change detectionTest Infrastructure
Technical Details
The implementation uses:
Files Changed
Test plan
🤖 Generated with Claude Code